mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-10 01:50:53 +09:00
Removing incomplete mono debugger experiment (#105899)
This commit is contained in:
parent
1c0ce305ce
commit
a4fe68fcb3
48 changed files with 0 additions and 9388 deletions
|
@ -900,9 +900,6 @@ endif()
|
|||
add_subdirectory("${CLR_SRC_NATIVE_DIR}/public" public_apis)
|
||||
|
||||
add_subdirectory(mono)
|
||||
if (ENABLE_MSCORDBI AND NOT TARGET_ARCH STREQUAL "arm64" AND NOT CMAKE_CROSSCOMPILING AND NOT TARGET_IOS AND NOT TARGET_TVOS AND NOT TARGET_ANDROID AND NOT TARGET_BROWSER AND NOT TARGET_WASI AND NOT HOST_MACCAT)
|
||||
add_subdirectory(dlls/mscordbi)
|
||||
endif()
|
||||
|
||||
configure_file(cmake/config.h.in config.h)
|
||||
configure_file(cmake/eglib-config.h.cmake.in mono/eglib/eglib-config.h)
|
||||
|
|
|
@ -41,7 +41,6 @@ option (ENABLE_CHECKED_BUILD_GC "Enable runtime GC Safe / Unsafe mode assertion
|
|||
option (ENABLE_CHECKED_BUILD_THREAD "Enable runtime history of per-thread coop state transitions (must set env var MONO_CHECK_MODE=thread)")
|
||||
option (ENABLE_CHECKED_BUILD_METADATA "Enable runtime checks of mempool references between metadata images (must set env var MONO_CHECK_MODE=metadata)")
|
||||
option (ENABLE_CHECKED_BUILD_CASTS "Enable runtime checks of casts between types")
|
||||
option (ENABLE_MSCORDBI "Generate mscordbi to support icordbg interface")
|
||||
option (ENABLE_SMALL_CONFIG "Reduce runtime requirements (and capabilities)")
|
||||
option (ENABLE_DTRACE "Enable DTrace probes")
|
||||
option (ENABLE_EXPERIMENT_TIERED "Enable experiment 'Tiered Compilation'")
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
project(dbgshim)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CLR_CMAKE_RUNTIME_MONO 1)
|
||||
set(CLR_DIR ${CLR_REPO_ROOT_DIR}/src/coreclr)
|
||||
set(CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR})
|
||||
set(CMAKE_EXE_LINKER_FLAGS_CHECKED "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
|
||||
set(CLR_CMAKE_HOST_ARCH ${CMAKE_GENERATOR_PLATFORM})
|
||||
set(FEATURE_EVENT_TRACE 0)
|
||||
|
||||
if(HOST_WIN32)
|
||||
if(HOST_X86)
|
||||
set(CLR_CMAKE_HOST_ARCH x86)
|
||||
elseif(HOST_ARM64)
|
||||
set(CLR_CMAKE_HOST_ARCH arm64)
|
||||
elseif(HOST_ARM)
|
||||
set(CLR_CMAKE_HOST_ARCH arm)
|
||||
elseif(HOST_AMD64)
|
||||
set(CLR_CMAKE_HOST_ARCH x64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)
|
||||
|
||||
add_definitions(-D_WIN32_WINNT=0x0602)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../..
|
||||
${PROJECT_SOURCE_DIR}/../../
|
||||
${PROJECT_SOURCE_DIR}/../mscordbi
|
||||
${PROJECT_SOURCE_DIR}/../mscordbi/socket-dbi
|
||||
${CLR_DIR}/md/enc
|
||||
${CLR_DIR}/inc
|
||||
${CLR_DIR}/pal/inc
|
||||
${CLR_DIR}/md/inc
|
||||
${CLR_DIR}/md/compiler
|
||||
${CLR_DIR}/pal/prebuilt/inc
|
||||
${CLR_DIR}/nativeresources)
|
||||
|
||||
if (CLR_CMAKE_HOST_UNIX)
|
||||
include_directories(${CLR_DIR}/pal/inc)
|
||||
include_directories(${CLR_DIR}/pal/inc/rt)
|
||||
include_directories(${CLR_DIR}/pal/src/safecrt)
|
||||
|
||||
append("-Wno-missing-prototypes -Wno-pointer-arith -Wno-macro-redefined" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
|
||||
include_directories(${CLR_DIR}/pal/inc/rt/cpp)
|
||||
endif (CLR_CMAKE_HOST_UNIX)
|
||||
|
||||
set(DBGSHIM_SOURCES
|
||||
dbgshim.cpp
|
||||
)
|
||||
|
||||
if(HOST_DARWIN)
|
||||
set(OS_LIBS "-framework CoreFoundation" "-framework Foundation")
|
||||
elseif(HOST_LINUX)
|
||||
set(OS_LIBS pthread m dl)
|
||||
elseif(HOST_WIN32)
|
||||
set(OS_LIBS bcrypt.lib Mswsock.lib ws2_32.lib psapi.lib version.lib advapi32.lib winmm.lib kernel32.lib)
|
||||
set(DBGSHIM_SOURCES "${DBGSHIM_SOURCES};${VERSION_FILE_RC_PATH}") # this is generated by GenerateMonoVersionFile in mono.proj
|
||||
endif()
|
||||
|
||||
add_library(dbgshim SHARED ${DBGSHIM_SOURCES})
|
||||
|
||||
set(DBGSHIM_LIBRARIES
|
||||
${OS_LIBS}
|
||||
utilcodestaticnohost
|
||||
)
|
||||
|
||||
if(CLR_CMAKE_HOST_UNIX)
|
||||
list(APPEND DBGSHIM_LIBRARIES
|
||||
coreclrpal
|
||||
palrt
|
||||
nativeresourcestring
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(dbgshim PRIVATE ${DBGSHIM_LIBRARIES} monoapi)
|
||||
install_with_stripped_symbols(dbgshim TARGETS lib)
|
|
@ -1,322 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//*****************************************************************************
|
||||
// DbgShim.cpp
|
||||
//
|
||||
// dbgshim is responsible to start the debuggee process with debug parameters and to
|
||||
// load the correct mscordbi that will connect with mono runtime.
|
||||
//*****************************************************************************
|
||||
|
||||
#include <utilcode.h>
|
||||
|
||||
#include "dbgshim.h"
|
||||
|
||||
#include "palclr.h"
|
||||
#if defined(TARGET_WINDOWS)
|
||||
#include <libloaderapi.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#define putenv _putenv
|
||||
#endif
|
||||
|
||||
#ifndef MAX_LONGPATH
|
||||
#define MAX_LONGPATH 1024
|
||||
#endif
|
||||
|
||||
#ifdef HOST_UNIX
|
||||
#define INITIALIZE_SHIM { if (PAL_InitializeDLL() != 0) return E_FAIL; }
|
||||
#else
|
||||
#define INITIALIZE_SHIM
|
||||
#endif
|
||||
|
||||
// Contract for public APIs. These must be NOTHROW.
|
||||
#define PUBLIC_CONTRACT \
|
||||
INITIALIZE_SHIM \
|
||||
CONTRACTL \
|
||||
{ \
|
||||
NOTHROW; \
|
||||
} \
|
||||
CONTRACTL_END;
|
||||
|
||||
// Functions that we'll look for in the loaded Mscordbi module.
|
||||
typedef HRESULT (STDAPICALLTYPE *FPCoreCLRCreateCordbObject)(
|
||||
int iDebuggerVersion,
|
||||
DWORD pid,
|
||||
HMODULE hmodTargetCLR,
|
||||
IUnknown **ppCordb);
|
||||
|
||||
static HRESULT RunAndroidCmd(char* c_android_adb_path, char const* c_command_to_execute)
|
||||
{
|
||||
PROCESS_INFORMATION processInfo;
|
||||
STARTUPINFOW startupInfo;
|
||||
DWORD dwCreationFlags = 0;
|
||||
|
||||
ZeroMemory(&processInfo, sizeof(processInfo));
|
||||
ZeroMemory(&startupInfo, sizeof(startupInfo));
|
||||
|
||||
startupInfo.cb = sizeof(startupInfo);
|
||||
|
||||
LPWSTR w_android_run_adb_command = (LPWSTR)malloc(2048 * sizeof(WCHAR));
|
||||
char* c_android_run_adb_command = (char*)malloc(2048 * sizeof(char));
|
||||
|
||||
sprintf_s(c_android_run_adb_command, 2048, "%s %s", c_android_adb_path, c_command_to_execute);
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, c_android_run_adb_command, -1, w_android_run_adb_command, 2048);
|
||||
BOOL result = CreateProcessW(
|
||||
NULL,
|
||||
w_android_run_adb_command,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
dwCreationFlags,
|
||||
NULL,
|
||||
NULL,
|
||||
&startupInfo,
|
||||
&processInfo);
|
||||
|
||||
if (!result) {
|
||||
free(c_android_run_adb_command);
|
||||
free(w_android_run_adb_command);
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
free(c_android_run_adb_command);
|
||||
free(w_android_run_adb_command);
|
||||
return S_OK;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// Public API.
|
||||
//
|
||||
// CreateProcessForLaunch - a stripped down version of the Windows CreateProcess
|
||||
// that can be supported cross-platform.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
MONO_API HRESULT
|
||||
CreateProcessForLaunch(
|
||||
_In_ LPWSTR lpCommandLine,
|
||||
_In_ BOOL bSuspendProcess,
|
||||
_In_ LPVOID lpEnvironment,
|
||||
_In_ LPCWSTR lpCurrentDirectory,
|
||||
_Out_ PDWORD pProcessId,
|
||||
_Out_ HANDLE *pResumeHandle)
|
||||
{
|
||||
PUBLIC_CONTRACT;
|
||||
PROCESS_INFORMATION processInfo;
|
||||
STARTUPINFOW startupInfo;
|
||||
DWORD dwCreationFlags = 0;
|
||||
|
||||
ZeroMemory(&processInfo, sizeof(processInfo));
|
||||
ZeroMemory(&startupInfo, sizeof(startupInfo));
|
||||
|
||||
startupInfo.cb = sizeof(startupInfo);
|
||||
char* c_android_adb_path = getenv("ANDROID_ADB_PATH");
|
||||
|
||||
if (strlen(c_android_adb_path) > 0) {
|
||||
HRESULT ret = RunAndroidCmd(c_android_adb_path, "shell setprop debug.mono.extra \"debug=10.0.2.2:56000,loglevel=10,timeout=100000000000000\"");
|
||||
if (ret != S_OK) {
|
||||
*pProcessId = 0;
|
||||
*pResumeHandle = NULL;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
putenv("MONO_ENV_OPTIONS='--debugger-agent=transport=dt_socket,address=127.0.0.1:pid_based,server=n,suspend=y,loglevel=10,timeout=100000'");
|
||||
|
||||
BOOL result = CreateProcessW(
|
||||
NULL,
|
||||
lpCommandLine,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
dwCreationFlags,
|
||||
NULL,
|
||||
lpCurrentDirectory,
|
||||
&startupInfo,
|
||||
&processInfo);
|
||||
|
||||
if (!result) {
|
||||
*pProcessId = 0;
|
||||
*pResumeHandle = NULL;
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
|
||||
if (processInfo.hProcess != NULL)
|
||||
{
|
||||
CloseHandle(processInfo.hProcess);
|
||||
}
|
||||
|
||||
if (strlen(c_android_adb_path) > 0) {
|
||||
*pProcessId = 1000; //TODO identify the correct processID of the process running on android or find another way to decide the port number
|
||||
}
|
||||
else {
|
||||
*pProcessId = processInfo.dwProcessId;
|
||||
*pResumeHandle = processInfo.hThread;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
ResumeProcess(
|
||||
_In_ HANDLE hResumeHandle)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
CloseResumeHandle(
|
||||
_In_ HANDLE hResumeHandle)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CreateCoreDbg(HMODULE hDBIModule, DWORD processId, int iDebuggerVersion, IUnknown **ppCordb)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
#if defined(TARGET_WINDOWS)
|
||||
FPCoreCLRCreateCordbObject fpCreate =
|
||||
(FPCoreCLRCreateCordbObject)GetProcAddress(hDBIModule, "CoreCLRCreateCordbObject");
|
||||
#else
|
||||
FPCoreCLRCreateCordbObject fpCreate = (FPCoreCLRCreateCordbObject)dlsym (hDBIModule, "CoreCLRCreateCordbObject");
|
||||
#endif
|
||||
|
||||
if (fpCreate == NULL)
|
||||
{
|
||||
return CORDBG_E_INCOMPATIBLE_PROTOCOL;
|
||||
}
|
||||
|
||||
return fpCreate(iDebuggerVersion, processId, NULL, ppCordb);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static IUnknown* pCordb = NULL;
|
||||
|
||||
MONO_API HRESULT
|
||||
RegisterForRuntimeStartup(
|
||||
_In_ DWORD dwProcessId,
|
||||
_In_ PSTARTUP_CALLBACK pfnCallback,
|
||||
_In_ PVOID parameter,
|
||||
_Out_ PVOID *ppUnregisterToken)
|
||||
{
|
||||
if (pCordb != NULL)
|
||||
return S_OK;
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
HMODULE hMod = NULL;
|
||||
|
||||
char* msCorDbiPath = getenv("MSCORDBI_PATH");
|
||||
#ifdef TARGET_WINDOWS
|
||||
hMod = LoadLibraryA(msCorDbiPath);
|
||||
#else
|
||||
hMod = dlopen(msCorDbiPath, RTLD_LAZY);
|
||||
#endif
|
||||
if (hMod == NULL)
|
||||
{
|
||||
hr = CORDBG_E_DEBUG_COMPONENT_MISSING;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
hr = CreateCoreDbg(hMod, dwProcessId, 0, &pCordb);
|
||||
|
||||
exit:
|
||||
if (FAILED(hr))
|
||||
{
|
||||
_ASSERTE(pCordb == NULL);
|
||||
|
||||
if (hMod != NULL)
|
||||
{
|
||||
FreeLibrary(hMod);
|
||||
}
|
||||
|
||||
// Invoke the callback on error
|
||||
pfnCallback(NULL, parameter, hr);
|
||||
return hr;
|
||||
}
|
||||
pfnCallback(pCordb, parameter, S_OK);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
RegisterForRuntimeStartupEx(
|
||||
_In_ DWORD dwProcessId,
|
||||
_In_ LPCWSTR szApplicationGroupId,
|
||||
_In_ PSTARTUP_CALLBACK pfnCallback,
|
||||
_In_ PVOID parameter,
|
||||
_Out_ PVOID *ppUnregisterToken)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
UnregisterForRuntimeStartup(
|
||||
_In_ PVOID pUnregisterToken)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
GetStartupNotificationEvent(
|
||||
_In_ DWORD debuggeePID,
|
||||
_Out_ HANDLE* phStartupEvent)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
EnumerateCLRs(DWORD debuggeePID,
|
||||
_Out_ HANDLE** ppHandleArrayOut,
|
||||
_Out_ LPWSTR** ppStringArrayOut,
|
||||
_Out_ DWORD* pdwArrayLengthOut)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
CloseCLREnumeration(
|
||||
_In_ HANDLE* pHandleArray,
|
||||
_In_ LPWSTR* pStringArray,
|
||||
_In_ DWORD dwArrayLength)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
CreateVersionStringFromModule(
|
||||
_In_ DWORD pidDebuggee,
|
||||
_In_ LPCWSTR szModuleName,
|
||||
_Out_writes_to_opt_(cchBuffer, *pdwLength) LPWSTR pBuffer,
|
||||
_In_ DWORD cchBuffer,
|
||||
_Out_ DWORD* pdwLength)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
CreateDebuggingInterfaceFromVersionEx(
|
||||
_In_ int iDebuggerVersion,
|
||||
_In_ LPCWSTR szDebuggeeVersion,
|
||||
_Out_ IUnknown ** ppCordb)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API
|
||||
HRESULT
|
||||
CreateDebuggingInterfaceFromVersion2(
|
||||
_In_ int iDebuggerVersion,
|
||||
_In_ LPCWSTR szDebuggeeVersion,
|
||||
_In_ LPCWSTR szApplicationGroupId,
|
||||
_Out_ IUnknown ** ppCordb)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT
|
||||
CreateDebuggingInterfaceFromVersion(
|
||||
_In_ LPCWSTR szDebuggeeVersion,
|
||||
_Out_ IUnknown ** ppCordb)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//*****************************************************************************
|
||||
// DbgShim.h
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <mono/utils/mono-publib.h>
|
||||
|
||||
#if defined(TARGET_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <libloaderapi.h>
|
||||
#endif
|
||||
|
||||
#include <unknwn.h>
|
||||
|
||||
typedef VOID (*PSTARTUP_CALLBACK)(IUnknown *pCordb, PVOID parameter, HRESULT hr);
|
||||
|
||||
|
||||
MONO_API HRESULT
|
||||
CreateProcessForLaunch(
|
||||
_In_ LPWSTR lpCommandLine,
|
||||
_In_ BOOL bSuspendProcess,
|
||||
_In_ LPVOID lpEnvironment,
|
||||
_In_ LPCWSTR lpCurrentDirectory,
|
||||
_Out_ PDWORD pProcessId,
|
||||
_Out_ HANDLE *pResumeHandle);
|
||||
|
||||
MONO_API HRESULT
|
||||
ResumeProcess(
|
||||
_In_ HANDLE hResumeHandle);
|
||||
|
||||
MONO_API HRESULT
|
||||
CloseResumeHandle(
|
||||
_In_ HANDLE hResumeHandle);
|
||||
|
||||
MONO_API HRESULT
|
||||
RegisterForRuntimeStartup(
|
||||
_In_ DWORD dwProcessId,
|
||||
_In_ PSTARTUP_CALLBACK pfnCallback,
|
||||
_In_ PVOID parameter,
|
||||
_Out_ PVOID *ppUnregisterToken);
|
||||
|
||||
MONO_API HRESULT
|
||||
RegisterForRuntimeStartupEx(
|
||||
_In_ DWORD dwProcessId,
|
||||
_In_ LPCWSTR szApplicationGroupId,
|
||||
_In_ PSTARTUP_CALLBACK pfnCallback,
|
||||
_In_ PVOID parameter,
|
||||
_Out_ PVOID *ppUnregisterToken);
|
||||
|
||||
MONO_API HRESULT
|
||||
UnregisterForRuntimeStartup(
|
||||
_In_ PVOID pUnregisterToken);
|
||||
|
||||
MONO_API HRESULT
|
||||
GetStartupNotificationEvent(
|
||||
_In_ DWORD debuggeePID,
|
||||
_Out_ HANDLE* phStartupEvent);
|
||||
|
||||
MONO_API HRESULT
|
||||
EnumerateCLRs(DWORD debuggeePID,
|
||||
_Out_ HANDLE** ppHandleArrayOut,
|
||||
_Out_ LPWSTR** ppStringArrayOut,
|
||||
_Out_ DWORD* pdwArrayLengthOut);
|
||||
|
||||
MONO_API HRESULT
|
||||
CloseCLREnumeration(
|
||||
_In_ HANDLE* pHandleArray,
|
||||
_In_ LPWSTR* pStringArray,
|
||||
_In_ DWORD dwArrayLength);
|
||||
|
||||
MONO_API HRESULT
|
||||
CreateVersionStringFromModule(
|
||||
_In_ DWORD pidDebuggee,
|
||||
_In_ LPCWSTR szModuleName,
|
||||
_Out_writes_to_opt_(cchBuffer, *pdwLength) LPWSTR pBuffer,
|
||||
_In_ DWORD cchBuffer,
|
||||
_Out_ DWORD* pdwLength);
|
||||
|
||||
MONO_API HRESULT
|
||||
CreateDebuggingInterfaceFromVersionEx(
|
||||
_In_ int iDebuggerVersion,
|
||||
_In_ LPCWSTR szDebuggeeVersion,
|
||||
_Out_ IUnknown ** ppCordb);
|
||||
|
||||
MONO_API
|
||||
HRESULT
|
||||
CreateDebuggingInterfaceFromVersion2(
|
||||
_In_ int iDebuggerVersion,
|
||||
_In_ LPCWSTR szDebuggeeVersion,
|
||||
_In_ LPCWSTR szApplicationGroupId,
|
||||
_Out_ IUnknown ** ppCordb);
|
||||
|
||||
MONO_API HRESULT
|
||||
CreateDebuggingInterfaceFromVersion(
|
||||
_In_ LPCWSTR szDebuggeeVersion,
|
||||
_Out_ IUnknown ** ppCordb);
|
|
@ -1,164 +0,0 @@
|
|||
project(mscordbi)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CLR_CMAKE_RUNTIME_MONO 1)
|
||||
set(CLR_DIR ${CLR_REPO_ROOT_DIR}/src/coreclr)
|
||||
set(CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR})
|
||||
set(CMAKE_EXE_LINKER_FLAGS_CHECKED "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
|
||||
set(CLR_CMAKE_HOST_ARCH ${CMAKE_GENERATOR_PLATFORM})
|
||||
set(FEATURE_EVENT_TRACE 0)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_definitions(-fvisibility-global-new-delete-hidden)
|
||||
endif()
|
||||
|
||||
if(HOST_WIN32)
|
||||
if(HOST_X86)
|
||||
set(CLR_CMAKE_HOST_ARCH x86)
|
||||
elseif(HOST_ARM64)
|
||||
set(CLR_CMAKE_HOST_ARCH arm64)
|
||||
elseif(HOST_ARM)
|
||||
set(CLR_CMAKE_HOST_ARCH arm)
|
||||
elseif(HOST_AMD64)
|
||||
set(CLR_CMAKE_HOST_ARCH x64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_definitions(-DDBI_COMPONENT_MONO)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../..
|
||||
${PROJECT_SOURCE_DIR}/../../
|
||||
${PROJECT_SOURCE_DIR}/../mscordbi
|
||||
${PROJECT_SOURCE_DIR}/../mscordbi/socket-dbi
|
||||
${CLR_DIR}/md/enc
|
||||
${CLR_DIR}/inc
|
||||
${CLR_DIR}/pal/inc
|
||||
${CLR_DIR}/md/inc
|
||||
${CLR_DIR}/md/compiler
|
||||
${CLR_DIR}/pal/prebuilt/inc
|
||||
${CLR_DIR}/nativeresources)
|
||||
|
||||
set(mscorbi_sources_base
|
||||
cordb.cpp
|
||||
cordb.h
|
||||
cordb-appdomain.cpp
|
||||
cordb-appdomain.h
|
||||
cordb-assembly.cpp
|
||||
cordb-assembly.h
|
||||
cordb-blocking-obj.cpp
|
||||
cordb-blocking-obj.h
|
||||
cordb-breakpoint.cpp
|
||||
cordb-breakpoint.h
|
||||
cordb-chain.cpp
|
||||
cordb-chain.h
|
||||
cordb-class.cpp
|
||||
cordb-class.h
|
||||
cordb-code.cpp
|
||||
cordb-code.h
|
||||
cordb-eval.cpp
|
||||
cordb-eval.h
|
||||
cordb-frame.cpp
|
||||
cordb-frame.h
|
||||
cordb-function.cpp
|
||||
cordb-function.h
|
||||
cordb-process.cpp
|
||||
cordb-process.h
|
||||
cordb-register.cpp
|
||||
cordb-register.h
|
||||
cordb-stackwalk.cpp
|
||||
cordb-stackwalk.h
|
||||
cordb-stepper.cpp
|
||||
cordb-stepper.h
|
||||
cordb-thread.cpp
|
||||
cordb-thread.h
|
||||
cordb-type.cpp
|
||||
cordb-type.h
|
||||
cordb-value.cpp
|
||||
cordb-value.h
|
||||
)
|
||||
|
||||
addprefix(mscorbi_sources ../mscordbi/ "${mscorbi_sources_base}")
|
||||
|
||||
if(HOST_DARWIN)
|
||||
set(OS_LIBS "-framework CoreFoundation" "-framework Foundation")
|
||||
elseif(HOST_LINUX)
|
||||
set(OS_LIBS pthread m dl)
|
||||
elseif(HOST_WIN32)
|
||||
set(OS_LIBS bcrypt.lib Mswsock.lib ws2_32.lib psapi.lib version.lib advapi32.lib winmm.lib kernel32.lib)
|
||||
set(mscorbi_sources "${mscorbi_sources};${VERSION_FILE_RC_PATH}") # this is generated by GenerateMonoVersionFile in mono.proj
|
||||
endif()
|
||||
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/socket-dbi)
|
||||
|
||||
include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)
|
||||
|
||||
if (CLR_CMAKE_HOST_UNIX)
|
||||
# Add custom targets that the pal build expects.
|
||||
add_component(${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
|
||||
add_component(paltests_install)
|
||||
include_directories(${CLR_DIR}/pal/inc)
|
||||
include_directories(${CLR_DIR}/pal/inc/rt)
|
||||
include_directories(${CLR_DIR}/pal/src/safecrt)
|
||||
|
||||
append("-Wno-missing-prototypes -Wno-pointer-arith -Wno-macro-redefined" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
add_subdirectory(${CLR_DIR}/pal pal)
|
||||
|
||||
include_directories(${CLR_DIR}/pal/inc/rt/cpp)
|
||||
endif (CLR_CMAKE_HOST_UNIX)
|
||||
|
||||
if (CLR_CMAKE_HOST_UNIX)
|
||||
add_subdirectory(${CLR_DIR}/nativeresources nativeresources)
|
||||
endif()
|
||||
|
||||
add_subdirectory(${CLR_DIR}/md/runtime md/runtime)
|
||||
add_subdirectory(${CLR_DIR}/md/compiler md/compiler)
|
||||
|
||||
include(${CLR_DIR}/clrdefinitions.cmake)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../inc/)
|
||||
include_directories(${CLR_DIR}/minipal)
|
||||
|
||||
add_subdirectory(${CLR_DIR}/md/enc md/enc)
|
||||
add_subdirectory(${CLR_DIR}/utilcode utilcode)
|
||||
if (CLR_CMAKE_HOST_UNIX)
|
||||
add_subdirectory(${CLR_DIR}/palrt palrt)
|
||||
append("-Wno-strict-prototypes -Wno-deprecated -Wno-pointer-arith" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
endif (CLR_CMAKE_HOST_UNIX)
|
||||
|
||||
add_library(mscordbi SHARED "${mscorbi_sources};${PROJECT_SOURCE_DIR}/../../mono/component/debugger-protocol.c;${PROJECT_SOURCE_DIR}/../../../coreclr/pal/prebuilt/idl/xcordebug_i.cpp;${PROJECT_SOURCE_DIR}/../../../coreclr/pal/prebuilt/idl/cordebug_i.cpp")
|
||||
|
||||
#SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
|
||||
set_source_files_properties(${PROJECT_SOURCE_DIR}/../../mono/component/debugger-protocol.c PROPERTIES LANGUAGE CXX)
|
||||
|
||||
set(START_WHOLE_ARCHIVE -Wl,--whole-archive)
|
||||
set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive)
|
||||
# IMPORTANT! Please do not rearrange the order of the libraries. The linker on Linux is
|
||||
# order dependent and changing the order can result in undefined symbols in the shared
|
||||
# library.
|
||||
set(COREDBI_LIBRARIES
|
||||
mdruntimerw-dbi
|
||||
utilcodestaticnohost
|
||||
mdruntime-dbi
|
||||
mdcompiler-dbi
|
||||
socket-dbi
|
||||
${OS_LIBS}
|
||||
)
|
||||
if(CLR_CMAKE_HOST_UNIX)
|
||||
list(APPEND COREDBI_LIBRARIES
|
||||
${START_WHOLE_ARCHIVE}
|
||||
palrt
|
||||
coreclrpal
|
||||
${END_WHOLE_ARCHIVE}
|
||||
nativeresourcestring
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(mscordbi PRIVATE ${COREDBI_LIBRARIES} monoapi)
|
||||
install_with_stripped_symbols(mscordbi TARGETS lib)
|
|
@ -1,293 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-APPDOMAIN.CPP
|
||||
//
|
||||
|
||||
#include <cordb-appdomain.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbAppDomain::CordbAppDomain(Connection* conn, CordbProcess* ppProcess) : CordbBaseMono(conn)
|
||||
{
|
||||
pProcess = ppProcess;
|
||||
pProcess->AddAppDomain(this);
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::Stop(DWORD dwTimeoutIgnored)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - Stop - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::Continue(BOOL fIsOutOfBand)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - Continue - IMPLEMENTED\n"));
|
||||
pProcess->Continue(fIsOutOfBand);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::IsRunning(BOOL* pbRunning)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - IsRunning - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::HasQueuedCallbacks(ICorDebugThread* pThread, BOOL* pbQueued)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - HasQueuedCallbacks - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::EnumerateThreads(ICorDebugThreadEnum** ppThreads)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - EnumerateThreads - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::SetAllThreadsDebugState(CorDebugThreadState state, ICorDebugThread* pExceptThisThread)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - SetAllThreadsDebugState - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::Detach(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - Detach - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::Terminate(UINT exitCode)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - Terminate - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::CanCommitChanges(ULONG cSnapshots,
|
||||
ICorDebugEditAndContinueSnapshot* pSnapshots[],
|
||||
ICorDebugErrorInfoEnum** pError)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - CanCommitChanges - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::CommitChanges(ULONG cSnapshots,
|
||||
ICorDebugEditAndContinueSnapshot* pSnapshots[],
|
||||
ICorDebugErrorInfoEnum** pError)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - CommitChanges - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* ppInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugAppDomain)
|
||||
{
|
||||
*ppInterface = (ICorDebugAppDomain*)this;
|
||||
}
|
||||
else if (id == IID_ICorDebugAppDomain2)
|
||||
{
|
||||
*ppInterface = (ICorDebugAppDomain2*)this;
|
||||
}
|
||||
else if (id == IID_ICorDebugAppDomain3)
|
||||
{
|
||||
*ppInterface = (ICorDebugAppDomain3*)this;
|
||||
}
|
||||
else if (id == IID_ICorDebugAppDomain4)
|
||||
{
|
||||
*ppInterface = (ICorDebugAppDomain4*)this;
|
||||
}
|
||||
else if (id == IID_ICorDebugController)
|
||||
*ppInterface = (ICorDebugController*)(ICorDebugAppDomain*)this;
|
||||
else if (id == IID_IUnknown)
|
||||
*ppInterface = (IUnknown*)(ICorDebugAppDomain*)this;
|
||||
else
|
||||
{
|
||||
*ppInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::GetProcess(ICorDebugProcess** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - GetProcess - IMPLEMENTED\n"));
|
||||
pProcess->QueryInterface(IID_ICorDebugProcess, (void**)ppProcess);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::EnumerateAssemblies(ICorDebugAssemblyEnum** ppAssemblies)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - EnumerateAssemblies - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::GetModuleFromMetaDataInterface(IUnknown* pIMetaData, ICorDebugModule** ppModule)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - GetModuleFromMetaDataInterface - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::EnumerateBreakpoints(ICorDebugBreakpointEnum** ppBreakpoints)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - EnumerateBreakpoints - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::EnumerateSteppers(ICorDebugStepperEnum** ppSteppers)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - EnumerateSteppers - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::IsAttached(BOOL* pbAttached)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - IsAttached - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::GetName(ULONG32 cchName, ULONG32* pcchName, WCHAR szName[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbAppDomain - GetName - IMPLEMENTED\n"));
|
||||
if (cchName < strlen("DefaultDomain"))
|
||||
{
|
||||
*pcchName = (ULONG32)strlen("DefaultDomain") + 1;
|
||||
return S_OK;
|
||||
}
|
||||
wcscpy(szName, W("DefaultDomain"));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::GetObject(ICorDebugValue** ppObject)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - GetObject - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::Attach(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - Attach - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::GetID(ULONG32* pId)
|
||||
{
|
||||
*pId = 0;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbAppDomain - GetID - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::GetArrayOrPointerType(CorElementType elementType,
|
||||
ULONG32 nRank,
|
||||
|
||||
ICorDebugType* pTypeArg,
|
||||
ICorDebugType** ppType)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - GetArrayOrPointerType - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::GetFunctionPointerType(ULONG32 nTypeArgs, ICorDebugType* ppTypeArgs[], ICorDebugType** ppType)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - GetFunctionPointerType - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::GetCachedWinRTTypesForIIDs(ULONG32 cReqTypes,
|
||||
GUID* iidsToResolve,
|
||||
ICorDebugTypeEnum** ppTypesEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - GetCachedWinRTTypesForIIDs - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAppDomain::GetCachedWinRTTypes(ICorDebugGuidToTypeEnum** ppGuidToTypeEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - GetCachedWinRTTypes - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbAppDomain::GetObjectForCCW(CORDB_ADDRESS ccwPointer, ICorDebugValue** ppManagedObject)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomain - GetObjectForCCW - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbAppDomainEnum::Next(ULONG celt, ICorDebugAppDomain* values[], ULONG* pceltFetched)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomainEnum - Next - NOT IMPLEMENTED\n"));
|
||||
*pceltFetched = celt;
|
||||
for (ULONG i = 0; i < celt; i++)
|
||||
{
|
||||
if (current_pos >= pProcess->m_pAddDomains->GetCount())
|
||||
{
|
||||
*pceltFetched = 0;
|
||||
return S_FALSE;
|
||||
}
|
||||
CordbAppDomain* appdomain = (CordbAppDomain*)pProcess->m_pAddDomains->Get(current_pos);
|
||||
appdomain->QueryInterface(IID_ICorDebugAppDomain, (void**)values + current_pos);
|
||||
current_pos++;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbAppDomainEnum::Skip(ULONG celt)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomainEnum - Skip - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbAppDomainEnum::Reset(void)
|
||||
{
|
||||
current_pos = 0;
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomainEnum - Reset - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbAppDomainEnum::Clone(ICorDebugEnum** ppEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbAppDomainEnum - Clone - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbAppDomainEnum::GetCount(ULONG* pcelt)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbAppDomainEnum - GetCount - IMPLEMENTED\n"));
|
||||
*pcelt = pProcess->m_pAddDomains->GetCount();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbAppDomainEnum::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_IUnknown)
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugAppDomainEnum*>(this));
|
||||
else if (id == IID_ICorDebugAppDomainEnum)
|
||||
*pInterface = static_cast<ICorDebugAppDomainEnum*>(this);
|
||||
else if (id == IID_ICorDebugEnum)
|
||||
*pInterface = static_cast<ICorDebugEnum*>(this);
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CordbAppDomainEnum::CordbAppDomainEnum(Connection* conn, CordbProcess* ppProcess) : CordbBaseMono(conn)
|
||||
{
|
||||
current_pos = 0;
|
||||
this->pProcess = ppProcess;
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-APPDOMAIN.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_APPDOMAIN_H__
|
||||
#define __MONO_DEBUGGER_CORDB_APPDOMAIN_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbAppDomain : public CordbBaseMono,
|
||||
public ICorDebugAppDomain,
|
||||
public ICorDebugAppDomain2,
|
||||
public ICorDebugAppDomain3,
|
||||
public ICorDebugAppDomain4
|
||||
{
|
||||
CordbProcess* pProcess;
|
||||
|
||||
public:
|
||||
CordbAppDomain(Connection* conn, CordbProcess* ppProcess);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbAppDomain";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE Stop(DWORD dwTimeoutIgnored);
|
||||
HRESULT STDMETHODCALLTYPE Continue(BOOL fIsOutOfBand);
|
||||
HRESULT STDMETHODCALLTYPE IsRunning(BOOL* pbRunning);
|
||||
HRESULT STDMETHODCALLTYPE HasQueuedCallbacks(ICorDebugThread* pThread, BOOL* pbQueued);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateThreads(ICorDebugThreadEnum** ppThreads);
|
||||
HRESULT STDMETHODCALLTYPE SetAllThreadsDebugState(CorDebugThreadState state, ICorDebugThread* pExceptThisThread);
|
||||
HRESULT STDMETHODCALLTYPE Detach(void);
|
||||
HRESULT STDMETHODCALLTYPE Terminate(UINT exitCode);
|
||||
HRESULT STDMETHODCALLTYPE CanCommitChanges(ULONG cSnapshots, ICorDebugEditAndContinueSnapshot* pSnapshots[], ICorDebugErrorInfoEnum** pError);
|
||||
HRESULT STDMETHODCALLTYPE CommitChanges(ULONG cSnapshots, ICorDebugEditAndContinueSnapshot* pSnapshots[], ICorDebugErrorInfoEnum** pError);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* ppInterface);
|
||||
HRESULT STDMETHODCALLTYPE GetProcess(ICorDebugProcess** ppProcess);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateAssemblies(ICorDebugAssemblyEnum** ppAssemblies);
|
||||
HRESULT STDMETHODCALLTYPE GetModuleFromMetaDataInterface(IUnknown* pIMetaData, ICorDebugModule** ppModule);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateBreakpoints(ICorDebugBreakpointEnum** ppBreakpoints);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateSteppers(ICorDebugStepperEnum** ppSteppers);
|
||||
HRESULT STDMETHODCALLTYPE IsAttached(BOOL* pbAttached);
|
||||
HRESULT STDMETHODCALLTYPE GetName(ULONG32 cchName, ULONG32* pcchName, WCHAR szName[]);
|
||||
HRESULT STDMETHODCALLTYPE GetObject(ICorDebugValue** ppObject);
|
||||
HRESULT STDMETHODCALLTYPE Attach(void);
|
||||
HRESULT STDMETHODCALLTYPE GetID(ULONG32* pId);
|
||||
HRESULT STDMETHODCALLTYPE GetArrayOrPointerType(CorElementType elementType,
|
||||
ULONG32 nRank,
|
||||
ICorDebugType* pTypeArg,
|
||||
ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetFunctionPointerType(ULONG32 nTypeArgs, ICorDebugType* ppTypeArgs[], ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetCachedWinRTTypesForIIDs(ULONG32 cReqTypes, GUID* iidsToResolve, ICorDebugTypeEnum** ppTypesEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCachedWinRTTypes(ICorDebugGuidToTypeEnum** ppGuidToTypeEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetObjectForCCW(CORDB_ADDRESS ccwPointer, ICorDebugValue** ppManagedObject);
|
||||
};
|
||||
|
||||
class CordbAppDomainEnum : public CordbBaseMono, public ICorDebugAppDomainEnum
|
||||
{
|
||||
DWORD current_pos;
|
||||
CordbProcess* pProcess;
|
||||
|
||||
public:
|
||||
CordbAppDomainEnum(Connection* conn, CordbProcess* ppProcess);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbAppDomainEnum";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE Next(ULONG celt, ICorDebugAppDomain* values[], ULONG* pceltFetched);
|
||||
HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
|
||||
HRESULT STDMETHODCALLTYPE Reset(void);
|
||||
HRESULT STDMETHODCALLTYPE Clone(ICorDebugEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCount(ULONG* pcelt);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,456 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-ASSEMBLY.CPP
|
||||
//
|
||||
|
||||
#include <cordb-appdomain.h>
|
||||
#include <cordb-assembly.h>
|
||||
#include <cordb-class.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb.h>
|
||||
#include "corerror.h"
|
||||
#include "metamodel.h"
|
||||
#include "metamodelpub.h"
|
||||
#include "rwutil.h"
|
||||
#include "stdafx.h"
|
||||
#include "stgio.h"
|
||||
|
||||
#include "importhelper.h"
|
||||
|
||||
#include <metamodelrw.h>
|
||||
#include "mdlog.h"
|
||||
#include "regmeta.h"
|
||||
#include "ex.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbAssembly::CordbAssembly(Connection* conn, CordbProcess* process, CordbAppDomain* appDomain, int id_assembly)
|
||||
: CordbBaseMono(conn)
|
||||
{
|
||||
m_pProcess = process;
|
||||
m_pAppDomain = appDomain;
|
||||
m_pAppDomain->InternalAddRef();
|
||||
m_debuggerId = id_assembly;
|
||||
m_pAssemblyName = NULL;
|
||||
}
|
||||
|
||||
CordbAssembly::~CordbAssembly()
|
||||
{
|
||||
m_pAppDomain->InternalRelease();
|
||||
if (m_pAssemblyName)
|
||||
free(m_pAssemblyName);
|
||||
}
|
||||
|
||||
HRESULT CordbAssembly::IsFullyTrusted(BOOL* pbFullyTrusted)
|
||||
{
|
||||
*pbFullyTrusted = true;
|
||||
LOG((LF_CORDB, LL_INFO100000, "CorDebugAssembly - IsFullyTrusted - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbAssembly::GetAppDomain(ICorDebugAppDomain** ppAppDomain)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CorDebugAssembly - GetAppDomain - IMPLEMENTED\n"));
|
||||
m_pAppDomain->QueryInterface(IID_ICorDebugAppDomain, (void**)ppAppDomain);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbAssembly::EnumerateModules(ICorDebugModuleEnum** ppModules)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CorDebugAssembly - EnumerateModules - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAssembly::GetCodeBase(ULONG32 cchName, ULONG32* pcchName, WCHAR szName[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CorDebugAssembly - GetCodeBase - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbAssembly::GetName(ULONG32 cchName, ULONG32* pcchName, WCHAR szName[])
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
if (!m_pAssemblyName) {
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbAssembly - GetName - IMPLEMENTED\n"));
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerId);
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_ASSEMBLY, MDBGPROT_CMD_ASSEMBLY_GET_LOCATION, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
m_pAssemblyName = m_dbgprot_decode_string_with_len(pReply->p, &pReply->p, pReply->end, &m_nAssemblyNameLen);
|
||||
|
||||
char* c_mobile_symbols_path = getenv("MOBILE_SYMBOLS_PATH");
|
||||
if (strlen(c_mobile_symbols_path) > 0) {
|
||||
|
||||
size_t size_path = strlen(m_pAssemblyName);
|
||||
size_t pos_separator = 0;
|
||||
for (pos_separator = size_path ; pos_separator > 0 ; pos_separator--) {
|
||||
if (m_pAssemblyName[pos_separator] == DIR_SEPARATOR)
|
||||
break;
|
||||
}
|
||||
m_nAssemblyNameLen = (int)(size_path + strlen(c_mobile_symbols_path));
|
||||
char* symbols_full_path = (char*)malloc(m_nAssemblyNameLen);
|
||||
sprintf_s(symbols_full_path, m_nAssemblyNameLen, "%s%s", c_mobile_symbols_path , m_pAssemblyName + pos_separator + 1);
|
||||
|
||||
free(m_pAssemblyName);
|
||||
m_pAssemblyName = symbols_full_path;
|
||||
m_nAssemblyNameLen = (int) strlen(m_pAssemblyName);
|
||||
}
|
||||
}
|
||||
|
||||
if (cchName < (ULONG32) m_nAssemblyNameLen + 1)
|
||||
{
|
||||
*pcchName = m_nAssemblyNameLen + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiByteToWideChar(CP_UTF8, 0, m_pAssemblyName, -1, szName, cchName);
|
||||
*pcchName = m_nAssemblyNameLen + 1;
|
||||
}
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbAssembly::QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* ppInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugAssembly)
|
||||
*ppInterface = static_cast<ICorDebugAssembly*>(this);
|
||||
else if (id == IID_ICorDebugAssembly2)
|
||||
*ppInterface = static_cast<ICorDebugAssembly2*>(this);
|
||||
else if (id == IID_IUnknown)
|
||||
*ppInterface = static_cast<IUnknown*>(static_cast<ICorDebugAssembly*>(this));
|
||||
else
|
||||
{
|
||||
*ppInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbAssembly::GetProcess(ICorDebugProcess** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CorDebugAssembly - GetProcess - IMPLEMENTED\n"));
|
||||
conn->GetProcess()->QueryInterface(IID_ICorDebugProcess, (void**)ppProcess);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CordbModule::CordbModule(Connection* conn, CordbProcess* process, CordbAssembly* assembly, int id_assembly)
|
||||
: CordbBaseMono(conn)
|
||||
{
|
||||
m_pProcess = process;
|
||||
m_pRegMeta = NULL;
|
||||
m_pAssembly = assembly;
|
||||
m_debuggerId = id_assembly;
|
||||
m_pAssembly->InternalAddRef();
|
||||
dwFlags = 0;
|
||||
conn->GetProcess()->AddModule(this);
|
||||
m_pPeImage = NULL;
|
||||
m_pAssemblyName = NULL;
|
||||
}
|
||||
|
||||
CordbModule::~CordbModule()
|
||||
{
|
||||
if (m_pAssembly)
|
||||
m_pAssembly->InternalRelease();
|
||||
/*if (m_pPeImage)
|
||||
free(m_pPeImage);*/
|
||||
if (m_pAssemblyName)
|
||||
free(m_pAssemblyName);
|
||||
}
|
||||
|
||||
HRESULT CordbModule::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugModule)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugModule*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugModule2)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugModule2*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugModule3)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugModule3*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugModule4)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugModule4*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugModule*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::IsMappedLayout(BOOL* pIsMapped)
|
||||
{
|
||||
*pIsMapped = FALSE;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbModule - IsMappedLayout - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::CreateReaderForInMemorySymbols(REFIID riid, void** ppObj)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - CreateReaderForInMemorySymbols - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::SetJMCStatus(BOOL bIsJustMyCode, ULONG32 cOthers, mdToken pTokens[])
|
||||
{
|
||||
if (cOthers != 0)
|
||||
{
|
||||
_ASSERTE(!"not yet impl for cOthers != 0");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - SetJMCStatus - IMPLEMENTED\n"));
|
||||
//on mono JMC is not by module, for now receiving this for one module, will affect all.
|
||||
if (bIsJustMyCode)
|
||||
conn->GetProcess()->SetJMCStatus(bIsJustMyCode);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::ApplyChanges(ULONG cbMetadata, BYTE pbMetadata[], ULONG cbIL, BYTE pbIL[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - ApplyChanges - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::SetJITCompilerFlags(DWORD dwFlags)
|
||||
{
|
||||
this->dwFlags = dwFlags;
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - SetJITCompilerFlags - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetJITCompilerFlags(DWORD* pdwFlags)
|
||||
{
|
||||
*pdwFlags = dwFlags;
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - GetJITCompilerFlags - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::ResolveAssembly(mdToken tkAssemblyRef, ICorDebugAssembly** ppAssembly)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - ResolveAssembly - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetProcess(ICorDebugProcess** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - GetProcess - IMPLEMENTED\n"));
|
||||
conn->GetProcess()->QueryInterface(IID_ICorDebugProcess, (void**)ppProcess);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetBaseAddress(CORDB_ADDRESS* pAddress)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
if (!m_pPeImage) {
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, GetDebuggerId());
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_ASSEMBLY, MDBGPROT_CMD_ASSEMBLY_GET_PEIMAGE_ADDRESS, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
m_pPeImage = m_dbgprot_decode_long(pReply->p, &pReply->p, pReply->end);
|
||||
m_nPeImageSize = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
}
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbModule - GetBaseAddress - IMPLEMENTED\n"));
|
||||
*pAddress = (CORDB_ADDRESS)m_pPeImage;
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetName(ULONG32 cchName, ULONG32* pcchName, WCHAR szName[])
|
||||
{
|
||||
return m_pAssembly->GetName(cchName, pcchName, szName);
|
||||
}
|
||||
|
||||
HRESULT CordbModule::EnableJITDebugging(BOOL bTrackJITInfo, BOOL bAllowJitOpts)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - EnableJITDebugging - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::EnableClassLoadCallbacks(BOOL bClassLoadCallbacks)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - EnableClassLoadCallbacks - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetFunctionFromToken(mdMethodDef methodDef, ICorDebugFunction** ppFunction)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbModule - GetFunctionFromToken - IMPLEMENTED\n"));
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerId);
|
||||
m_dbgprot_buffer_add_int(&localbuf, methodDef);
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_ASSEMBLY, MDBGPROT_CMD_ASSEMBLY_GET_METHOD_FROM_TOKEN, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
if (received_reply_packet->Error() == 0 && received_reply_packet->Error2() == 0)
|
||||
{
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
int id = m_dbgprot_decode_id(pReply->p, &pReply->p, pReply->end);
|
||||
CordbFunction* func = NULL;
|
||||
func = m_pProcess->FindFunction(id);
|
||||
if (func == NULL)
|
||||
{
|
||||
func = new CordbFunction(conn, methodDef, id, this);
|
||||
}
|
||||
func->QueryInterface(IID_ICorDebugFunction, (void**)ppFunction);
|
||||
}
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetFunctionFromRVA(CORDB_ADDRESS rva, ICorDebugFunction** ppFunction)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - GetFunctionFromRVA - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetClassFromToken(mdTypeDef typeDef, ICorDebugClass** ppClass)
|
||||
{
|
||||
CordbClass* pClass = conn->GetProcess()->FindOrAddClass(typeDef, GetDebuggerId());
|
||||
pClass->QueryInterface(IID_ICorDebugClass, (void**)ppClass);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbModule::CreateBreakpoint(ICorDebugModuleBreakpoint** ppBreakpoint)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - CreateBreakpoint - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetEditAndContinueSnapshot(ICorDebugEditAndContinueSnapshot** ppEditAndContinueSnapshot)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - GetEditAndContinueSnapshot - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetMetaDataInterface(REFIID riid, IUnknown** ppObj)
|
||||
{
|
||||
if (m_pRegMeta == NULL)
|
||||
{
|
||||
OptionValue optionForNewScope;
|
||||
memset(&optionForNewScope, 0, sizeof(OptionValue));
|
||||
optionForNewScope.m_ThreadSafetyOptions = MDThreadSafetyOn;
|
||||
|
||||
m_pRegMeta = new RegMeta();
|
||||
m_pRegMeta->SetOption(&optionForNewScope);
|
||||
|
||||
m_pStgdbRW = new CLiteWeightStgdbRW();
|
||||
ULONG32 pcchName = 0;
|
||||
GetName(0, &pcchName, NULL);
|
||||
|
||||
WCHAR* full_path;
|
||||
full_path = (WCHAR*)malloc(sizeof(WCHAR) * pcchName);
|
||||
GetName(pcchName, &pcchName, full_path);
|
||||
|
||||
HRESULT ret = m_pStgdbRW->OpenForRead(full_path, NULL, 0, 0);
|
||||
free(full_path);
|
||||
|
||||
if (ret != S_OK)
|
||||
{
|
||||
delete m_pRegMeta;
|
||||
delete m_pStgdbRW;
|
||||
m_pRegMeta = NULL;
|
||||
m_pStgdbRW = NULL;
|
||||
return CORDBG_E_MISSING_METADATA;
|
||||
}
|
||||
|
||||
m_pRegMeta->InitWithStgdb((ICorDebugModule*)this, m_pStgdbRW);
|
||||
}
|
||||
m_pRegMeta->QueryInterface(riid, (void**)ppObj);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbModule - GetMetaDataInterface - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetToken(mdModule* pToken)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - GetToken - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::IsDynamic(BOOL* pDynamic)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbModule - IsDynamic - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, GetDebuggerId());
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_ASSEMBLY, MDBGPROT_CMD_ASSEMBLY_GET_IS_DYNAMIC, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
int m_bIsDynamic = m_dbgprot_decode_byte(pReply->p, &pReply->p, pReply->end);
|
||||
*pDynamic = m_bIsDynamic;
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetGlobalVariableValue(mdFieldDef fieldDef, ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - GetGlobalVariableValue - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetSize(ULONG32* pcBytes)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbModule - GetSize -IMPLEMENTED\n"));
|
||||
*pcBytes = m_nPeImageSize;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::IsInMemory(BOOL* pInMemory)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbModule - IsInMemory - IMPLEMENTED\n"));
|
||||
*pInMemory = FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbModule::GetAssembly(ICorDebugAssembly** ppAssembly)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbModule - GetAssembly - IMPLEMENTED\n"));
|
||||
m_pAssembly->QueryInterface(IID_ICorDebugAssembly, (void**)ppAssembly);
|
||||
return S_OK;
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-ASSEMBLY.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_ASSEMBLY_H__
|
||||
#define __MONO_DEBUGGER_CORDB_ASSEMBLY_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CLiteWeightStgdbRW;
|
||||
|
||||
class CordbModule : public CordbBaseMono,
|
||||
public ICorDebugModule,
|
||||
public ICorDebugModule2,
|
||||
public ICorDebugModule3,
|
||||
public ICorDebugModule4
|
||||
{
|
||||
int m_debuggerId; // id on mono side;
|
||||
CordbProcess* m_pProcess;
|
||||
RegMeta* m_pRegMeta;
|
||||
CordbAssembly* m_pAssembly;
|
||||
CLiteWeightStgdbRW* m_pStgdbRW;
|
||||
CORDB_ADDRESS m_pPeImage;
|
||||
int32_t m_nPeImageSize;
|
||||
unsigned long dwFlags;
|
||||
char * m_pAssemblyName;
|
||||
int m_nAssemblyNameLen;
|
||||
|
||||
public:
|
||||
CordbModule(Connection* conn, CordbProcess* process, CordbAssembly* assembly, int id_assembly);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbModule";
|
||||
}
|
||||
~CordbModule();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
|
||||
HRESULT STDMETHODCALLTYPE IsMappedLayout(BOOL* pIsMapped);
|
||||
HRESULT STDMETHODCALLTYPE CreateReaderForInMemorySymbols(REFIID riid, void** ppObj);
|
||||
HRESULT STDMETHODCALLTYPE SetJMCStatus(BOOL bIsJustMyCode, ULONG32 cTokens, mdToken pTokens[]);
|
||||
HRESULT STDMETHODCALLTYPE ApplyChanges(ULONG cbMetadata, BYTE pbMetadata[], ULONG cbIL, BYTE pbIL[]);
|
||||
HRESULT STDMETHODCALLTYPE SetJITCompilerFlags(DWORD dwFlags);
|
||||
HRESULT STDMETHODCALLTYPE GetJITCompilerFlags(DWORD* pdwFlags);
|
||||
HRESULT STDMETHODCALLTYPE ResolveAssembly(mdToken tkAssemblyRef, ICorDebugAssembly** ppAssembly);
|
||||
HRESULT STDMETHODCALLTYPE GetProcess(ICorDebugProcess** ppProcess);
|
||||
HRESULT STDMETHODCALLTYPE GetBaseAddress(CORDB_ADDRESS* pAddress);
|
||||
HRESULT STDMETHODCALLTYPE GetAssembly(ICorDebugAssembly** ppAssembly);
|
||||
HRESULT STDMETHODCALLTYPE GetName(ULONG32 cchName, ULONG32* pcchName, WCHAR szName[]);
|
||||
HRESULT STDMETHODCALLTYPE EnableJITDebugging(BOOL bTrackJITInfo, BOOL bAllowJitOpts);
|
||||
HRESULT STDMETHODCALLTYPE EnableClassLoadCallbacks(BOOL bClassLoadCallbacks);
|
||||
HRESULT STDMETHODCALLTYPE GetFunctionFromToken(mdMethodDef methodDef, ICorDebugFunction** ppFunction);
|
||||
HRESULT STDMETHODCALLTYPE GetFunctionFromRVA(CORDB_ADDRESS rva, ICorDebugFunction** ppFunction);
|
||||
HRESULT STDMETHODCALLTYPE GetClassFromToken(mdTypeDef typeDef, ICorDebugClass** ppClass);
|
||||
HRESULT STDMETHODCALLTYPE CreateBreakpoint(ICorDebugModuleBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE GetEditAndContinueSnapshot(ICorDebugEditAndContinueSnapshot** ppEditAndContinueSnapshot);
|
||||
HRESULT STDMETHODCALLTYPE GetMetaDataInterface(REFIID riid, IUnknown** ppObj);
|
||||
HRESULT STDMETHODCALLTYPE GetToken(mdModule* pToken);
|
||||
HRESULT STDMETHODCALLTYPE IsDynamic(BOOL* pDynamic);
|
||||
HRESULT STDMETHODCALLTYPE GetGlobalVariableValue(mdFieldDef fieldDef, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetSize(ULONG32* pcBytes);
|
||||
HRESULT STDMETHODCALLTYPE IsInMemory(BOOL* pInMemory);
|
||||
int GetDebuggerId() const
|
||||
{
|
||||
return m_debuggerId;
|
||||
}
|
||||
};
|
||||
|
||||
class CordbAssembly : public CordbBaseMono, public ICorDebugAssembly, public ICorDebugAssembly2
|
||||
{
|
||||
CordbProcess* m_pProcess;
|
||||
CordbAppDomain* m_pAppDomain;
|
||||
int m_debuggerId;
|
||||
char* m_pAssemblyName;
|
||||
int m_nAssemblyNameLen;
|
||||
|
||||
public:
|
||||
CordbAssembly(Connection* conn, CordbProcess* process, CordbAppDomain* appDomain, int id_assembly);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbAssembly";
|
||||
}
|
||||
~CordbAssembly();
|
||||
HRESULT STDMETHODCALLTYPE IsFullyTrusted(BOOL* pbFullyTrusted);
|
||||
HRESULT STDMETHODCALLTYPE GetProcess(ICorDebugProcess** ppProcess);
|
||||
HRESULT STDMETHODCALLTYPE GetAppDomain(ICorDebugAppDomain** ppAppDomain);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateModules(ICorDebugModuleEnum** ppModules);
|
||||
HRESULT STDMETHODCALLTYPE GetCodeBase(ULONG32 cchName, ULONG32* pcchName, WCHAR szName[]);
|
||||
HRESULT STDMETHODCALLTYPE GetName(ULONG32 cchName, ULONG32* pcchName, WCHAR szName[]);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* ppInterface);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,53 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-BLOCKING-OBJ.CPP
|
||||
//
|
||||
|
||||
#include <cordb-blocking-obj.h>
|
||||
#include <cordb.h>
|
||||
|
||||
CordbBlockingObjectEnum::CordbBlockingObjectEnum(Connection* conn) : CordbBaseMono(conn) {}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbBlockingObjectEnum::Next(ULONG celt,
|
||||
CorDebugBlockingObject values[],
|
||||
ULONG* pceltFetched)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbBlockingObjectEnum - Next - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbBlockingObjectEnum::Skip(ULONG celt)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbBlockingObjectEnum - Skip - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbBlockingObjectEnum::Reset(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbBlockingObjectEnum - Reset - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbBlockingObjectEnum::Clone(ICorDebugEnum** ppEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbBlockingObjectEnum - Clone - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbBlockingObjectEnum::GetCount(ULONG* pcelt)
|
||||
{
|
||||
pcelt = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbBlockingObjectEnum::QueryInterface(REFIID id, void** ppInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugBlockingObjectEnum)
|
||||
*ppInterface = (ICorDebugBlockingObjectEnum*)this;
|
||||
else if (id == IID_IUnknown)
|
||||
*ppInterface = (IUnknown*)(ICorDebugBlockingObjectEnum*)this;
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbBlockingObjectEnum - QueryInterface - IMPLEMENTED\n"));
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-BLOCKING-OBJ.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_BLOCKING_OBJ_H__
|
||||
#define __MONO_DEBUGGER_CORDB_BLOCKING_OBJ_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbBlockingObjectEnum : public CordbBaseMono, public ICorDebugBlockingObjectEnum
|
||||
{
|
||||
public:
|
||||
CordbBlockingObjectEnum(Connection* conn);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbBlockingObjectEnum";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE Next(ULONG celt, CorDebugBlockingObject values[], ULONG* pceltFetched);
|
||||
HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
|
||||
HRESULT STDMETHODCALLTYPE Reset(void);
|
||||
HRESULT STDMETHODCALLTYPE Clone(ICorDebugEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCount(ULONG* pcelt);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,97 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-BREAKPOINT.CPP
|
||||
//
|
||||
|
||||
#include <cordb-breakpoint.h>
|
||||
#include <cordb-code.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbFunctionBreakpoint::CordbFunctionBreakpoint(Connection* conn, CordbCode* code, ULONG32 offset)
|
||||
: CordbBaseMono(conn)
|
||||
{
|
||||
this->m_pCode = code;
|
||||
this->m_offset = offset;
|
||||
conn->GetProcess()->AddBreakpoint(this);
|
||||
m_debuggerId = -1;
|
||||
m_bActive = false;
|
||||
}
|
||||
|
||||
CordbFunctionBreakpoint::~CordbFunctionBreakpoint() {}
|
||||
|
||||
HRESULT CordbFunctionBreakpoint::GetFunction(ICorDebugFunction** ppFunction)
|
||||
{
|
||||
GetCode()->GetFunction()->QueryInterface(IID_ICorDebugFunction, (void**)ppFunction);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFunctionBreakpoint - GetFunction - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunctionBreakpoint::GetOffset(ULONG32* pnOffset)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunctionBreakpoint - GetOffset - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbFunctionBreakpoint::Activate(BOOL bActive)
|
||||
{
|
||||
m_bActive = bActive;
|
||||
if (bActive)
|
||||
{
|
||||
MdbgProtBuffer sendbuf;
|
||||
int buflen = 128;
|
||||
m_dbgprot_buffer_init(&sendbuf, buflen);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_EVENT_KIND_BREAKPOINT);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_SUSPEND_POLICY_ALL);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, 1); // modifiers
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_MOD_KIND_LOCATION_ONLY);
|
||||
m_dbgprot_buffer_add_id(&sendbuf, this->GetCode()->GetFunction()->GetDebuggerId());
|
||||
m_dbgprot_buffer_add_long(&sendbuf, m_offset);
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_EVENT_REQUEST, MDBGPROT_CMD_EVENT_REQUEST_SET, &sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFunctionBreakpoint - Activate - IMPLEMENTED\n"));
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
m_debuggerId = m_dbgprot_decode_id(pReply->p, &pReply->p, pReply->end);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunctionBreakpoint - Activate - FALSE - NOT IMPLEMENTED\n"));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunctionBreakpoint::IsActive(BOOL* pbActive)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunctionBreakpoint - IsActive - IMPLEMENTED\n"));
|
||||
*pbActive = m_bActive;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunctionBreakpoint::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugFunctionBreakpoint)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugFunctionBreakpoint*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugBreakpoint)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugBreakpoint*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
*pInterface = static_cast<ICorDebugFunctionBreakpoint*>(this);
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-BREAKPOINT.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_BREAKPOINT_H__
|
||||
#define __MONO_DEBUGGER_CORDB_BREAKPOINT_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbFunctionBreakpoint : public CordbBaseMono, public ICorDebugFunctionBreakpoint
|
||||
{
|
||||
CordbCode* m_pCode;
|
||||
ULONG32 m_offset;
|
||||
int m_debuggerId;
|
||||
BOOL m_bActive;
|
||||
|
||||
public:
|
||||
CordbFunctionBreakpoint(Connection* conn, CordbCode* code, ULONG32 offset);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
ULONG32 GetOffset() const
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
CordbCode* GetCode() const
|
||||
{
|
||||
return m_pCode;
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbFunctionBreakpoint";
|
||||
}
|
||||
~CordbFunctionBreakpoint();
|
||||
HRESULT STDMETHODCALLTYPE GetFunction(ICorDebugFunction** ppFunction);
|
||||
HRESULT STDMETHODCALLTYPE GetOffset(ULONG32* pnOffset);
|
||||
HRESULT STDMETHODCALLTYPE Activate(BOOL bActive);
|
||||
HRESULT STDMETHODCALLTYPE IsActive(BOOL* pbActive);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
int GetDebuggerId() const
|
||||
{
|
||||
return m_debuggerId;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,154 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-CHAIN.CPP
|
||||
//
|
||||
|
||||
#include <cordb-blocking-obj.h>
|
||||
#include <cordb-chain.h>
|
||||
#include <cordb-frame.h>
|
||||
#include <cordb-thread.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
HRESULT CordbChainEnum::Next(ULONG celt, ICorDebugChain* chains[], ULONG* pceltFetched)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChainEnum - Next - NOT IMPLEMENTED\n"));
|
||||
|
||||
chains[0] = new CordbChain(conn, m_pThread, CHAIN_PROCESS_START, false);
|
||||
chains[1] = new CordbChain(conn, m_pThread, CHAIN_ENTER_MANAGED, true);
|
||||
chains[0]->AddRef();
|
||||
chains[1]->AddRef();
|
||||
*pceltFetched = celt;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CordbChainEnum::CordbChainEnum(Connection* conn, CordbThread* thread) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_pThread = thread;
|
||||
}
|
||||
|
||||
HRESULT CordbChainEnum::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChainEnum - QueryInterface - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbChainEnum::Skip(ULONG celt)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChainEnum - Skip - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChainEnum::Reset(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChainEnum - Reset - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChainEnum::Clone(ICorDebugEnum** ppEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChainEnum - Clone - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChainEnum::GetCount(ULONG* pcelt)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChainEnum - GetCount - NOT IMPLEMENTED\n"));
|
||||
|
||||
*pcelt = 2;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CordbChain::CordbChain(Connection* conn, CordbThread* thread, CorDebugChainReason chain_reason, bool is_managed)
|
||||
: CordbBaseMono(conn)
|
||||
{
|
||||
this->m_pThread = thread;
|
||||
this->m_chainReason = chain_reason;
|
||||
this->m_isManaged = is_managed;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetThread(ICorDebugThread** ppThread)
|
||||
{
|
||||
m_pThread->QueryInterface(IID_ICorDebugThread, (void**)ppThread);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbChain - GetThread - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetStackRange(CORDB_ADDRESS* pStart, CORDB_ADDRESS* pEnd)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - GetStackRange - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetContext(ICorDebugContext** ppContext)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - GetContext - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetCaller(ICorDebugChain** ppChain)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - GetCaller - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetCallee(ICorDebugChain** ppChain)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - GetCallee - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetPrevious(ICorDebugChain** ppChain)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - GetPrevious - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetNext(ICorDebugChain** ppChain)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - GetNext - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::IsManaged(BOOL* pManaged)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbChain - IsManaged - IMPLEMENTED\n"));
|
||||
*pManaged = m_isManaged;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::EnumerateFrames(ICorDebugFrameEnum** ppFrames)
|
||||
{
|
||||
CordbFrameEnum* pFrame = new CordbFrameEnum(conn, m_pThread);
|
||||
pFrame->AddRef();
|
||||
*ppFrames = static_cast<ICorDebugFrameEnum*>(pFrame);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbChain - EnumerateFrames - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetActiveFrame(ICorDebugFrame** ppFrame)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - GetActiveFrame - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetRegisterSet(ICorDebugRegisterSet** ppRegisters)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - GetRegisterSet - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::GetReason(CorDebugChainReason* pReason)
|
||||
{
|
||||
*pReason = m_chainReason;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbChain - GetReason - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbChain::QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbChain - QueryInterface - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-CHAIN.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_CHAIN_H__
|
||||
#define __MONO_DEBUGGER_CORDB_CHAIN_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbChainEnum : public CordbBaseMono, public ICorDebugChainEnum
|
||||
{
|
||||
CordbThread* m_pThread;
|
||||
|
||||
public:
|
||||
CordbChainEnum(Connection* conn, CordbThread* thread);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbChainEnum";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
|
||||
HRESULT STDMETHODCALLTYPE Reset(void);
|
||||
HRESULT STDMETHODCALLTYPE Clone(ICorDebugEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCount(ULONG* pcelt);
|
||||
HRESULT STDMETHODCALLTYPE Next(ULONG celt, ICorDebugChain* chains[], ULONG* pceltFetched);
|
||||
};
|
||||
|
||||
class CordbChain : public CordbBaseMono, public ICorDebugChain
|
||||
{
|
||||
CordbThread* m_pThread;
|
||||
CorDebugChainReason m_chainReason;
|
||||
bool m_isManaged;
|
||||
|
||||
public:
|
||||
CordbChain(Connection* conn, CordbThread* thread, CorDebugChainReason chain_reason, bool is_managed);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbChain";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE GetThread(ICorDebugThread** ppThread);
|
||||
HRESULT STDMETHODCALLTYPE GetStackRange(CORDB_ADDRESS* pStart, CORDB_ADDRESS* pEnd);
|
||||
HRESULT STDMETHODCALLTYPE GetContext(ICorDebugContext** ppContext);
|
||||
HRESULT STDMETHODCALLTYPE GetCaller(ICorDebugChain** ppChain);
|
||||
HRESULT STDMETHODCALLTYPE GetCallee(ICorDebugChain** ppChain);
|
||||
HRESULT STDMETHODCALLTYPE GetPrevious(ICorDebugChain** ppChain);
|
||||
HRESULT STDMETHODCALLTYPE GetNext(ICorDebugChain** ppChain);
|
||||
HRESULT STDMETHODCALLTYPE IsManaged(BOOL* pManaged);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateFrames(ICorDebugFrameEnum** ppFrames);
|
||||
HRESULT STDMETHODCALLTYPE GetActiveFrame(ICorDebugFrame** ppFrame);
|
||||
HRESULT STDMETHODCALLTYPE GetRegisterSet(ICorDebugRegisterSet** ppRegisters);
|
||||
HRESULT STDMETHODCALLTYPE GetReason(CorDebugChainReason* pReason);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,136 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-CLASS.CPP
|
||||
//
|
||||
|
||||
#include <cordb-breakpoint.h>
|
||||
#include <cordb-class.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb-value.h>
|
||||
#include <cordb.h>
|
||||
|
||||
#include "cordb-assembly.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbClass::CordbClass(Connection* conn, mdToken token, int module_id) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_metadataToken = token;
|
||||
this->m_debuggerModuleId = module_id;
|
||||
m_debuggerId = -1;
|
||||
}
|
||||
|
||||
int CordbClass::GetDebuggerId() {
|
||||
if (m_debuggerId != -1)
|
||||
return m_debuggerId;
|
||||
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_int(&localbuf, m_debuggerModuleId);
|
||||
m_dbgprot_buffer_add_int(&localbuf, m_metadataToken);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_ASSEMBLY, MDBGPROT_CMD_ASSEMBLY_GET_TYPE_FROM_TOKEN, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
if (received_reply_packet->Error() > 0 || received_reply_packet->Error2() > 0)
|
||||
return -1;
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
m_debuggerId = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
return m_debuggerId;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbClass::GetModule(ICorDebugModule** pModule)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbClass - GetModule - IMPLEMENTED\n"));
|
||||
if (pModule)
|
||||
{
|
||||
CordbModule* module = conn->GetProcess()->GetModule(m_debuggerModuleId);
|
||||
if (module)
|
||||
{
|
||||
*pModule = static_cast<ICorDebugModule*>(module);
|
||||
(*pModule)->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbClass::GetToken(mdTypeDef* pTypeDef)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbClass - GetToken - IMPLEMENTED\n"));
|
||||
*pTypeDef = m_metadataToken;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbClass::GetStaticFieldValue(mdFieldDef fieldDef,
|
||||
ICorDebugFrame* pFrame,
|
||||
ICorDebugValue** ppValue)
|
||||
{
|
||||
GetDebuggerId();
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbClass - GetStaticFieldValue - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
if (m_debuggerId == -1)
|
||||
hr = S_FALSE;
|
||||
else {
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerId);
|
||||
m_dbgprot_buffer_add_int(&localbuf, fieldDef);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_TYPE, MDBGPROT_CMD_TYPE_GET_VALUES_ICORDBG, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
hr = CordbObjectValue::CreateCordbValue(conn, pReply, ppValue);
|
||||
}
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbClass::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugClass)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugClass*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugClass2)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugClass2*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugClass*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbClass::GetParameterizedType(CorElementType elementType,
|
||||
ULONG32 nTypeArgs,
|
||||
ICorDebugType* ppTypeArgs[],
|
||||
ICorDebugType** ppType)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbClass - GetParameterizedType - IMPLEMENTED\n"));
|
||||
CordbType *ret = conn->GetProcess()->FindOrAddClassType(elementType, this);
|
||||
ret->QueryInterface(IID_ICorDebugType, (void**)ppType);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbClass::SetJMCStatus(BOOL bIsJustMyCode)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbClass - SetJMCStatus - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-CLASS.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_CLASS_H__
|
||||
#define __MONO_DEBUGGER_CORDB_CLASS_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbClass : public CordbBaseMono, public ICorDebugClass, public ICorDebugClass2
|
||||
{
|
||||
mdToken m_metadataToken;
|
||||
int m_debuggerModuleId;
|
||||
int m_debuggerId;
|
||||
public:
|
||||
CordbClass(Connection* conn, mdToken token, int module_id);
|
||||
int GetDebuggerId();
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbClass";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE GetModule(ICorDebugModule** pModule);
|
||||
HRESULT STDMETHODCALLTYPE GetToken(mdTypeDef* pTypeDef);
|
||||
HRESULT STDMETHODCALLTYPE GetStaticFieldValue(mdFieldDef fieldDef, ICorDebugFrame* pFrame, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetParameterizedType(CorElementType elementType,
|
||||
ULONG32 nTypeArgs,
|
||||
ICorDebugType* ppTypeArgs[],
|
||||
ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE SetJMCStatus(BOOL bIsJustMyCode);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,152 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-CODE.CPP
|
||||
//
|
||||
|
||||
#include <cordb-blocking-obj.h>
|
||||
#include <cordb-breakpoint.h>
|
||||
#include <cordb-code.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbCode::CordbCode(Connection* conn, CordbFunction* func) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_pFunction = func;
|
||||
m_nSize = 0;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::IsIL(BOOL* pbIL)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbCode - IsIL - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::GetFunction(ICorDebugFunction** ppFunction)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbCode - GetFunction - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::GetAddress(CORDB_ADDRESS* pStart)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbCode - GetAddress - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
ULONG32 CordbCode::GetSize()
|
||||
{
|
||||
if (m_nSize != 0)
|
||||
return m_nSize;
|
||||
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
|
||||
m_dbgprot_buffer_add_id(&localbuf, this->GetFunction()->GetDebuggerId());
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_METHOD, MDBGPROT_CMD_METHOD_GET_BODY, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
if (received_reply_packet->Error() > 0 || received_reply_packet->Error2() > 0)
|
||||
return 0;
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
m_nSize = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
return m_nSize;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::GetSize(ULONG32* pcBytes)
|
||||
{
|
||||
*pcBytes = GetSize();
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbCode - GetSize - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::CreateBreakpoint(ULONG32 offset, ICorDebugFunctionBreakpoint** ppBreakpoint)
|
||||
{
|
||||
// add it in a list to not recreate a already created breakpoint
|
||||
CordbFunctionBreakpoint* bp = new CordbFunctionBreakpoint(conn, this, offset);
|
||||
bp->QueryInterface(IID_ICorDebugFunctionBreakpoint, (void**)ppBreakpoint);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbCode - CreateBreakpoint - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::GetCode(
|
||||
ULONG32 startOffset, ULONG32 endOffset, ULONG32 cBufferAlloc, BYTE buffer[], ULONG32* pcBufferSize)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbCode - GetCode - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
|
||||
m_dbgprot_buffer_add_id(&localbuf, this->GetFunction()->GetDebuggerId());
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_METHOD, MDBGPROT_CMD_METHOD_GET_BODY, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
ULONG32 totalSize = GetSize();
|
||||
|
||||
if (cBufferAlloc < endOffset - startOffset)
|
||||
endOffset = startOffset + cBufferAlloc;
|
||||
|
||||
if (endOffset > totalSize)
|
||||
endOffset = totalSize;
|
||||
|
||||
if (startOffset > totalSize)
|
||||
startOffset = totalSize;
|
||||
|
||||
uint8_t* m_rgbCode = m_dbgprot_decode_byte_array(pReply->p, &pReply->p, pReply->end, (int32_t*)pcBufferSize);
|
||||
memcpy(buffer,
|
||||
m_rgbCode+startOffset,
|
||||
endOffset - startOffset);
|
||||
free(m_rgbCode);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::GetVersionNumber(ULONG32* nVersion)
|
||||
{
|
||||
*nVersion = 1;
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbCode - GetVersionNumber - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::GetILToNativeMapping(ULONG32 cMap, ULONG32* pcMap, COR_DEBUG_IL_TO_NATIVE_MAP map[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbCode - GetILToNativeMapping - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::GetEnCRemapSequencePoints(ULONG32 cMap, ULONG32* pcMap, ULONG32 offsets[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbCode - GetEnCRemapSequencePoints - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbCode::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugCode)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugCode*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugCode*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-CODE.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_CODE_H__
|
||||
#define __MONO_DEBUGGER_CORDB_CODE_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbCode : public CordbBaseMono, public ICorDebugCode
|
||||
{
|
||||
CordbFunction* m_pFunction;
|
||||
ULONG32 m_nSize;
|
||||
public:
|
||||
CordbCode(Connection* conn, CordbFunction* func);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbCode";
|
||||
}
|
||||
ULONG32 GetSize();
|
||||
HRESULT STDMETHODCALLTYPE IsIL(BOOL* pbIL);
|
||||
HRESULT STDMETHODCALLTYPE GetFunction(ICorDebugFunction** ppFunction);
|
||||
HRESULT STDMETHODCALLTYPE GetAddress(CORDB_ADDRESS* pStart);
|
||||
HRESULT STDMETHODCALLTYPE GetSize(ULONG32* pcBytes);
|
||||
HRESULT STDMETHODCALLTYPE CreateBreakpoint(ULONG32 offset, ICorDebugFunctionBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE GetCode(ULONG32 startOffset, ULONG32 endOffset, ULONG32 cBufferAlloc, BYTE buffer[], ULONG32* pcBufferSize);
|
||||
HRESULT STDMETHODCALLTYPE GetVersionNumber(ULONG32* nVersion);
|
||||
HRESULT STDMETHODCALLTYPE GetILToNativeMapping(ULONG32 cMap,
|
||||
ULONG32* pcMap,
|
||||
|
||||
COR_DEBUG_IL_TO_NATIVE_MAP map[]);
|
||||
HRESULT STDMETHODCALLTYPE GetEnCRemapSequencePoints(ULONG32 cMap, ULONG32* pcMap, ULONG32 offsets[]);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
|
||||
CordbFunction* GetFunction() const
|
||||
{
|
||||
return m_pFunction;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,263 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-EVAL.CPP
|
||||
//
|
||||
|
||||
#include <cordb-appdomain.h>
|
||||
#include <cordb-eval.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb-thread.h>
|
||||
#include <cordb-value.h>
|
||||
#include <cordb.h>
|
||||
|
||||
#include "corerror.h"
|
||||
#include "metamodel.h"
|
||||
#include "metamodelpub.h"
|
||||
#include "rwutil.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
CordbEval::CordbEval(Connection* conn, CordbThread* thread) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_pThread = thread;
|
||||
if (thread)
|
||||
thread->InternalAddRef();
|
||||
m_pValue = NULL;
|
||||
m_commandId = -1;
|
||||
}
|
||||
|
||||
CordbEval::~CordbEval()
|
||||
{
|
||||
if (m_pThread)
|
||||
m_pThread->InternalRelease();
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::CallParameterizedFunction(ICorDebugFunction* pFunction,
|
||||
ULONG32 nTypeArgs,
|
||||
ICorDebugType* ppTypeArgs[],
|
||||
ULONG32 nArgs,
|
||||
ICorDebugValue* ppArgs[])
|
||||
{
|
||||
conn->GetProcess()->Stop(false);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbEval - CallParameterizedFunction - IMPLEMENTED\n"));
|
||||
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_pThread->GetThreadId());
|
||||
m_dbgprot_buffer_add_int(&localbuf, 1);
|
||||
m_dbgprot_buffer_add_int(&localbuf, ((CordbFunction*)pFunction)->GetDebuggerId());
|
||||
m_dbgprot_buffer_add_int(&localbuf, nArgs);
|
||||
for (ULONG32 i = 0; i < nArgs; i++)
|
||||
{
|
||||
CorElementType ty;
|
||||
ppArgs[i]->GetType(&ty);
|
||||
CordbContent* cc;
|
||||
cc = ((CordbValue*)ppArgs[i])->GetValue();
|
||||
m_dbgprot_buffer_add_byte(&localbuf, ty);
|
||||
switch (ty)
|
||||
{
|
||||
case ELEMENT_TYPE_BOOLEAN:
|
||||
case ELEMENT_TYPE_I1:
|
||||
case ELEMENT_TYPE_U1:
|
||||
m_dbgprot_buffer_add_int(&localbuf, cc->booleanValue);
|
||||
break;
|
||||
case ELEMENT_TYPE_CHAR:
|
||||
case ELEMENT_TYPE_I2:
|
||||
case ELEMENT_TYPE_U2:
|
||||
m_dbgprot_buffer_add_int(&localbuf, cc->charValue);
|
||||
break;
|
||||
case ELEMENT_TYPE_I4:
|
||||
case ELEMENT_TYPE_U4:
|
||||
case ELEMENT_TYPE_R4:
|
||||
m_dbgprot_buffer_add_int(&localbuf, cc->intValue);
|
||||
break;
|
||||
case ELEMENT_TYPE_I8:
|
||||
case ELEMENT_TYPE_U8:
|
||||
case ELEMENT_TYPE_R8:
|
||||
m_dbgprot_buffer_add_long(&localbuf, cc->longValue);
|
||||
break;
|
||||
case ELEMENT_TYPE_CLASS:
|
||||
case ELEMENT_TYPE_SZARRAY:
|
||||
case ELEMENT_TYPE_STRING:
|
||||
m_dbgprot_buffer_add_id(&localbuf, cc->intValue);
|
||||
break;
|
||||
default:
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
}
|
||||
m_commandId = conn->SendEvent(MDBGPROT_CMD_SET_VM, MDBGPROT_CMD_VM_INVOKE_METHOD, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
conn->GetProcess()->AddPendingEval(this);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CordbEval::EvalComplete(MdbgProtBuffer* pReply)
|
||||
{
|
||||
m_dbgprot_decode_byte(pReply->p, &pReply->p, pReply->end);
|
||||
CordbObjectValue::CreateCordbValue(conn, pReply, &m_pValue);
|
||||
|
||||
conn->GetCordb()->GetCallback()->EvalComplete(conn->GetProcess()->GetCurrentAppDomain(), m_pThread, this);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::CreateValueForType(ICorDebugType* pType, ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - CreateValueForType - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::NewParameterizedObject(ICorDebugFunction* pConstructor,
|
||||
ULONG32 nTypeArgs,
|
||||
ICorDebugType* ppTypeArgs[],
|
||||
ULONG32 nArgs,
|
||||
ICorDebugValue* ppArgs[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - NewParameterizedObject - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::NewParameterizedObjectNoConstructor(ICorDebugClass* pClass,
|
||||
ULONG32 nTypeArgs,
|
||||
ICorDebugType* ppTypeArgs[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - NewParameterizedObjectNoConstructor - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::NewParameterizedArray(ICorDebugType* pElementType,
|
||||
ULONG32 rank,
|
||||
ULONG32 dims[],
|
||||
ULONG32 lowBounds[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - NewParameterizedArray - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::NewStringWithLength(LPCWSTR string, UINT uiLength)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
conn->GetProcess()->Stop(false);
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_pThread->GetThreadId());
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_THREAD, MDBGPROT_CMD_THREAD_GET_APPDOMAIN, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
int domainId = m_dbgprot_decode_id(pReply->p, &pReply->p, pReply->end);
|
||||
|
||||
LPSTR szString;
|
||||
UTF8STR(string, szString);
|
||||
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, domainId);
|
||||
m_dbgprot_buffer_add_string(&localbuf, szString);
|
||||
this->m_commandId = conn->SendEvent(MDBGPROT_CMD_SET_APPDOMAIN, MDBGPROT_CMD_APPDOMAIN_CREATE_STRING, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
conn->GetProcess()->AddPendingEval(this);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::RudeAbort(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - RudeAbort - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbEval::QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugEval)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugEval*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugEval2)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugEval2*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugEval*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::CallFunction(ICorDebugFunction* pFunction, ULONG32 nArgs, ICorDebugValue* ppArgs[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - CallFunction - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::NewObject(ICorDebugFunction* pConstructor, ULONG32 nArgs, ICorDebugValue* ppArgs[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - NewObject - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::NewObjectNoConstructor(ICorDebugClass* pClass)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - NewObjectNoConstructor - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::NewString(LPCWSTR string)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - NewString - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::NewArray(
|
||||
CorElementType elementType, ICorDebugClass* pElementClass, ULONG32 rank, ULONG32 dims[], ULONG32 lowBounds[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - NewArray - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::IsActive(BOOL* pbActive)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - IsActive - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::Abort(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - Abort - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::GetResult(ICorDebugValue** ppResult)
|
||||
{
|
||||
*ppResult = m_pValue;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbEval - GetResult - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::GetThread(ICorDebugThread** ppThread)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbEval - GetThread - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbEval::CreateValue(CorElementType elementType,
|
||||
ICorDebugClass* pElementClass,
|
||||
ICorDebugValue** ppValue)
|
||||
{
|
||||
CordbContent content_value;
|
||||
content_value.booleanValue = 0;
|
||||
CordbValue* value = new CordbValue(conn, elementType, content_value, CordbObjectValue::GetTypeSize(elementType));
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbEval - CreateValue - IMPLEMENTED\n"));
|
||||
value->QueryInterface(IID_ICorDebugValue, (void**)ppValue);
|
||||
return S_OK;
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-EVAL.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_EVAL_H__
|
||||
#define __MONO_DEBUGGER_CORDB_EVAL_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbEval : public CordbBaseMono, public ICorDebugEval, public ICorDebugEval2
|
||||
{
|
||||
CordbThread* m_pThread;
|
||||
ICorDebugValue* m_pValue;
|
||||
int m_commandId;
|
||||
|
||||
public:
|
||||
CordbEval(Connection* conn, CordbThread* thread);
|
||||
~CordbEval();
|
||||
void EvalComplete(MdbgProtBuffer* pReply);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CallParameterizedFunction(ICorDebugFunction* pFunction,
|
||||
ULONG32 nTypeArgs,
|
||||
ICorDebugType* ppTypeArgs[],
|
||||
ULONG32 nArgs,
|
||||
ICorDebugValue* ppArgs[]);
|
||||
HRESULT STDMETHODCALLTYPE NewParameterizedObject(ICorDebugFunction* pConstructor,
|
||||
ULONG32 nTypeArgs,
|
||||
ICorDebugType* ppTypeArgs[],
|
||||
ULONG32 nArgs,
|
||||
ICorDebugValue* ppArgs[]);
|
||||
HRESULT STDMETHODCALLTYPE NewParameterizedObjectNoConstructor(ICorDebugClass* pClass, ULONG32 nTypeArgs, ICorDebugType* ppTypeArgs[]);
|
||||
HRESULT STDMETHODCALLTYPE CallFunction(ICorDebugFunction* pFunction, ULONG32 nArgs, ICorDebugValue* ppArgs[]);
|
||||
HRESULT STDMETHODCALLTYPE NewObject(ICorDebugFunction* pConstructor, ULONG32 nArgs, ICorDebugValue* ppArgs[]);
|
||||
HRESULT STDMETHODCALLTYPE NewObjectNoConstructor(ICorDebugClass* pClass);
|
||||
HRESULT STDMETHODCALLTYPE NewString(LPCWSTR string);
|
||||
HRESULT STDMETHODCALLTYPE NewArray(
|
||||
CorElementType elementType, ICorDebugClass* pElementClass, ULONG32 rank, ULONG32 dims[], ULONG32 lowBounds[]);
|
||||
HRESULT STDMETHODCALLTYPE IsActive(BOOL* pbActive);
|
||||
HRESULT STDMETHODCALLTYPE Abort(void);
|
||||
HRESULT STDMETHODCALLTYPE GetResult(ICorDebugValue** ppResult);
|
||||
HRESULT STDMETHODCALLTYPE GetThread(ICorDebugThread** ppThread);
|
||||
HRESULT STDMETHODCALLTYPE CreateValue(CorElementType elementType, ICorDebugClass* pElementClass, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE CreateValueForType(ICorDebugType* pType, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE NewParameterizedArray(ICorDebugType* pElementType, ULONG32 rank, ULONG32 dims[], ULONG32 lowBounds[]);
|
||||
HRESULT STDMETHODCALLTYPE NewStringWithLength(LPCWSTR string, UINT uiLength);
|
||||
HRESULT STDMETHODCALLTYPE RudeAbort(void);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* ppvObject);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbEval";
|
||||
}
|
||||
int GetCommandId() const
|
||||
{
|
||||
return m_commandId;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,563 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-FRAME.CPP
|
||||
//
|
||||
|
||||
#include <cordb-code.h>
|
||||
#include <cordb-frame.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb-register.h>
|
||||
#include <cordb-thread.h>
|
||||
#include <cordb-value.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbFrameEnum::CordbFrameEnum(Connection* conn, CordbThread* thread) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_pThread = thread;
|
||||
m_nFrames = 0;
|
||||
m_ppFrames = NULL;
|
||||
}
|
||||
|
||||
CordbFrameEnum::~CordbFrameEnum()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbFrameEnum::Next(ULONG celt, ICorDebugFrame* frames[], ULONG* pceltFetched)
|
||||
{
|
||||
GetCount();
|
||||
for (int i = 0; i < m_nFrames; i++)
|
||||
{
|
||||
this->m_ppFrames[i]->QueryInterface(IID_ICorDebugFrame, (void**)&frames[i]);
|
||||
}
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFrameEnum - Next - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbFrameEnum::Skip(ULONG celt)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrameEnum - Skip - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbFrameEnum::Reset(void)
|
||||
{
|
||||
for (int i = 0; i < m_nFrames; i++)
|
||||
{
|
||||
this->m_ppFrames[i]->InternalRelease();
|
||||
}
|
||||
m_nFrames = 0;
|
||||
if (m_ppFrames)
|
||||
free(m_ppFrames);
|
||||
m_ppFrames = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbFrameEnum::Clone(ICorDebugEnum** ppEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrameEnum - Clone - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbFrameEnum::GetCount() {
|
||||
HRESULT hr = S_OK;
|
||||
if (m_nFrames != 0)
|
||||
return hr;
|
||||
EX_TRY
|
||||
{
|
||||
Reset();
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_pThread->GetThreadId());
|
||||
m_dbgprot_buffer_add_int(&localbuf, 0);
|
||||
m_dbgprot_buffer_add_int(&localbuf, -1);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_THREAD, MDBGPROT_CMD_THREAD_GET_FRAME_INFO, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
m_nFrames = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
m_ppFrames = (CordbNativeFrame**)malloc(sizeof(CordbNativeFrame*) * m_nFrames);
|
||||
|
||||
for (int i = 0; i < m_nFrames; i++)
|
||||
{
|
||||
int frameid = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
int methodId = m_dbgprot_decode_id(pReply->p, &pReply->p, pReply->end);
|
||||
int il_offset = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
int flags = m_dbgprot_decode_byte(pReply->p, &pReply->p, pReply->end);
|
||||
|
||||
CordbNativeFrame* frame = new CordbNativeFrame(conn, frameid, methodId, il_offset, flags, m_pThread, i);
|
||||
frame->InternalAddRef();
|
||||
m_ppFrames[i] = frame;
|
||||
}
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbFrameEnum::GetCount(ULONG* pcelt)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFrameEnum - GetCount - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
hr = GetCount();
|
||||
*pcelt = m_nFrames;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbFrameEnum::QueryInterface(REFIID riid, void** ppvObject)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrameEnum - QueryInterface - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
CordbJITILFrame::CordbJITILFrame(
|
||||
Connection* conn, int frameid, int methodId, int il_offset, int flags, CordbThread* thread)
|
||||
: CordbBaseMono(conn)
|
||||
{
|
||||
this->m_debuggerFrameId = frameid;
|
||||
this->m_debuggerMethodId = methodId;
|
||||
this->m_ilOffset = il_offset;
|
||||
this->m_flags = flags;
|
||||
this->m_pThread = thread;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetChain(ICorDebugChain** ppChain)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetChain - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetCode(ICorDebugCode** ppCode)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetCode - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetFunction(ICorDebugFunction** ppFunction)
|
||||
{
|
||||
CordbFunction* func = conn->GetProcess()->FindFunction(m_debuggerMethodId);
|
||||
if (!func)
|
||||
{
|
||||
func = new CordbFunction(conn, 0, m_debuggerMethodId, NULL);
|
||||
}
|
||||
func->QueryInterface(IID_ICorDebugFunction, (void**)ppFunction);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFrame - GetFunction - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetFunctionToken(mdMethodDef* pToken)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetFunctionToken - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerMethodId);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_METHOD, MDBGPROT_CMD_METHOD_GET_INFO, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
int flags = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
int iflags = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
*pToken = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetStackRange(CORDB_ADDRESS* pStart, CORDB_ADDRESS* pEnd)
|
||||
{
|
||||
*pStart = 0; //forced value, only to make vs work, I'm not sure which value should returned from mono runtime
|
||||
*pEnd = 1; //forced value, only to make vs work, I'm not sure which value should returned from mono runtime
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetStackRange - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetCaller(ICorDebugFrame** ppFrame)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetCaller - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetCallee(ICorDebugFrame** ppFrame)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetCallee - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::CreateStepper(ICorDebugStepper** ppStepper)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbJITILFrame - CreateStepper - IMPLEMENTED\n"));
|
||||
return m_pThread->CreateStepper(ppStepper);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugILFrame)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugILFrame*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugILFrame2)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugILFrame2*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugILFrame3)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugILFrame3*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugILFrame4)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugILFrame4*>(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::RemapFunction(ULONG32 newILOffset)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - RemapFunction - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::EnumerateTypeParameters(ICorDebugTypeEnum** ppTyParEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - EnumerateTypeParameters - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetReturnValueForILOffset(ULONG32 ILoffset, ICorDebugValue** ppReturnValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetReturnValueForILOffset - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::EnumerateLocalVariablesEx(ILCodeKind flags, ICorDebugValueEnum** ppValueEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - EnumerateLocalVariablesEx - IMPLEMENTED\n"));
|
||||
CordbValueEnum* pCordbValueEnum = new CordbValueEnum(conn, m_pThread->GetThreadId(), m_debuggerFrameId, false, flags);
|
||||
return pCordbValueEnum->QueryInterface(IID_ICorDebugValueEnum, (void**)ppValueEnum);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetLocalVariableEx(ILCodeKind flags, DWORD dwIndex, ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetLocalVariableEx - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetCodeEx(ILCodeKind flags, ICorDebugCode** ppCode)
|
||||
{
|
||||
if (flags == ILCODE_REJIT_IL)
|
||||
*ppCode = NULL;
|
||||
else
|
||||
{
|
||||
ICorDebugFunction* ppFunction;
|
||||
GetFunction(&ppFunction);
|
||||
ppFunction->GetILCode(ppCode);
|
||||
ppFunction->Release();
|
||||
}
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbJITILFrame - GetCodeEx - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetIP(ULONG32* pnOffset, CorDebugMappingResult* pMappingResult)
|
||||
{
|
||||
*pnOffset = m_ilOffset;
|
||||
*pMappingResult = MAPPING_EXACT;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFrame - GetIP - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::SetIP(ULONG32 nOffset)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - SetIP - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::EnumerateLocalVariables(ICorDebugValueEnum** ppValueEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - EnumerateLocalVariables - IMPLEMENTED\n"));
|
||||
CordbValueEnum *pCordbValueEnum = new CordbValueEnum(conn, m_pThread->GetThreadId(), false, m_debuggerFrameId);
|
||||
return pCordbValueEnum->QueryInterface(IID_ICorDebugValueEnum, (void**)ppValueEnum);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetLocalVariable(DWORD dwIndex, ICorDebugValue** ppValue)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_pThread->GetThreadId());
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerFrameId);
|
||||
m_dbgprot_buffer_add_int(&localbuf, 1);
|
||||
m_dbgprot_buffer_add_int(&localbuf, dwIndex);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_STACK_FRAME, MDBGPROT_CMD_STACK_FRAME_GET_VALUES, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
hr = CordbObjectValue::CreateCordbValue(conn, pReply, ppValue);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::EnumerateArguments(ICorDebugValueEnum** ppValueEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - EnumerateArguments - IMPLEMENTED\n"));
|
||||
CordbValueEnum* pCordbValueEnum = new CordbValueEnum(conn, m_pThread->GetThreadId(), m_debuggerFrameId, true);
|
||||
return pCordbValueEnum->QueryInterface(IID_ICorDebugValueEnum, (void**)ppValueEnum);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetArgument(DWORD dwIndex, ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFrame - GetArgument - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_pThread->GetThreadId());
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerFrameId);
|
||||
|
||||
m_dbgprot_buffer_add_int(&localbuf, dwIndex);
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_STACK_FRAME, MDBGPROT_CMD_STACK_FRAME_GET_ARGUMENT, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
hr = CordbObjectValue::CreateCordbValue(conn, pReply, ppValue);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetStackDepth(ULONG32* pDepth)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetStackDepth - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::GetStackValue(DWORD dwIndex, ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - GetStackValue - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbJITILFrame::CanSetIP(ULONG32 nOffset)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFrame - CanSetIP - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
CordbNativeFrame::~CordbNativeFrame()
|
||||
{
|
||||
m_JITILFrame->InternalRelease();
|
||||
}
|
||||
|
||||
CordbNativeFrame::CordbNativeFrame(
|
||||
Connection* conn, int frameid, int methodId, int il_offset, int flags, CordbThread* thread, int posFrame)
|
||||
: CordbBaseMono(conn)
|
||||
{
|
||||
m_JITILFrame = new CordbJITILFrame(conn, frameid, methodId, il_offset, flags, thread);
|
||||
m_JITILFrame->InternalAddRef();
|
||||
this->m_pThread = thread;
|
||||
this->m_nPosFrame = posFrame;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetIP(ULONG32* pnOffset)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetIP - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::SetIP(ULONG32 nOffset)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - SetIP - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetRegisterSet(ICorDebugRegisterSet** ppRegisters)
|
||||
{
|
||||
return m_pThread->GetRegisterSet(ppRegisters);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetLocalRegisterValue(CorDebugRegister reg,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetLocalRegisterValue - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetLocalDoubleRegisterValue(CorDebugRegister highWordReg,
|
||||
CorDebugRegister lowWordReg,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetLocalDoubleRegisterValue - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetLocalMemoryValue(CORDB_ADDRESS address,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetLocalMemoryValue - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetLocalRegisterMemoryValue(CorDebugRegister highWordReg,
|
||||
CORDB_ADDRESS lowWordAddress,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetLocalRegisterMemoryValue - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetLocalMemoryRegisterValue(CORDB_ADDRESS highWordAddress,
|
||||
CorDebugRegister lowWordRegister,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetLocalMemoryRegisterValue - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::CanSetIP(ULONG32 nOffset)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - CanSetIP - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetChain(ICorDebugChain** ppChain)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetChain - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetCode(ICorDebugCode** ppCode)
|
||||
{
|
||||
ICorDebugFunction* ppFunction;
|
||||
m_JITILFrame->GetFunction(&ppFunction);
|
||||
ppFunction->GetILCode(ppCode);
|
||||
ppFunction->Release();
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbJITILFrame - GetCodeEx - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetFunction(ICorDebugFunction** ppFunction)
|
||||
{
|
||||
return m_JITILFrame->GetFunction(ppFunction);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetFunctionToken(mdMethodDef* pToken)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetFunctionToken - IMPLEMENTED\n"));
|
||||
return m_JITILFrame->GetFunctionToken(pToken);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetStackRange(CORDB_ADDRESS* pStart, CORDB_ADDRESS* pEnd)
|
||||
{
|
||||
return m_JITILFrame->GetStackRange(pStart, pEnd);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetCaller(ICorDebugFrame** ppFrame)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetCaller - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetCallee(ICorDebugFrame** ppFrame)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetCallee - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::CreateStepper(ICorDebugStepper** ppStepper)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - CreateStepper - IMPLEMENTED\n"));
|
||||
return m_pThread->CreateStepper(ppStepper);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugFrame)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugFrame*>(static_cast<ICorDebugNativeFrame*>(this));
|
||||
}
|
||||
else if (id == IID_ICorDebugNativeFrame)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugNativeFrame*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugNativeFrame2)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugNativeFrame2*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugNativeFrame*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
// might be searching for an IL Frame. delegate that search to the
|
||||
// JITILFrame
|
||||
if (m_JITILFrame != NULL)
|
||||
{
|
||||
return m_JITILFrame->QueryInterface(id, pInterface);
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::IsChild(BOOL* pIsChild)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - IsChild - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::IsMatchingParentFrame(ICorDebugNativeFrame2* pPotentialParentFrame,
|
||||
BOOL* pIsParent)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - IsMatchingParentFrame - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbNativeFrame::GetStackParameterSize(ULONG32* pSize)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbNativeFrame - GetStackParameterSize - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-FRAME.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_FRAME_H__
|
||||
#define __MONO_DEBUGGER_CORDB_FRAME_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbJITILFrame : public CordbBaseMono,
|
||||
public ICorDebugILFrame,
|
||||
public ICorDebugILFrame2,
|
||||
public ICorDebugILFrame3,
|
||||
public ICorDebugILFrame4
|
||||
{
|
||||
int m_debuggerFrameId;
|
||||
int m_debuggerMethodId;
|
||||
int m_ilOffset;
|
||||
int m_flags;
|
||||
CordbThread* m_pThread;
|
||||
|
||||
public:
|
||||
CordbJITILFrame(Connection* conn, int frameid, int methodId, int il_offset, int flags, CordbThread* thread);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbJITILFrame";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE GetChain(ICorDebugChain** ppChain);
|
||||
HRESULT STDMETHODCALLTYPE GetCode(ICorDebugCode** ppCode);
|
||||
HRESULT STDMETHODCALLTYPE GetFunction(ICorDebugFunction** ppFunction);
|
||||
HRESULT STDMETHODCALLTYPE GetFunctionToken(mdMethodDef* pToken);
|
||||
HRESULT STDMETHODCALLTYPE GetStackRange(CORDB_ADDRESS* pStart, CORDB_ADDRESS* pEnd);
|
||||
HRESULT STDMETHODCALLTYPE GetCaller(ICorDebugFrame** ppFrame);
|
||||
HRESULT STDMETHODCALLTYPE GetCallee(ICorDebugFrame** ppFrame);
|
||||
HRESULT STDMETHODCALLTYPE CreateStepper(ICorDebugStepper** ppStepper);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetIP(ULONG32* pnOffset, CorDebugMappingResult* pMappingResult);
|
||||
HRESULT STDMETHODCALLTYPE SetIP(ULONG32 nOffset);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateLocalVariables(ICorDebugValueEnum** ppValueEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetLocalVariable(DWORD dwIndex, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateArguments(ICorDebugValueEnum** ppValueEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetArgument(DWORD dwIndex, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetStackDepth(ULONG32* pDepth);
|
||||
HRESULT STDMETHODCALLTYPE GetStackValue(DWORD dwIndex, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE CanSetIP(ULONG32 nOffset);
|
||||
HRESULT STDMETHODCALLTYPE RemapFunction(ULONG32 newILOffset);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateTypeParameters(ICorDebugTypeEnum** ppTyParEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetReturnValueForILOffset(ULONG32 ILoffset, ICorDebugValue** ppReturnValue);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateLocalVariablesEx(ILCodeKind flags, ICorDebugValueEnum** ppValueEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetLocalVariableEx(ILCodeKind flags, DWORD dwIndex, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetCodeEx(ILCodeKind flags, ICorDebugCode** ppCode);
|
||||
};
|
||||
|
||||
class CordbNativeFrame : public CordbBaseMono, public ICorDebugNativeFrame, public ICorDebugNativeFrame2
|
||||
{
|
||||
CordbJITILFrame* m_JITILFrame;
|
||||
CordbThread* m_pThread;
|
||||
int m_nPosFrame;
|
||||
|
||||
public:
|
||||
CordbNativeFrame(Connection* conn, int frameid, int methodId, int il_offset, int flags, CordbThread* thread, int posFrame);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbNativeFrame";
|
||||
}
|
||||
~CordbNativeFrame();
|
||||
HRESULT STDMETHODCALLTYPE GetIP(ULONG32* pnOffset);
|
||||
HRESULT STDMETHODCALLTYPE SetIP(ULONG32 nOffset);
|
||||
HRESULT STDMETHODCALLTYPE GetRegisterSet(ICorDebugRegisterSet** ppRegisters);
|
||||
HRESULT STDMETHODCALLTYPE GetLocalRegisterValue(CorDebugRegister reg,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetLocalDoubleRegisterValue(CorDebugRegister highWordReg,
|
||||
CorDebugRegister lowWordReg,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetLocalMemoryValue(CORDB_ADDRESS address,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetLocalRegisterMemoryValue(CorDebugRegister highWordReg,
|
||||
CORDB_ADDRESS lowWordAddress,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetLocalMemoryRegisterValue(CORDB_ADDRESS highWordAddress,
|
||||
CorDebugRegister lowWordRegister,
|
||||
ULONG cbSigBlob,
|
||||
PCCOR_SIGNATURE pvSigBlob,
|
||||
ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE CanSetIP(ULONG32 nOffset);
|
||||
HRESULT STDMETHODCALLTYPE GetChain(ICorDebugChain** ppChain);
|
||||
HRESULT STDMETHODCALLTYPE GetCode(ICorDebugCode** ppCode);
|
||||
HRESULT STDMETHODCALLTYPE GetFunction(ICorDebugFunction** ppFunction);
|
||||
HRESULT STDMETHODCALLTYPE GetFunctionToken(mdMethodDef* pToken);
|
||||
HRESULT STDMETHODCALLTYPE GetStackRange(CORDB_ADDRESS* pStart, CORDB_ADDRESS* pEnd);
|
||||
HRESULT STDMETHODCALLTYPE GetCaller(ICorDebugFrame** ppFrame);
|
||||
HRESULT STDMETHODCALLTYPE GetCallee(ICorDebugFrame** ppFrame);
|
||||
HRESULT STDMETHODCALLTYPE CreateStepper(ICorDebugStepper** ppStepper);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE IsChild(BOOL* pIsChild);
|
||||
HRESULT STDMETHODCALLTYPE IsMatchingParentFrame(ICorDebugNativeFrame2* pPotentialParentFrame, BOOL* pIsParent);
|
||||
HRESULT STDMETHODCALLTYPE GetStackParameterSize(ULONG32* pSize);
|
||||
};
|
||||
|
||||
class CordbFrameEnum : public CordbBaseMono, public ICorDebugFrameEnum
|
||||
{
|
||||
CordbThread* m_pThread;
|
||||
int m_nFrames;
|
||||
CordbNativeFrame** m_ppFrames;
|
||||
|
||||
public:
|
||||
CordbFrameEnum(Connection* conn, CordbThread* thread);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbFrameEnum";
|
||||
}
|
||||
~CordbFrameEnum();
|
||||
HRESULT STDMETHODCALLTYPE Next(ULONG celt, ICorDebugFrame* frames[], ULONG* pceltFetched);
|
||||
HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
|
||||
HRESULT STDMETHODCALLTYPE Reset(void);
|
||||
HRESULT STDMETHODCALLTYPE Clone(ICorDebugEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCount(ULONG* pcelt);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
|
||||
HRESULT GetCount();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,237 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-FUNCTION.CPP
|
||||
//
|
||||
|
||||
#include <cordb-assembly.h>
|
||||
#include <cordb-code.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb-breakpoint.h>
|
||||
#include <cordb-class.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbFunction::CordbFunction(Connection* conn, mdToken token, int id, CordbModule* module) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_metadataToken = token;
|
||||
this->m_debuggerId = id;
|
||||
m_pCode = NULL;
|
||||
this->m_pModule = module;
|
||||
if (module)
|
||||
module->InternalAddRef();
|
||||
conn->GetProcess()->AddFunction(this);
|
||||
}
|
||||
|
||||
CordbFunction::~CordbFunction()
|
||||
{
|
||||
if (m_pCode)
|
||||
m_pCode->InternalRelease();
|
||||
if (m_pModule)
|
||||
m_pModule->InternalRelease();
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugFunction)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugFunction*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugFunction2)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugFunction2*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugFunction3)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugFunction3*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugFunction4)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugFunction4*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugFunction*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetModule(ICorDebugModule** ppModule)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - GetModule - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
if (!m_pModule)
|
||||
{
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerId);
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_METHOD, MDBGPROT_CMD_METHOD_ASSEMBLY, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
int module_id = m_dbgprot_decode_id(pReply->p, &pReply->p, pReply->end);
|
||||
m_pModule = conn->GetProcess()->GetModule(module_id);
|
||||
if (m_pModule)
|
||||
m_pModule->InternalAddRef();
|
||||
}
|
||||
|
||||
if (!m_pModule)
|
||||
hr = S_FALSE;
|
||||
else {
|
||||
m_pModule->AddRef();
|
||||
*ppModule = static_cast<ICorDebugModule*>(m_pModule);
|
||||
}
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetClass(ICorDebugClass** ppClass)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerId);
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_METHOD, MDBGPROT_CMD_METHOD_GET_CLASS_TOKEN, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
int m_type = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
CordbClass* m_pClass = conn->GetProcess()->FindOrAddClass(m_type, m_pModule->GetDebuggerId());
|
||||
hr = m_pClass->QueryInterface(IID_ICorDebugClass, (void**)ppClass);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - GetClass - IMPLEMENTED\n"));
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetToken(mdMethodDef* pMethodDef)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - GetToken - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
if (this->GetMetadataToken() == 0)
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_debuggerId);
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_METHOD, MDBGPROT_CMD_METHOD_TOKEN, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
this->m_metadataToken = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
}
|
||||
*pMethodDef = this->GetMetadataToken();
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetILCode(ICorDebugCode** ppCode)
|
||||
{
|
||||
if (m_pCode == NULL)
|
||||
{
|
||||
m_pCode = new CordbCode(conn, this);
|
||||
m_pCode->InternalAddRef();
|
||||
}
|
||||
m_pCode->QueryInterface(IID_ICorDebugCode, (void**)ppCode);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFunction - GetILCode - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetNativeCode(ICorDebugCode** ppCode)
|
||||
{
|
||||
if (m_pCode == NULL)
|
||||
{
|
||||
m_pCode = new CordbCode(conn, this);
|
||||
m_pCode->InternalAddRef();
|
||||
}
|
||||
m_pCode->QueryInterface(IID_ICorDebugCode, (void**)ppCode);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFunction - GetNativeCode - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::CreateBreakpoint(ICorDebugFunctionBreakpoint** ppBreakpoint)
|
||||
{
|
||||
if (m_pCode == NULL)
|
||||
{
|
||||
m_pCode = new CordbCode(conn, this);
|
||||
m_pCode->InternalAddRef();
|
||||
}
|
||||
CordbFunctionBreakpoint* bp = new CordbFunctionBreakpoint(conn, m_pCode, 0);
|
||||
bp->QueryInterface(IID_ICorDebugFunctionBreakpoint, (void**)ppBreakpoint);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFunction - CreateBreakpoint - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetLocalVarSigToken(mdSignature* pmdSig)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - GetLocalVarSigToken - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetCurrentVersionNumber(ULONG32* pnCurrentVersion)
|
||||
{
|
||||
*pnCurrentVersion = 1;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFunction - GetCurrentVersionNumber - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::SetJMCStatus(BOOL bIsJustMyCode)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - SetJMCStatus - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetJMCStatus(BOOL* pbIsJustMyCode)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - GetJMCStatus - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::EnumerateNativeCode(ICorDebugCodeEnum** ppCodeEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - EnumerateNativeCode - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetVersionNumber(ULONG32* pnVersion)
|
||||
{
|
||||
*pnVersion = 1;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbFunction - GetVersionNumber - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::GetActiveReJitRequestILCode(ICorDebugILCode** ppReJitedILCode)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - GetActiveReJitRequestILCode - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CordbFunction::CreateNativeBreakpoint(ICorDebugFunctionBreakpoint** ppBreakpoint)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbFunction - CreateNativeBreakpoint - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-FUNCTION.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_FUNCTION_H__
|
||||
#define __MONO_DEBUGGER_CORDB_FUNCTION_H__
|
||||
|
||||
#include <cordb-assembly.h>
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbFunction : public CordbBaseMono,
|
||||
public ICorDebugFunction,
|
||||
public ICorDebugFunction2,
|
||||
public ICorDebugFunction3,
|
||||
public ICorDebugFunction4
|
||||
{
|
||||
int m_debuggerId;
|
||||
mdToken m_metadataToken;
|
||||
CordbCode* m_pCode;
|
||||
CordbModule* m_pModule;
|
||||
|
||||
public:
|
||||
CordbFunction(Connection* conn, mdToken token, int id, CordbModule* module);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbFunction";
|
||||
}
|
||||
~CordbFunction();
|
||||
int GetDebuggerId() const
|
||||
{
|
||||
return m_debuggerId;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetModule(ICorDebugModule** ppModule);
|
||||
HRESULT STDMETHODCALLTYPE GetClass(ICorDebugClass** ppClass);
|
||||
HRESULT STDMETHODCALLTYPE GetToken(mdMethodDef* pMethodDef);
|
||||
HRESULT STDMETHODCALLTYPE GetILCode(ICorDebugCode** ppCode);
|
||||
HRESULT STDMETHODCALLTYPE GetNativeCode(ICorDebugCode** ppCode);
|
||||
HRESULT STDMETHODCALLTYPE CreateBreakpoint(ICorDebugFunctionBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE GetLocalVarSigToken(mdSignature* pmdSig);
|
||||
HRESULT STDMETHODCALLTYPE GetCurrentVersionNumber(ULONG32* pnCurrentVersion);
|
||||
HRESULT STDMETHODCALLTYPE SetJMCStatus(BOOL bIsJustMyCode);
|
||||
HRESULT STDMETHODCALLTYPE GetJMCStatus(BOOL* pbIsJustMyCode);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateNativeCode(ICorDebugCodeEnum** ppCodeEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetVersionNumber(ULONG32* pnVersion);
|
||||
HRESULT STDMETHODCALLTYPE GetActiveReJitRequestILCode(ICorDebugILCode** ppReJitedILCode);
|
||||
HRESULT STDMETHODCALLTYPE CreateNativeBreakpoint(ICorDebugFunctionBreakpoint** ppBreakpoint);
|
||||
mdToken GetMetadataToken() const
|
||||
{
|
||||
return m_metadataToken;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,810 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-PROCESS.CPP
|
||||
//
|
||||
|
||||
#include <cordb-appdomain.h>
|
||||
#include <cordb-assembly.h>
|
||||
#include <cordb-breakpoint.h>
|
||||
#include <cordb-class.h>
|
||||
#include <cordb-code.h>
|
||||
#include <cordb-eval.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb-thread.h>
|
||||
#include <cordb-stepper.h>
|
||||
#include <cordb-type.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbProcess::CordbProcess(Cordb* cordb) : CordbBaseMono(NULL)
|
||||
{
|
||||
m_pAppDomainEnum = NULL;
|
||||
m_pBreakpoints = new ArrayList();
|
||||
m_pThreads = new ArrayList();
|
||||
m_pFunctions = new ArrayList();
|
||||
m_pModules = new ArrayList();
|
||||
m_pAddDomains = new ArrayList();
|
||||
m_pPendingEval = new ArrayList();
|
||||
m_pSteppers = new ArrayList();
|
||||
this->m_pCordb = cordb;
|
||||
m_bIsJustMyCode = false;
|
||||
m_pSemReadWrite = new UTSemReadWrite();
|
||||
m_pTypeMapArray = new ArrayList();
|
||||
for (DWORD i = 0; i < CordbTypeKindTotal; i++)
|
||||
{
|
||||
m_pTypeMapArray->Append(new MapSHashWithRemove<long, CordbType*>());
|
||||
}
|
||||
}
|
||||
|
||||
CordbProcess::~CordbProcess()
|
||||
{
|
||||
delete m_pSemReadWrite;
|
||||
if (m_pAppDomainEnum)
|
||||
m_pAppDomainEnum->InternalRelease();
|
||||
|
||||
for (DWORD i = 0; i < m_pBreakpoints->GetCount(); i++)
|
||||
{
|
||||
CordbFunctionBreakpoint* breakpoint = (CordbFunctionBreakpoint*)m_pBreakpoints->Get(i);
|
||||
if (breakpoint)
|
||||
breakpoint->InternalRelease();
|
||||
}
|
||||
|
||||
for (DWORD i = 0; i < m_pSteppers->GetCount(); i++)
|
||||
{
|
||||
CordbStepper* stepper = (CordbStepper*)m_pSteppers->Get(i);
|
||||
if (stepper)
|
||||
stepper->InternalRelease();
|
||||
}
|
||||
|
||||
for (DWORD i = 0; i < m_pThreads->GetCount(); i++)
|
||||
{
|
||||
CordbThread* thread = (CordbThread*)m_pThreads->Get(i);
|
||||
thread->InternalRelease();
|
||||
}
|
||||
|
||||
for (DWORD i = 0; i < m_pFunctions->GetCount(); i++)
|
||||
{
|
||||
CordbFunction* function = (CordbFunction*)m_pFunctions->Get(i);
|
||||
function->InternalRelease();
|
||||
}
|
||||
|
||||
for (DWORD i = 0; i < m_pAddDomains->GetCount(); i++)
|
||||
{
|
||||
CordbAppDomain* appdomain = (CordbAppDomain*)m_pAddDomains->Get(i);
|
||||
appdomain->InternalRelease();
|
||||
}
|
||||
|
||||
for (DWORD i = 0; i < m_pModules->GetCount(); i++)
|
||||
{
|
||||
CordbModule* module = (CordbModule*)m_pModules->Get(i);
|
||||
module->InternalRelease();
|
||||
}
|
||||
|
||||
for (DWORD i = 0; i < m_pPendingEval->GetCount(); i++)
|
||||
{
|
||||
CordbEval* eval = (CordbEval*)m_pPendingEval->Get(i);
|
||||
if (eval)
|
||||
eval->InternalRelease();
|
||||
}
|
||||
|
||||
for (MapSHashWithRemove<mdToken, CordbClass*>::Iterator iter = m_classMap.Begin(), end = m_classMap.End(); iter != end; iter++)
|
||||
{
|
||||
iter->Value()->InternalRelease();
|
||||
}
|
||||
|
||||
|
||||
for (DWORD i = 0; i < m_pTypeMapArray->GetCount(); i++)
|
||||
{
|
||||
MapSHashWithRemove<long, CordbType*>* typeMap = (MapSHashWithRemove<long, CordbType*>*)m_pTypeMapArray->Get(i);
|
||||
for (MapSHashWithRemove<long, CordbType*>::Iterator iter = typeMap->Begin(), end = typeMap->End(); iter != end; iter++)
|
||||
{
|
||||
if (iter->Value())
|
||||
iter->Value()->InternalRelease();
|
||||
}
|
||||
}
|
||||
|
||||
delete m_pBreakpoints;
|
||||
delete m_pThreads;
|
||||
delete m_pFunctions;
|
||||
delete m_pModules;
|
||||
delete m_pAddDomains;
|
||||
delete m_pPendingEval;
|
||||
delete m_pTypeMapArray;
|
||||
delete conn;
|
||||
}
|
||||
|
||||
void CordbProcess::CheckPendingEval()
|
||||
{
|
||||
if (!m_pPendingEval)
|
||||
return;
|
||||
for (DWORD i = 0; i < m_pPendingEval->GetCount(); i++)
|
||||
{
|
||||
CordbEval* eval = (CordbEval*)m_pPendingEval->Get(i);
|
||||
if (!eval)
|
||||
continue;
|
||||
ReceivedReplyPacket* recvbuf = conn->GetReplyWithError(eval->GetCommandId());
|
||||
if (!recvbuf)
|
||||
continue;
|
||||
eval->EvalComplete(recvbuf->Buffer());
|
||||
eval->InternalRelease();
|
||||
dbg_lock();
|
||||
m_pPendingEval->Set(i, NULL);
|
||||
dbg_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnumerateLoaderHeapMemoryRegions(ICorDebugMemoryRangeEnum** ppRanges)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnumerateLoaderHeapMemoryRegions - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnableGCNotificationEvents(BOOL fEnable)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnableGCNotificationEvents - NOT IMPLEMENTED\n"));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnableExceptionCallbacksOutsideOfMyCode(BOOL enableExceptionsOutsideOfJMC)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000,
|
||||
"CordbProcess - EnableExceptionCallbacksOutsideOfMyCode - "
|
||||
"NOT IMPLEMENTED\n"));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::SetWriteableMetadataUpdateMode(WriteableMetadataUpdateMode flags)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - SetWriteableMetadataUpdateMode - NOT IMPLEMENTED\n"));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetGCHeapInformation(COR_HEAPINFO* pHeapInfo)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetGCHeapInformation - NOT IMPLEMENTED\n"));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnumerateHeap(ICorDebugHeapEnum** ppObjects)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnumerateHeap - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbProcess::EnumerateHeapRegions(ICorDebugHeapSegmentEnum** ppRegions)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnumerateHeapRegions - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetObject(CORDB_ADDRESS addr, ICorDebugObjectValue** pObject)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetObject - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnumerateGCReferences(BOOL enumerateWeakReferences, ICorDebugGCReferenceEnum** ppEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnumerateGCReferences - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnumerateHandles(CorGCReferenceType types, ICorDebugGCReferenceEnum** ppEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnumerateHandles - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetTypeID(CORDB_ADDRESS obj, COR_TYPEID* pId)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetTypeID - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetTypeForTypeID(COR_TYPEID id, ICorDebugType** ppType)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetTypeForTypeID - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT* pLayout)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetArrayLayout - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT* pLayout)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetTypeLayout - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetTypeFields(COR_TYPEID id, ULONG32 celt, COR_FIELD fields[], ULONG32* pceltNeeded)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetTypeFields - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnableNGENPolicy(CorDebugNGENPolicy ePolicy)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnableNGENPolicy - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbProcess::Filter(const BYTE pRecord[],
|
||||
DWORD countBytes,
|
||||
CorDebugRecordFormat format,
|
||||
DWORD dwFlags,
|
||||
DWORD dwThreadId,
|
||||
ICorDebugManagedCallback* pCallback,
|
||||
/* [out][in] */ CORDB_CONTINUE_STATUS* pContinueStatus)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - Filter - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::ProcessStateChanged(CorDebugStateChange eChange)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - ProcessStateChanged - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::SetEnableCustomNotification(ICorDebugClass* pClass, BOOL fEnable)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - SetEnableCustomNotification - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetID(DWORD* pdwProcessId)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetID - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetHandle(HPROCESS* phProcessHandle)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetHandle - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetThread(DWORD dwThreadId, ICorDebugThread** ppThread)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetThread - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnumerateObjects(ICorDebugObjectEnum** ppObjects)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnumerateObjects - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::IsTransitionStub(CORDB_ADDRESS address, BOOL* pbTransitionStub)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - IsTransitionStub - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::IsOSSuspended(DWORD threadID, BOOL* pbSuspended)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - IsOSSuspended - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetThreadContext(DWORD threadID, ULONG32 contextSize, BYTE context[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetThreadContext - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::SetThreadContext(DWORD threadID, ULONG32 contextSize, BYTE context[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - SetThreadContext - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::ReadMemory(CORDB_ADDRESS address, DWORD size, BYTE buffer[], SIZE_T* read)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbProcess - ReadMemory - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_long(&localbuf, address);
|
||||
m_dbgprot_buffer_add_int(&localbuf, size);
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_VM, MDBGPROT_CMD_VM_READ_MEMORY, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
int memoryReadSize = 0;
|
||||
uint8_t* memoryRead = m_dbgprot_decode_byte_array(pReply->p, &pReply->p, pReply->end, (int32_t*)&memoryReadSize);
|
||||
memcpy(buffer, (void*)memoryRead, memoryReadSize);
|
||||
if (read != NULL)
|
||||
*read = memoryReadSize;
|
||||
free(memoryRead);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::WriteMemory(CORDB_ADDRESS address, DWORD size, BYTE buffer[], SIZE_T* written)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - WriteMemory - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::ClearCurrentException(DWORD threadID)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - ClearCurrentException - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnableLogMessages(BOOL fOnOff)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - EnableLogMessages - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::ModifyLogSwitch(
|
||||
/* [annotation][in] */
|
||||
_In_ WCHAR* pLogSwitchName,
|
||||
LONG lLevel)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - ModifyLogSwitch - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbProcess::EnumerateAppDomains(ICorDebugAppDomainEnum** ppAppDomains)
|
||||
{
|
||||
if (!m_pAppDomainEnum)
|
||||
{
|
||||
m_pAppDomainEnum = new CordbAppDomainEnum(conn, this);
|
||||
m_pAppDomainEnum->InternalAddRef();
|
||||
}
|
||||
m_pAppDomainEnum->QueryInterface(IID_ICorDebugAppDomainEnum, (void**)ppAppDomains);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbProcess - EnumerateAppDomains - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetObject(ICorDebugValue** ppObject)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetObject - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::ThreadForFiberCookie(DWORD fiberCookie, ICorDebugThread** ppThread)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - ThreadForFiberCookie - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetHelperThreadID(DWORD* pThreadID)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "GetHelperThreadID - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetThreadForTaskID(TASKID taskid, ICorDebugThread2** ppThread)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetHelperThreadID - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetVersion(COR_VERSION* version)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetVersion - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::SetUnmanagedBreakpoint(CORDB_ADDRESS address, ULONG32 bufsize, BYTE buffer[], ULONG32* bufLen)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - SetUnmanagedBreakpoint - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::ClearUnmanagedBreakpoint(CORDB_ADDRESS address)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - ClearUnmanagedBreakpoint - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::SetDesiredNGENCompilerFlags(DWORD pdwFlags)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - SetDesiredNGENCompilerFlags - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetDesiredNGENCompilerFlags(DWORD* pdwFlags)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetDesiredNGENCompilerFlags - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::GetReferenceValueFromGCHandle(UINT_PTR handle, ICorDebugReferenceValue** pOutValue)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - GetReferenceValueFromGCHandle - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugProcess)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugController)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugController*>(static_cast<ICorDebugProcess*>(this));
|
||||
}
|
||||
else if (id == IID_ICorDebugProcess2)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess2*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugProcess3)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess3*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugProcess4)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess4*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugProcess5)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess5*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugProcess7)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess7*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugProcess8)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess8*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugProcess10)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess10*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugProcess11)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugProcess11*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugProcess*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::Stop(DWORD dwTimeoutIgnored)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbProcess - Stop - IMPLEMENTED\n"));
|
||||
MdbgProtBuffer sendbuf;
|
||||
m_dbgprot_buffer_init(&sendbuf, 128);
|
||||
conn->SendEvent(MDBGPROT_CMD_SET_VM, MDBGPROT_CMD_VM_SUSPEND, &sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::Continue(BOOL fIsOutOfBand)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbProcess - Continue - IMPLEMENTED\n"));
|
||||
MdbgProtBuffer sendbuf;
|
||||
m_dbgprot_buffer_init(&sendbuf, 128);
|
||||
conn->SendEvent(MDBGPROT_CMD_SET_VM, MDBGPROT_CMD_VM_RESUME, &sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::IsRunning(BOOL* pbRunning)
|
||||
{
|
||||
*pbRunning = true;
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - IsRunning - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::HasQueuedCallbacks(ICorDebugThread* pThread, BOOL* pbQueued)
|
||||
{
|
||||
// conn->process_packet_from_queue();
|
||||
*pbQueued = false;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbProcess - HasQueuedCallbacks - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::EnumerateThreads(ICorDebugThreadEnum** ppThreads)
|
||||
{
|
||||
*ppThreads = new CordbThreadEnum(conn);
|
||||
(*ppThreads)->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbProcess::SetAllThreadsDebugState(CorDebugThreadState state, ICorDebugThread* pExceptThisThread)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - SetAllThreadsDebugState - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::Detach(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - Detach - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbProcess::Terminate(UINT exitCode)
|
||||
{
|
||||
MdbgProtBuffer sendbuf;
|
||||
m_dbgprot_buffer_init(&sendbuf, 128);
|
||||
m_dbgprot_buffer_add_int(&sendbuf, -1);
|
||||
conn->SendEvent(MDBGPROT_CMD_SET_VM, MDBGPROT_CMD_VM_EXIT, &sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbProcess::CanCommitChanges(ULONG cSnapshots,
|
||||
ICorDebugEditAndContinueSnapshot* pSnapshots[],
|
||||
ICorDebugErrorInfoEnum** pError)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - CanCommitChanges - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CordbProcess::CommitChanges(ULONG cSnapshots,
|
||||
ICorDebugEditAndContinueSnapshot* pSnapshots[],
|
||||
ICorDebugErrorInfoEnum** pError)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbProcess - CommitChanges - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CordbProcess::AddThread(CordbThread* thread)
|
||||
{
|
||||
dbg_lock();
|
||||
m_pThreads->Append(thread);
|
||||
thread->InternalAddRef();
|
||||
dbg_unlock();
|
||||
}
|
||||
|
||||
void CordbProcess::AddFunction(CordbFunction* function)
|
||||
{
|
||||
dbg_lock();
|
||||
m_pFunctions->Append(function);
|
||||
function->InternalAddRef();
|
||||
dbg_unlock();
|
||||
}
|
||||
|
||||
void CordbProcess::AddModule(CordbModule* module)
|
||||
{
|
||||
dbg_lock();
|
||||
m_pModules->Append(module);
|
||||
module->InternalAddRef();
|
||||
dbg_unlock();
|
||||
}
|
||||
|
||||
void CordbProcess::AddAppDomain(CordbAppDomain* appDomain)
|
||||
{
|
||||
dbg_lock();
|
||||
m_pAddDomains->Append(appDomain);
|
||||
appDomain->InternalAddRef();
|
||||
dbg_unlock();
|
||||
}
|
||||
|
||||
void CordbProcess::AddPendingEval(CordbEval* eval)
|
||||
{
|
||||
dbg_lock();
|
||||
m_pPendingEval->Append(eval);
|
||||
eval->InternalAddRef();
|
||||
dbg_unlock();
|
||||
}
|
||||
|
||||
void CordbProcess::AddBreakpoint(CordbFunctionBreakpoint* bp)
|
||||
{
|
||||
dbg_lock();
|
||||
m_pBreakpoints->Append(bp);
|
||||
bp->InternalAddRef();
|
||||
dbg_unlock();
|
||||
}
|
||||
|
||||
void CordbProcess::AddStepper(CordbStepper* step)
|
||||
{
|
||||
dbg_lock();
|
||||
m_pSteppers->Append(step);
|
||||
step->InternalAddRef();
|
||||
dbg_unlock();
|
||||
}
|
||||
|
||||
CordbClass* CordbProcess::FindOrAddClass(mdToken token, int module_id)
|
||||
{
|
||||
CordbClass *ret = NULL;
|
||||
dbg_lock();
|
||||
if (!m_classMap.Lookup(token, &ret)) {
|
||||
ret = new CordbClass(conn, token, module_id);
|
||||
m_classMap.Add(token, ret);
|
||||
ret->InternalAddRef();
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbType* CordbProcess::FindOrAddPrimitiveType(CorElementType type)
|
||||
{
|
||||
CordbType* ret = NULL;
|
||||
MapSHashWithRemove<long, CordbType*>* typeMap = (MapSHashWithRemove<long, CordbType*>*) m_pTypeMapArray->Get(CordbTypeKindSimpleType);
|
||||
dbg_lock();
|
||||
if (!typeMap->Lookup(type, &ret)) {
|
||||
ret = new CordbType(type, conn);
|
||||
typeMap->Add(type, ret);
|
||||
ret->InternalAddRef();
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbType* CordbProcess::FindOrAddClassType(CorElementType type, CordbClass *klass)
|
||||
{
|
||||
CordbType* ret = NULL;
|
||||
mdToken token;
|
||||
if (klass == NULL)
|
||||
return FindOrAddPrimitiveType(type);
|
||||
MapSHashWithRemove<long, CordbType*>* typeMap = (MapSHashWithRemove<long, CordbType*>*) m_pTypeMapArray->Get(CordbTypeKindClassType);
|
||||
dbg_lock();
|
||||
klass->GetToken(&token);
|
||||
if (!typeMap->Lookup(token, &ret)) {
|
||||
ret = new CordbType(type, conn, klass);
|
||||
typeMap->Add(token, ret);
|
||||
ret->InternalAddRef();
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbType* CordbProcess::FindOrAddArrayType(CorElementType type, CordbType* arrayType)
|
||||
{
|
||||
CordbType* ret = NULL;
|
||||
long hash = 0;
|
||||
MapSHashWithRemove<long, CordbType*>* typeMap = (MapSHashWithRemove<long, CordbType*>*) m_pTypeMapArray->Get(CordbTypeKindArrayType);
|
||||
dbg_lock();
|
||||
CorElementType eleType;
|
||||
ICorDebugClass *eleClass = 0;
|
||||
mdTypeDef eleToken = 0;
|
||||
arrayType->GetType(&eleType);
|
||||
if (eleType == ELEMENT_TYPE_CLASS)
|
||||
{
|
||||
arrayType->GetClass(&eleClass);
|
||||
eleClass->GetToken(&eleToken);
|
||||
}
|
||||
hash = (long)(pow(2, eleToken & 0xffffff) * pow(3, type) * pow(5, eleType)); //TODO: define a better hash
|
||||
if (!typeMap->Lookup(hash, &ret)) {
|
||||
ret = new CordbType(type, conn, NULL, arrayType);
|
||||
typeMap->Add(hash, ret);
|
||||
ret->InternalAddRef();
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbFunction* CordbProcess::FindFunction(int id)
|
||||
{
|
||||
CordbFunction* ret = NULL;
|
||||
dbg_lock();
|
||||
for (DWORD i = 0; i < m_pFunctions->GetCount(); i++)
|
||||
{
|
||||
CordbFunction* function = (CordbFunction*)m_pFunctions->Get(i);
|
||||
if (function->GetDebuggerId() == id)
|
||||
{
|
||||
ret = function;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbStepper* CordbProcess::GetStepper(int id)
|
||||
{
|
||||
CordbStepper *ret = NULL;
|
||||
dbg_lock();
|
||||
for (DWORD i = 0; i < m_pSteppers->GetCount(); i++)
|
||||
{
|
||||
CordbStepper* stepper = (CordbStepper*)m_pSteppers->Get(i);
|
||||
if (stepper->GetDebuggerId() == id)
|
||||
{
|
||||
ret = stepper;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbModule* CordbProcess::GetModule(int module_id)
|
||||
{
|
||||
CordbModule* ret = NULL;
|
||||
dbg_lock();
|
||||
for (DWORD i = 0; i < m_pModules->GetCount(); i++)
|
||||
{
|
||||
CordbModule* module = (CordbModule*)m_pModules->Get(i);
|
||||
if (module->GetDebuggerId() == module_id)
|
||||
{
|
||||
ret = module;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbAppDomain* CordbProcess::GetCurrentAppDomain()
|
||||
{
|
||||
CordbAppDomain* ret = NULL;
|
||||
dbg_lock();
|
||||
if (m_pAddDomains->GetCount() > 0)
|
||||
ret = (CordbAppDomain*)m_pAddDomains->Get(0);
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbThread* CordbProcess::FindThread(long thread_id)
|
||||
{
|
||||
CordbThread* ret = NULL;
|
||||
dbg_lock();
|
||||
for (DWORD i = 0; i < m_pThreads->GetCount(); i++)
|
||||
{
|
||||
CordbThread* thread = (CordbThread*)m_pThreads->Get(i);
|
||||
if (thread->GetThreadId() == thread_id)
|
||||
{
|
||||
ret = thread;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CordbFunctionBreakpoint* CordbProcess::GetBreakpoint(int id)
|
||||
{
|
||||
CordbFunctionBreakpoint* ret = NULL;
|
||||
dbg_lock();
|
||||
for (DWORD i = 0; i < m_pBreakpoints->GetCount(); i++)
|
||||
{
|
||||
CordbFunctionBreakpoint* bp = (CordbFunctionBreakpoint*)m_pBreakpoints->Get(i);
|
||||
if (bp->GetDebuggerId() == id)
|
||||
{
|
||||
ret = bp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dbg_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CordbProcess::SetJMCStatus(BOOL bIsJustMyCode)
|
||||
{
|
||||
m_bIsJustMyCode = bIsJustMyCode;
|
||||
}
|
||||
|
||||
BOOL CordbProcess::GetJMCStatus()
|
||||
{
|
||||
return m_bIsJustMyCode;
|
||||
}
|
||||
|
|
@ -1,143 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-PROCESS.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_PROCESS_H__
|
||||
#define __MONO_DEBUGGER_CORDB_PROCESS_H__
|
||||
|
||||
#include <arraylist.h>
|
||||
#include <shash.h>
|
||||
#include <cordb.h>
|
||||
|
||||
|
||||
|
||||
class CordbProcess : public CordbBaseMono,
|
||||
public ICorDebugProcess,
|
||||
public ICorDebugProcess2,
|
||||
public ICorDebugProcess3,
|
||||
public ICorDebugProcess4,
|
||||
public ICorDebugProcess5,
|
||||
public ICorDebugProcess7,
|
||||
public ICorDebugProcess8,
|
||||
public ICorDebugProcess10,
|
||||
public ICorDebugProcess11
|
||||
{
|
||||
ArrayList* m_pBreakpoints;
|
||||
ArrayList* m_pThreads;
|
||||
ArrayList* m_pFunctions;
|
||||
ArrayList* m_pModules;
|
||||
ArrayList* m_pPendingEval;
|
||||
ArrayList* m_pSteppers;
|
||||
CordbAppDomainEnum* m_pAppDomainEnum;
|
||||
Cordb* m_pCordb;
|
||||
BOOL m_bIsJustMyCode;
|
||||
ArrayList* m_pTypeMapArray; //TODO: define a better data structure to find CordbType
|
||||
MapSHashWithRemove<mdToken, CordbClass*> m_classMap;
|
||||
public:
|
||||
ArrayList* m_pAddDomains;
|
||||
CordbProcess(Cordb* cordb);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbProcess";
|
||||
}
|
||||
Cordb* GetCordb() const
|
||||
{
|
||||
return m_pCordb;
|
||||
}
|
||||
~CordbProcess();
|
||||
HRESULT STDMETHODCALLTYPE EnumerateLoaderHeapMemoryRegions(ICorDebugMemoryRangeEnum** ppRanges);
|
||||
HRESULT STDMETHODCALLTYPE EnableGCNotificationEvents(BOOL fEnable);
|
||||
HRESULT STDMETHODCALLTYPE EnableExceptionCallbacksOutsideOfMyCode(BOOL enableExceptionsOutsideOfJMC);
|
||||
HRESULT STDMETHODCALLTYPE SetWriteableMetadataUpdateMode(WriteableMetadataUpdateMode flags);
|
||||
HRESULT STDMETHODCALLTYPE GetGCHeapInformation(COR_HEAPINFO* pHeapInfo);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateHeap(ICorDebugHeapEnum** ppObjects);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateHeapRegions(ICorDebugHeapSegmentEnum** ppRegions);
|
||||
HRESULT STDMETHODCALLTYPE GetObject(CORDB_ADDRESS addr, ICorDebugObjectValue** pObject);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateGCReferences(BOOL enumerateWeakReferences, ICorDebugGCReferenceEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateHandles(CorGCReferenceType types, ICorDebugGCReferenceEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetTypeID(CORDB_ADDRESS obj, COR_TYPEID* pId);
|
||||
HRESULT STDMETHODCALLTYPE GetTypeForTypeID(COR_TYPEID id, ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetArrayLayout(COR_TYPEID id, COR_ARRAY_LAYOUT* pLayout);
|
||||
HRESULT STDMETHODCALLTYPE GetTypeLayout(COR_TYPEID id, COR_TYPE_LAYOUT* pLayout);
|
||||
HRESULT STDMETHODCALLTYPE GetTypeFields(COR_TYPEID id, ULONG32 celt, COR_FIELD fields[], ULONG32* pceltNeeded);
|
||||
HRESULT STDMETHODCALLTYPE EnableNGENPolicy(CorDebugNGENPolicy ePolicy);
|
||||
HRESULT STDMETHODCALLTYPE Filter(const BYTE pRecord[],
|
||||
DWORD countBytes,
|
||||
CorDebugRecordFormat format,
|
||||
DWORD dwFlags,
|
||||
DWORD dwThreadId,
|
||||
ICorDebugManagedCallback* pCallback,
|
||||
CORDB_CONTINUE_STATUS* pContinueStatus);
|
||||
HRESULT STDMETHODCALLTYPE ProcessStateChanged(CorDebugStateChange eChange);
|
||||
HRESULT STDMETHODCALLTYPE SetEnableCustomNotification(ICorDebugClass* pClass, BOOL fEnable);
|
||||
HRESULT STDMETHODCALLTYPE GetID(DWORD* pdwProcessId);
|
||||
HRESULT STDMETHODCALLTYPE GetHandle(HPROCESS* phProcessHandle);
|
||||
HRESULT STDMETHODCALLTYPE GetThread(DWORD dwThreadId, ICorDebugThread** ppThread);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateObjects(ICorDebugObjectEnum** ppObjects);
|
||||
HRESULT STDMETHODCALLTYPE IsTransitionStub(CORDB_ADDRESS address, BOOL* pbTransitionStub);
|
||||
HRESULT STDMETHODCALLTYPE IsOSSuspended(DWORD threadID, BOOL* pbSuspended);
|
||||
HRESULT STDMETHODCALLTYPE GetThreadContext(DWORD threadID, ULONG32 contextSize, BYTE context[]);
|
||||
HRESULT STDMETHODCALLTYPE SetThreadContext(DWORD threadID, ULONG32 contextSize, BYTE context[]);
|
||||
HRESULT STDMETHODCALLTYPE ReadMemory(CORDB_ADDRESS address, DWORD size, BYTE buffer[], SIZE_T* read);
|
||||
HRESULT STDMETHODCALLTYPE WriteMemory(CORDB_ADDRESS address, DWORD size, BYTE buffer[], SIZE_T* written);
|
||||
HRESULT STDMETHODCALLTYPE ClearCurrentException(DWORD threadID);
|
||||
HRESULT STDMETHODCALLTYPE EnableLogMessages(BOOL fOnOff);
|
||||
HRESULT STDMETHODCALLTYPE ModifyLogSwitch(_In_ WCHAR* pLogSwitchName, LONG lLevel);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateAppDomains(ICorDebugAppDomainEnum** ppAppDomains);
|
||||
HRESULT STDMETHODCALLTYPE GetObject(ICorDebugValue** ppObject);
|
||||
HRESULT STDMETHODCALLTYPE ThreadForFiberCookie(DWORD fiberCookie, ICorDebugThread** ppThread);
|
||||
HRESULT STDMETHODCALLTYPE GetHelperThreadID(DWORD* pThreadID);
|
||||
HRESULT STDMETHODCALLTYPE GetThreadForTaskID(TASKID taskid, ICorDebugThread2** ppThread);
|
||||
HRESULT STDMETHODCALLTYPE GetVersion(COR_VERSION* version);
|
||||
HRESULT STDMETHODCALLTYPE SetUnmanagedBreakpoint(CORDB_ADDRESS address, ULONG32 bufsize, BYTE buffer[], ULONG32* bufLen);
|
||||
HRESULT STDMETHODCALLTYPE ClearUnmanagedBreakpoint(CORDB_ADDRESS address);
|
||||
HRESULT STDMETHODCALLTYPE SetDesiredNGENCompilerFlags(DWORD pdwFlags);
|
||||
HRESULT STDMETHODCALLTYPE GetDesiredNGENCompilerFlags(DWORD* pdwFlags);
|
||||
HRESULT STDMETHODCALLTYPE GetReferenceValueFromGCHandle(UINT_PTR handle, ICorDebugReferenceValue** pOutValue);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Stop(DWORD dwTimeoutIgnored);
|
||||
HRESULT STDMETHODCALLTYPE Continue(BOOL fIsOutOfBand);
|
||||
HRESULT STDMETHODCALLTYPE IsRunning(BOOL* pbRunning);
|
||||
HRESULT STDMETHODCALLTYPE HasQueuedCallbacks(ICorDebugThread* pThread, BOOL* pbQueued);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateThreads(ICorDebugThreadEnum** ppThreads);
|
||||
HRESULT STDMETHODCALLTYPE SetAllThreadsDebugState(CorDebugThreadState state, ICorDebugThread* pExceptThisThread);
|
||||
HRESULT STDMETHODCALLTYPE Detach(void);
|
||||
HRESULT STDMETHODCALLTYPE Terminate(UINT exitCode);
|
||||
HRESULT STDMETHODCALLTYPE CanCommitChanges(ULONG cSnapshots, ICorDebugEditAndContinueSnapshot* pSnapshots[], ICorDebugErrorInfoEnum** pError);
|
||||
HRESULT STDMETHODCALLTYPE CommitChanges(ULONG cSnapshots, ICorDebugEditAndContinueSnapshot* pSnapshots[], ICorDebugErrorInfoEnum** pError);
|
||||
|
||||
void AddThread(CordbThread* thread);
|
||||
void AddFunction(CordbFunction* function);
|
||||
void AddModule(CordbModule* module);
|
||||
void AddAppDomain(CordbAppDomain* appDomain);
|
||||
void AddBreakpoint(CordbFunctionBreakpoint* bp);
|
||||
void AddPendingEval(CordbEval* eval);
|
||||
void AddStepper(CordbStepper* step);
|
||||
CordbClass* FindOrAddClass(mdToken token, int module_id);
|
||||
CordbType* FindOrAddPrimitiveType(CorElementType type);
|
||||
CordbType* FindOrAddClassType(CorElementType type, CordbClass *klass);
|
||||
CordbType* FindOrAddArrayType(CorElementType type, CordbType* elementType);
|
||||
//CordbType* FindOrAddGenericInstanceType(CorElementType type, std::initializer_list<CordbType*> arrayType); //use std::initializer_list for generic instances
|
||||
CordbFunction* FindFunction(int id);
|
||||
CordbModule* GetModule(int module_id);
|
||||
CordbStepper* GetStepper(int id);
|
||||
CordbAppDomain* GetCurrentAppDomain();
|
||||
CordbThread* FindThread(long thread_id);
|
||||
CordbFunctionBreakpoint* GetBreakpoint(int id);
|
||||
void CheckPendingEval();
|
||||
void SetJMCStatus(BOOL bIsJustMyCode);
|
||||
BOOL GetJMCStatus();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,67 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-REGISTER.CPP
|
||||
//
|
||||
|
||||
#include <cordb-assembly.h>
|
||||
#include <cordb-register.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
HRESULT CordbRegisterSet::GetRegistersAvailable(ULONG64* pAvailable)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbRegisterSet - GetRegistersAvailable - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
CordbRegisterSet::CordbRegisterSet(Connection* conn, int64_t sp) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_nSp = sp;
|
||||
}
|
||||
|
||||
HRESULT CordbRegisterSet::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugRegisterSet)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugRegisterSet*>(static_cast<ICorDebugRegisterSet*>(this));
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugRegisterSet*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbRegisterSet::GetRegisters(ULONG64 mask, ULONG32 regCount, CORDB_REGISTER regBuffer[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbRegisterSet - GetRegisters - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbRegisterSet::SetRegisters(ULONG64 mask, ULONG32 regCount, CORDB_REGISTER regBuffer[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbRegisterSet - SetRegisters - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbRegisterSet::GetThreadContext(ULONG32 contextSize, BYTE context[])
|
||||
{
|
||||
if (POS_RSP + sizeof(int64_t) < contextSize)
|
||||
memcpy(context+POS_RSP, &m_nSp, sizeof(int64_t));
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbRegisterSet - GetThreadContext - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbRegisterSet::SetThreadContext(ULONG32 contextSize, BYTE context[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbRegisterSet - SetThreadContext - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-REGISTER.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_REGISTER_H__
|
||||
#define __MONO_DEBUGGER_CORDB_REGISTER_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbRegisterSet : public CordbBaseMono, public ICorDebugRegisterSet
|
||||
{
|
||||
int64_t m_nSp;
|
||||
public:
|
||||
CordbRegisterSet(Connection* conn, int64_t sp);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbRegisterSet";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetRegistersAvailable(ULONG64* pAvailable);
|
||||
HRESULT STDMETHODCALLTYPE GetRegisters(ULONG64 mask, ULONG32 regCount, CORDB_REGISTER regBuffer[]);
|
||||
HRESULT STDMETHODCALLTYPE SetRegisters(ULONG64 mask, ULONG32 regCount, CORDB_REGISTER regBuffer[]);
|
||||
HRESULT STDMETHODCALLTYPE GetThreadContext(ULONG32 contextSize, BYTE context[]);
|
||||
HRESULT STDMETHODCALLTYPE SetThreadContext(ULONG32 contextSize, BYTE context[]);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,180 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-THREAD.CPP
|
||||
//
|
||||
|
||||
#include <cordb-appdomain.h>
|
||||
#include <cordb-blocking-obj.h>
|
||||
#include <cordb-chain.h>
|
||||
#include <cordb-eval.h>
|
||||
#include <cordb-frame.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb-register.h>
|
||||
#include <cordb-stepper.h>
|
||||
#include <cordb-thread.h>
|
||||
#include <cordb-stackwalk.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb.h>
|
||||
|
||||
|
||||
CordbStackWalk::CordbStackWalk(Connection* conn, CordbThread* ppThread): CordbBaseMono(conn)
|
||||
{
|
||||
m_pThread = ppThread;
|
||||
m_pThread->InternalAddRef();
|
||||
m_nCurrentFrame = 0;
|
||||
m_nFrames = 0;
|
||||
m_ppFrames = NULL;
|
||||
}
|
||||
|
||||
CordbStackWalk::~CordbStackWalk()
|
||||
{
|
||||
if (m_pThread)
|
||||
m_pThread->InternalRelease();
|
||||
if (m_ppFrames != NULL)
|
||||
{
|
||||
for (int i = 0; i < m_nFrames; i++)
|
||||
{
|
||||
this->m_ppFrames[i]->InternalRelease();
|
||||
}
|
||||
m_nFrames = 0;
|
||||
free(m_ppFrames);
|
||||
}
|
||||
}
|
||||
|
||||
void CordbStackWalk::Reset()
|
||||
{
|
||||
m_nFrames = 0;
|
||||
m_nCurrentFrame = 0;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStackWalk::GetContext(ULONG32 contextFlags, ULONG32 contextBufSize, ULONG32 *contextSize, BYTE contextBuf[ ])
|
||||
{
|
||||
if (m_nFrames != 0 && m_nCurrentFrame >= m_nFrames)
|
||||
return S_OK;
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_pThread->GetThreadId());
|
||||
m_dbgprot_buffer_add_int(&localbuf, m_nCurrentFrame);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_THREAD, MDBGPROT_CMD_THREAD_GET_CONTEXT, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
int contextSizeReceived = 0;
|
||||
int64_t stack_pointer = m_dbgprot_decode_long(pReply->p, &pReply->p, pReply->end);
|
||||
*contextSize = contextSizeReceived;
|
||||
memcpy(contextBuf+POS_RSP, &stack_pointer, sizeof(int64_t));
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbStackWalk - GetContext - IMPLEMENTED - %d - %lld\n", m_nCurrentFrame, stack_pointer));
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStackWalk::SetContext(CorDebugSetContextFlag flag, ULONG32 contextSize, BYTE context[ ])
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_pThread->GetThreadId());
|
||||
int64_t stack_pointer;
|
||||
memcpy(&stack_pointer, context+POS_RSP, sizeof(int64_t));
|
||||
m_dbgprot_buffer_add_long(&localbuf, stack_pointer);
|
||||
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbStackWalk - SetContext - IMPLEMENTED - %d - %lld\n", m_nCurrentFrame, stack_pointer));
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_THREAD, MDBGPROT_CMD_THREAD_SET_CONTEXT, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
m_nCurrentFrame = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStackWalk::Next(void)
|
||||
{
|
||||
PopulateStackWalk();
|
||||
if (m_nCurrentFrame + 1 >= m_nFrames)
|
||||
return CORDBG_S_AT_END_OF_STACK;
|
||||
m_nCurrentFrame++;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CordbStackWalk::PopulateStackWalk() {
|
||||
HRESULT hr = S_OK;
|
||||
if (m_nFrames != 0)
|
||||
return hr;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, m_pThread->GetThreadId());
|
||||
m_dbgprot_buffer_add_int(&localbuf, 0);
|
||||
m_dbgprot_buffer_add_int(&localbuf, -1);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_THREAD, MDBGPROT_CMD_THREAD_GET_FRAME_INFO, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
m_nFrames = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
m_ppFrames = (CordbNativeFrame**)malloc(sizeof(CordbNativeFrame*) * m_nFrames);
|
||||
|
||||
for (int i = 0; i < m_nFrames; i++)
|
||||
{
|
||||
int frameid = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
int methodId = m_dbgprot_decode_id(pReply->p, &pReply->p, pReply->end);
|
||||
int il_offset = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
int flags = m_dbgprot_decode_byte(pReply->p, &pReply->p, pReply->end);
|
||||
|
||||
CordbNativeFrame* frame = new CordbNativeFrame(conn, frameid, methodId, il_offset, flags, m_pThread, i);
|
||||
frame->InternalAddRef();
|
||||
m_ppFrames[i] = frame;
|
||||
}
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStackWalk::GetFrame(ICorDebugFrame **pFrame)
|
||||
{
|
||||
PopulateStackWalk();
|
||||
if (m_nCurrentFrame >= m_nFrames)
|
||||
return CORDBG_E_PAST_END_OF_STACK;
|
||||
return this->m_ppFrames[m_nCurrentFrame]->QueryInterface(IID_ICorDebugFrame, (void**)pFrame);
|
||||
}
|
||||
|
||||
// standard QI function
|
||||
HRESULT CordbStackWalk::QueryInterface(REFIID id, void **pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugStackWalk)
|
||||
{
|
||||
*pInterface = static_cast<ICorDebugStackWalk*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugStackWalk*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-STACKWALK.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_STACKWALK_H__
|
||||
#define __MONO_DEBUGGER_CORDB_STACKWALK_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbStackWalk : public CordbBaseMono,
|
||||
public ICorDebugStackWalk
|
||||
{
|
||||
CordbThread* m_pThread;
|
||||
int m_nCurrentFrame;
|
||||
int m_nFrames;
|
||||
CordbNativeFrame** m_ppFrames;
|
||||
|
||||
public:
|
||||
CordbStackWalk(Connection* conn, CordbThread* ppThread);
|
||||
~CordbStackWalk();
|
||||
HRESULT PopulateStackWalk();
|
||||
void Reset();
|
||||
HRESULT STDMETHODCALLTYPE GetContext(ULONG32 contextFlags, ULONG32 contextBufSize, ULONG32 *contextSize, BYTE contextBuf[ ]);
|
||||
HRESULT STDMETHODCALLTYPE SetContext(CorDebugSetContextFlag flag, ULONG32 contextSize, BYTE context[ ]);
|
||||
HRESULT STDMETHODCALLTYPE Next(void);
|
||||
HRESULT STDMETHODCALLTYPE GetFrame(ICorDebugFrame **pFrame);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbThread";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,155 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-STEPPER.CPP
|
||||
//
|
||||
|
||||
#include <cordb-frame.h>
|
||||
#include <cordb-stepper.h>
|
||||
#include <cordb-thread.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbStepper::CordbStepper(Connection* conn, CordbThread* thread) : CordbBaseMono(conn)
|
||||
{
|
||||
m_pThread = thread;
|
||||
m_debuggerId = -1;
|
||||
conn->GetProcess()->AddStepper(this);
|
||||
m_bIsActive = false;
|
||||
}
|
||||
|
||||
CordbStepper::~CordbStepper() {}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::IsActive(BOOL* pbActive)
|
||||
{
|
||||
*pbActive = m_bIsActive;
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbStepper - IsActive - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::Deactivate(void)
|
||||
{
|
||||
if (!m_bIsActive)
|
||||
return S_OK;
|
||||
m_bIsActive = false;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbStepper - Deactivate - IMPLEMENTED\n"));
|
||||
MdbgProtBuffer sendbuf;
|
||||
int buflen = 128;
|
||||
m_dbgprot_buffer_init(&sendbuf, buflen);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_EVENT_KIND_STEP);
|
||||
m_dbgprot_buffer_add_int(&sendbuf, m_debuggerId);
|
||||
conn->SendEvent(MDBGPROT_CMD_SET_EVENT_REQUEST, MDBGPROT_CMD_EVENT_REQUEST_CLEAR, &sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::SetInterceptMask(CorDebugIntercept mask)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbStepper - SetInterceptMask - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::SetUnmappedStopMask(CorDebugUnmappedStop mask)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbStepper - SetUnmappedStopMask - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::Step(BOOL bStepIn)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbStepper - Step - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::StepRange(BOOL bStepIn, COR_DEBUG_STEP_RANGE ranges[], ULONG32 cRangeCount)
|
||||
{
|
||||
m_bIsActive = true;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbStepper - StepRange - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer sendbuf;
|
||||
int buflen = 128;
|
||||
m_dbgprot_buffer_init(&sendbuf, buflen);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_EVENT_KIND_STEP);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_SUSPEND_POLICY_ALL);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, 1); // modifiers
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_MOD_KIND_STEP);
|
||||
|
||||
m_dbgprot_buffer_add_id(&sendbuf, m_pThread->GetThreadId());
|
||||
m_dbgprot_buffer_add_int(&sendbuf, MDBGPROT_STEP_SIZE_MIN);
|
||||
m_dbgprot_buffer_add_int(&sendbuf, bStepIn ? MDBGPROT_STEP_DEPTH_INTO : MDBGPROT_STEP_DEPTH_OVER);
|
||||
m_dbgprot_buffer_add_int(&sendbuf, conn->GetProcess()->GetJMCStatus() ? MDBGPROT_STEP_FILTER_DEBUGGER_NON_USER_CODE : MDBGPROT_STEP_FILTER_NONE);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_EVENT_REQUEST, MDBGPROT_CMD_EVENT_REQUEST_SET, &sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
m_debuggerId = m_dbgprot_decode_id(pReply->p, &pReply->p, pReply->end);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::StepOut(void)
|
||||
{
|
||||
m_bIsActive = true;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbStepper - StepOut - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer sendbuf;
|
||||
int buflen = 128;
|
||||
m_dbgprot_buffer_init(&sendbuf, buflen);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_EVENT_KIND_STEP);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_SUSPEND_POLICY_ALL);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, 1); // modifiers
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_MOD_KIND_STEP);
|
||||
|
||||
m_dbgprot_buffer_add_id(&sendbuf, m_pThread->GetThreadId());
|
||||
m_dbgprot_buffer_add_int(&sendbuf, MDBGPROT_STEP_SIZE_MIN);
|
||||
m_dbgprot_buffer_add_int(&sendbuf, MDBGPROT_STEP_DEPTH_OUT);
|
||||
m_dbgprot_buffer_add_int(&sendbuf, MDBGPROT_STEP_FILTER_NONE);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_EVENT_REQUEST, MDBGPROT_CMD_EVENT_REQUEST_SET, &sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::SetRangeIL(BOOL bIL)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbStepper - SetRangeIL - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugStepper)
|
||||
*pInterface = static_cast<ICorDebugStepper*>(this);
|
||||
else if (id == IID_ICorDebugStepper2)
|
||||
*pInterface = static_cast<ICorDebugStepper2*>(this);
|
||||
else if (id == IID_IUnknown)
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugStepper*>(this));
|
||||
else
|
||||
return E_NOINTERFACE;
|
||||
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbStepper::SetJMC(BOOL fIsJMCStepper)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbStepper - SetJMC - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-STEPPER.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_STEPPER_H__
|
||||
#define __MONO_DEBUGGER_CORDB_STEPPER_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbStepper : public CordbBaseMono, public ICorDebugStepper, public ICorDebugStepper2
|
||||
{
|
||||
CordbThread* m_pThread;
|
||||
int m_debuggerId;
|
||||
bool m_bIsActive;
|
||||
|
||||
public:
|
||||
CordbStepper(Connection* conn, CordbThread* thread);
|
||||
~CordbStepper();
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbStepper";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE IsActive(BOOL* pbActive);
|
||||
HRESULT STDMETHODCALLTYPE Deactivate(void);
|
||||
HRESULT STDMETHODCALLTYPE SetInterceptMask(CorDebugIntercept mask);
|
||||
HRESULT STDMETHODCALLTYPE SetUnmappedStopMask(CorDebugUnmappedStop mask);
|
||||
HRESULT STDMETHODCALLTYPE Step(BOOL bStepIn);
|
||||
HRESULT STDMETHODCALLTYPE StepRange(BOOL bStepIn, COR_DEBUG_STEP_RANGE ranges[], ULONG32 cRangeCount);
|
||||
HRESULT STDMETHODCALLTYPE StepOut(void);
|
||||
HRESULT STDMETHODCALLTYPE SetRangeIL(BOOL bIL);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
HRESULT STDMETHODCALLTYPE SetJMC(BOOL fIsJMCStepper);
|
||||
int GetDebuggerId() const
|
||||
{
|
||||
return m_debuggerId;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,667 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-SYMBOL.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_SYMBOL_H__
|
||||
#define __MONO_DEBUGGER_CORDB_SYMBOL_H__
|
||||
|
||||
#include <cordb-assembly.h>
|
||||
#include <cordb.h>
|
||||
|
||||
#define COR_GLOBAL_PARENT_TOKEN TokenFromRid(1, mdtTypeDef)
|
||||
|
||||
class CLiteWeightStgdbRW;
|
||||
|
||||
class RegMeta : public CordbBaseMono,
|
||||
public IMetaDataImport2,
|
||||
public IMetaDataAssemblyImport {
|
||||
CLiteWeightStgdbRW *m_pStgdb;
|
||||
|
||||
public:
|
||||
RegMeta(CordbAssembly *cordbAssembly, CordbModule *cordbModule);
|
||||
~RegMeta();
|
||||
ULONG STDMETHODCALLTYPE AddRef(void) { return (BaseAddRef()); }
|
||||
ULONG STDMETHODCALLTYPE Release(void) { return (BaseRelease()); }
|
||||
const char *GetClassName() { return "CordbRegMeta"; }
|
||||
|
||||
inline int IsGlobalMethodParentTk(mdTypeDef td) {
|
||||
return (td == mdTypeDefNil || td == mdTokenNil);
|
||||
}
|
||||
|
||||
int inline IsGlobalMethodParent(mdTypeDef *ptd) {
|
||||
if (IsGlobalMethodParentTk(*ptd)) {
|
||||
*ptd = COR_GLOBAL_PARENT_TOKEN;
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
int inline IsGlobalMethodParentToken(mdTypeDef td) {
|
||||
return (td == COR_GLOBAL_PARENT_TOKEN);
|
||||
}
|
||||
|
||||
STDMETHOD(EnumGenericParams)
|
||||
(HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdToken
|
||||
tk, // [IN] TypeDef or MethodDef whose generic parameters are requested
|
||||
mdGenericParam rGenericParams[], // [OUT] Put GenericParams here.
|
||||
ULONG cMax, // [IN] Max GenericParams to put.
|
||||
ULONG *pcGenericParams);
|
||||
|
||||
STDMETHOD(GetGenericParamProps)
|
||||
( // S_OK or error.
|
||||
mdGenericParam gp, // [IN] GenericParam
|
||||
ULONG *pulParamSeq, // [OUT] Index of the type parameter
|
||||
DWORD *pdwParamFlags, // [OUT] Flags, for future use (e.g. variance)
|
||||
mdToken *ptOwner, // [OUT] Owner (TypeDef or MethodDef)
|
||||
DWORD *reserved, // [OUT] For future use (e.g. non-type parameters)
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR wzname, // [OUT] Put name here
|
||||
ULONG cchName, // [IN] Size of buffer
|
||||
ULONG *pchName); // [OUT] Put size of name (wide chars) here.
|
||||
|
||||
STDMETHOD(GetMethodSpecProps)
|
||||
(mdMethodSpec mi, // [IN] The method instantiation
|
||||
mdToken *tkParent, // [OUT] MethodDef or MemberRef
|
||||
PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
|
||||
ULONG *pcbSigBlob); // [OUT] actual size of signature blob
|
||||
|
||||
STDMETHOD(EnumGenericParamConstraints)
|
||||
(HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdGenericParam tk, // [IN] GenericParam whose constraints are requested
|
||||
mdGenericParamConstraint
|
||||
rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here.
|
||||
ULONG cMax, // [IN] Max GenericParamConstraints to put.
|
||||
ULONG *pcGenericParamConstraints); // [OUT] Put # put here.
|
||||
|
||||
STDMETHOD(GetGenericParamConstraintProps)
|
||||
( // S_OK or error.
|
||||
mdGenericParamConstraint gpc, // [IN] GenericParamConstraint
|
||||
mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained
|
||||
mdToken *ptkConstraintType); // [OUT] TypeDef/Ref/Spec constraint
|
||||
|
||||
STDMETHOD(GetPEKind)
|
||||
( // S_OK or error.
|
||||
DWORD *pdwPEKind, // [OUT] The kind of PE (0 - not a PE)
|
||||
DWORD *pdwMAchine); // [OUT] Machine as defined in NT header
|
||||
|
||||
STDMETHOD(GetVersionString)
|
||||
( // S_OK or error.
|
||||
_Out_writes_to_opt_(ccBufSize, *pccBufSize)
|
||||
LPWSTR pwzBuf, // [OUT] Put version string here.
|
||||
DWORD ccBufSize, // [IN] size of the buffer, in wide chars
|
||||
DWORD *pccBufSize); // [OUT] Size of the version string, wide chars,
|
||||
// including terminating nul.
|
||||
|
||||
STDMETHOD(EnumMethodSpecs)
|
||||
(HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested
|
||||
mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here.
|
||||
ULONG cMax, // [IN] Max tokens to put.
|
||||
ULONG *pcMethodSpecs); // [OUT] Put actual count here.
|
||||
|
||||
STDMETHOD(GetAssemblyProps)
|
||||
( // S_OK or error.
|
||||
mdAssembly mda, // [IN] The Assembly for which to get the properties.
|
||||
const void **ppbPublicKey, // [OUT] Pointer to the public key.
|
||||
ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key.
|
||||
ULONG *pulHashAlgId, // [OUT] Hash Algorithm.
|
||||
_Out_writes_to_opt_(cchName, *pchName) LPWSTR
|
||||
szName, // [OUT] MdbgProtBuffer to fill with assembly's simply name.
|
||||
ULONG cchName, // [IN] Size of buffer in wide chars.
|
||||
ULONG *pchName, // [OUT] Actual # of wide chars in name.
|
||||
ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
|
||||
DWORD *pdwAssemblyFlags); // [OUT] Flags.
|
||||
|
||||
STDMETHOD(GetAssemblyRefProps)
|
||||
( // S_OK or error.
|
||||
mdAssemblyRef
|
||||
mdar, // [IN] The AssemblyRef for which to get the properties.
|
||||
const void *
|
||||
*ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token.
|
||||
ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or
|
||||
// token.
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR szName, // [OUT] MdbgProtBuffer to fill with name.
|
||||
ULONG cchName, // [IN] Size of buffer in wide chars.
|
||||
ULONG *pchName, // [OUT] Actual # of wide chars in name.
|
||||
ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
|
||||
const void **ppbHashValue, // [OUT] Hash blob.
|
||||
ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob.
|
||||
DWORD *pdwAssemblyRefFlags); // [OUT] Flags.
|
||||
|
||||
STDMETHOD(GetFileProps)
|
||||
( // S_OK or error.
|
||||
mdFile mdf, // [IN] The File for which to get the properties.
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR szName, // [OUT] MdbgProtBuffer to fill with name.
|
||||
ULONG cchName, // [IN] Size of buffer in wide chars.
|
||||
ULONG *pchName, // [OUT] Actual # of wide chars in name.
|
||||
const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob.
|
||||
ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob.
|
||||
DWORD *pdwFileFlags); // [OUT] Flags.
|
||||
|
||||
STDMETHOD(GetExportedTypeProps)
|
||||
( // S_OK or error.
|
||||
mdExportedType
|
||||
mdct, // [IN] The ExportedType for which to get the properties.
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR szName, // [OUT] MdbgProtBuffer to fill with name.
|
||||
ULONG cchName, // [IN] Size of buffer in wide chars.
|
||||
ULONG *pchName, // [OUT] Actual # of wide chars in name.
|
||||
mdToken *
|
||||
ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType.
|
||||
mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file.
|
||||
DWORD *pdwExportedTypeFlags); // [OUT] Flags.
|
||||
|
||||
STDMETHOD(GetManifestResourceProps)
|
||||
( // S_OK or error.
|
||||
mdManifestResource
|
||||
mdmr, // [IN] The ManifestResource for which to get the properties.
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR szName, // [OUT] MdbgProtBuffer to fill with name.
|
||||
ULONG cchName, // [IN] Size of buffer in wide chars.
|
||||
ULONG *pchName, // [OUT] Actual # of wide chars in name.
|
||||
mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides
|
||||
// the ManifestResource.
|
||||
DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within
|
||||
// the file.
|
||||
DWORD *pdwResourceFlags); // [OUT] Flags.
|
||||
|
||||
STDMETHOD(EnumAssemblyRefs)
|
||||
( // S_OK or error
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here.
|
||||
ULONG cMax, // [IN] Max AssemblyRefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
STDMETHOD(EnumFiles)
|
||||
( // S_OK or error
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdFile rFiles[], // [OUT] Put Files here.
|
||||
ULONG cMax, // [IN] Max Files to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
STDMETHOD(EnumExportedTypes)
|
||||
( // S_OK or error
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here.
|
||||
ULONG cMax, // [IN] Max ExportedTypes to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
STDMETHOD(EnumManifestResources)
|
||||
( // S_OK or error
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdManifestResource
|
||||
rManifestResources[], // [OUT] Put ManifestResources here.
|
||||
ULONG cMax, // [IN] Max Resources to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
STDMETHOD(GetAssemblyFromScope)
|
||||
( // S_OK or error
|
||||
mdAssembly *ptkAssembly);
|
||||
|
||||
STDMETHOD(FindExportedTypeByName)
|
||||
( // S_OK or error
|
||||
LPCWSTR szName, // [IN] Name of the ExportedType.
|
||||
mdToken mdtExportedType, // [IN] ExportedType for the enclosing class.
|
||||
mdExportedType
|
||||
*ptkExportedType); // [OUT] Put the ExportedType token here.
|
||||
|
||||
STDMETHOD(FindManifestResourceByName)
|
||||
( // S_OK or error
|
||||
LPCWSTR szName, // [IN] Name of the ManifestResource.
|
||||
mdManifestResource
|
||||
*ptkManifestResource); // [OUT] Put the ManifestResource token here.
|
||||
|
||||
STDMETHOD(FindAssembliesByName)
|
||||
( // S_OK or error
|
||||
LPCWSTR szAppBase, // [IN] optional - can be NULL
|
||||
LPCWSTR szPrivateBin, // [IN] optional - can be NULL
|
||||
LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are
|
||||
// requesting
|
||||
IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here
|
||||
ULONG cMax, // [IN] The max number to put
|
||||
ULONG *pcAssemblies); // [OUT] The number of assemblies returned.
|
||||
|
||||
// IUnknown methods
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID *ppvObj);
|
||||
|
||||
// IMetaDataImport functions
|
||||
|
||||
void CloseEnum(HCORENUM hEnum);
|
||||
HRESULT STDMETHODCALLTYPE CountEnum(HCORENUM hEnum, ULONG *pulCount);
|
||||
HRESULT STDMETHODCALLTYPE ResetEnum(HCORENUM hEnum, ULONG ulPos);
|
||||
HRESULT STDMETHODCALLTYPE EnumTypeDefs(HCORENUM *phEnum, mdTypeDef rTypeDefs[], ULONG cMax,
|
||||
ULONG *pcTypeDefs);
|
||||
HRESULT STDMETHODCALLTYPE EnumInterfaceImpls(HCORENUM *phEnum, mdTypeDef td,
|
||||
mdInterfaceImpl rImpls[], ULONG cMax,
|
||||
ULONG *pcImpls);
|
||||
HRESULT STDMETHODCALLTYPE EnumTypeRefs(HCORENUM *phEnum, mdTypeRef rTypeRefs[], ULONG cMax,
|
||||
ULONG *pcTypeRefs);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE FindTypeDefByName( // S_OK or error.
|
||||
LPCWSTR szTypeDef, // [IN] Name of the Type.
|
||||
mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
|
||||
mdTypeDef *ptd); // [OUT] Put the TypeDef token here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetScopeProps( // S_OK or error.
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR szName, // [OUT] Put the name here.
|
||||
ULONG cchName, // [IN] Size of name buffer in wide chars.
|
||||
ULONG *pchName, // [OUT] Put size of name (wide chars) here.
|
||||
GUID *pmvid); // [OUT, OPTIONAL] Put MVID here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetModuleFromScope( // S_OK.
|
||||
mdModule *pmd); // [OUT] Put mdModule token here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetTypeDefProps( // S_OK or error.
|
||||
mdTypeDef td, // [IN] TypeDef token for inquiry.
|
||||
_Out_writes_to_opt_(cchTypeDef, *pchTypeDef)
|
||||
LPWSTR szTypeDef, // [OUT] Put name here.
|
||||
ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
|
||||
ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
|
||||
DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
|
||||
mdToken *ptkExtends); // [OUT] Put base class TypeDef/TypeRef here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetInterfaceImplProps( // S_OK or error.
|
||||
mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
|
||||
mdTypeDef *pClass, // [OUT] Put implementing class token here.
|
||||
mdToken *ptkIface); // [OUT] Put implemented interface token here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetTypeRefProps( // S_OK or error.
|
||||
mdTypeRef tr, // [IN] TypeRef token.
|
||||
mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or
|
||||
// AssemblyRef.
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR szName, // [OUT] Name of the TypeRef.
|
||||
ULONG cchName, // [IN] Size of buffer.
|
||||
ULONG *pchName); // [OUT] Size of Name.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE ResolveTypeRef(mdTypeRef tr, REFIID riid, IUnknown **ppIScope,
|
||||
mdTypeDef *ptd);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumMembers( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
|
||||
mdToken rMembers[], // [OUT] Put MemberDefs here.
|
||||
ULONG cMax, // [IN] Max MemberDefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumMembersWithName( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
|
||||
LPCWSTR szName, // [IN] Limit results to those with this name.
|
||||
mdToken rMembers[], // [OUT] Put MemberDefs here.
|
||||
ULONG cMax, // [IN] Max MemberDefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumMethods( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
|
||||
mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
|
||||
ULONG cMax, // [IN] Max MethodDefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumMethodsWithName( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
|
||||
LPCWSTR szName, // [IN] Limit results to those with this name.
|
||||
mdMethodDef rMethods[], // [OU] Put MethodDefs here.
|
||||
ULONG cMax, // [IN] Max MethodDefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumFields( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
|
||||
mdFieldDef rFields[], // [OUT] Put FieldDefs here.
|
||||
ULONG cMax, // [IN] Max FieldDefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumFieldsWithName( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
|
||||
LPCWSTR szName, // [IN] Limit results to those with this name.
|
||||
mdFieldDef rFields[], // [OUT] Put MemberDefs here.
|
||||
ULONG cMax, // [IN] Max MemberDefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumParams( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
|
||||
mdParamDef rParams[], // [OUT] Put ParamDefs here.
|
||||
ULONG cMax, // [IN] Max ParamDefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumMemberRefs( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdToken tkParent, // [IN] Parent token to scope the enumeration.
|
||||
mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
|
||||
ULONG cMax, // [IN] Max MemberRefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumMethodImpls( // S_OK, S_FALSE, or error
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef td, // [IN] TypeDef to scope the enumeration.
|
||||
mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
|
||||
mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
|
||||
ULONG cMax, // [IN] Max tokens to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumPermissionSets( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdToken tk, // [IN] if !NIL, token to scope the enumeration.
|
||||
DWORD dwActions, // [IN] if !0, return only these actions.
|
||||
mdPermission rPermission[], // [OUT] Put Permissions here.
|
||||
ULONG cMax, // [IN] Max Permissions to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE FindMember(
|
||||
mdTypeDef td, // [IN] given typedef
|
||||
LPCWSTR szName, // [IN] member name
|
||||
PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
|
||||
ULONG cbSigBlob, // [IN] count of bytes in the signature blob
|
||||
mdToken *pmb); // [OUT] matching memberdef
|
||||
|
||||
HRESULT STDMETHODCALLTYPE FindMethod(
|
||||
mdTypeDef td, // [IN] given typedef
|
||||
LPCWSTR szName, // [IN] member name
|
||||
PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
|
||||
ULONG cbSigBlob, // [IN] count of bytes in the signature blob
|
||||
mdMethodDef *pmb); // [OUT] matching memberdef
|
||||
|
||||
HRESULT STDMETHODCALLTYPE FindField(
|
||||
mdTypeDef td, // [IN] given typedef
|
||||
LPCWSTR szName, // [IN] member name
|
||||
PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
|
||||
ULONG cbSigBlob, // [IN] count of bytes in the signature blob
|
||||
mdFieldDef *pmb); // [OUT] matching memberdef
|
||||
|
||||
HRESULT STDMETHODCALLTYPE FindMemberRef(
|
||||
mdTypeRef td, // [IN] given typeRef
|
||||
LPCWSTR szName, // [IN] member name
|
||||
PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
|
||||
ULONG cbSigBlob, // [IN] count of bytes in the signature blob
|
||||
mdMemberRef *pmr); // [OUT] matching memberref
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetMethodProps(
|
||||
mdMethodDef mb, // The method for which to get props.
|
||||
mdTypeDef *pClass, // Put method's class here.
|
||||
_Out_writes_to_opt_(cchMethod, *pchMethod)
|
||||
LPWSTR szMethod, // Put method's name here.
|
||||
ULONG cchMethod, // Size of szMethod buffer in wide chars.
|
||||
ULONG *pchMethod, // Put actual size here
|
||||
DWORD *pdwAttr, // Put flags here.
|
||||
PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
|
||||
ULONG *pcbSigBlob, // [OUT] actual size of signature blob
|
||||
ULONG *pulCodeRVA, // [OUT] codeRVA
|
||||
DWORD *pdwImplFlags); // [OUT] Impl. Flags
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetMemberRefProps( // S_OK or error.
|
||||
mdMemberRef mr, // [IN] given memberref
|
||||
mdToken *ptk, // [OUT] Put classref or classdef here.
|
||||
_Out_writes_to_opt_(cchMember, *pchMember)
|
||||
LPWSTR szMember, // [OUT] buffer to fill for member's name
|
||||
ULONG cchMember, // [IN] the count of char of szMember
|
||||
ULONG *pchMember, // [OUT] actual count of char in member name
|
||||
PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
|
||||
ULONG *pbSig); // [OUT] actual size of signature blob
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumProperties( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef td, // [IN] TypeDef to scope the enumeration.
|
||||
mdProperty rProperties[], // [OUT] Put Properties here.
|
||||
ULONG cMax, // [IN] Max properties to put.
|
||||
ULONG *pcProperties); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumEvents( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdTypeDef td, // [IN] TypeDef to scope the enumeration.
|
||||
mdEvent rEvents[], // [OUT] Put events here.
|
||||
ULONG cMax, // [IN] Max events to put.
|
||||
ULONG *pcEvents); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetEventProps( // S_OK, S_FALSE, or error.
|
||||
mdEvent ev, // [IN] event token
|
||||
mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
|
||||
LPCWSTR szEvent, // [OUT] Event name
|
||||
ULONG cchEvent, // [IN] the count of wchar of szEvent
|
||||
ULONG *pchEvent, // [OUT] actual count of wchar for event's name
|
||||
DWORD *pdwEventFlags, // [OUT] Event flags.
|
||||
mdToken *ptkEventType, // [OUT] EventType class
|
||||
mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
|
||||
mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
|
||||
mdMethodDef *pmdFire, // [OUT] Fire method of the event
|
||||
mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
|
||||
ULONG cMax, // [IN] size of rmdOtherMethod
|
||||
ULONG *pcOtherMethod); // [OUT] total number of other method of this event
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumMethodSemantics( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
|
||||
mdToken rEventProp[], // [OUT] Put Event/Property here.
|
||||
ULONG cMax, // [IN] Max properties to put.
|
||||
ULONG *pcEventProp); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetMethodSemantics( // S_OK, S_FALSE, or error.
|
||||
mdMethodDef mb, // [IN] method token
|
||||
mdToken tkEventProp, // [IN] event/property token.
|
||||
DWORD *pdwSemanticsFlags); // [OUT] the role flags for the
|
||||
// method/propevent pair
|
||||
|
||||
HRESULT
|
||||
GetClassLayout(mdTypeDef td, // [IN] give typedef
|
||||
DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
|
||||
COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
|
||||
ULONG cMax, // [IN] size of the array
|
||||
ULONG *pcFieldOffset, // [OUT] needed array size
|
||||
ULONG *pulClassSize); // [OUT] the size of the class
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetFieldMarshal(
|
||||
mdToken tk, // [IN] given a field's memberdef
|
||||
PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
|
||||
ULONG *pcbNativeType); // [OUT] the count of bytes of *ppvNativeType
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetRVA( // S_OK or error.
|
||||
mdToken tk, // Member for which to set offset
|
||||
ULONG *pulCodeRVA, // The offset
|
||||
DWORD *pdwImplFlags); // the implementation flags
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPermissionSetProps(
|
||||
mdPermission pm, // [IN] the permission token.
|
||||
DWORD *pdwAction, // [OUT] CorDeclSecurity.
|
||||
void const **ppvPermission, // [OUT] permission blob.
|
||||
ULONG *pcbPermission); // [OUT] count of bytes of pvPermission.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetSigFromToken( // S_OK or error.
|
||||
mdSignature mdSig, // [IN] Signature token.
|
||||
PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
|
||||
ULONG *pcbSig); // [OUT] return size of signature.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetModuleRefProps( // S_OK or error.
|
||||
mdModuleRef mur, // [IN] moduleref token.
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
|
||||
ULONG cchName, // [IN] size of szName in wide characters.
|
||||
ULONG *pchName); // [OUT] actual count of characters in the name.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumModuleRefs( // S_OK or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
|
||||
mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
|
||||
ULONG cmax, // [IN] max memberrefs to put.
|
||||
ULONG *pcModuleRefs); // [OUT] put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetTypeSpecFromToken( // S_OK or error.
|
||||
mdTypeSpec typespec, // [IN] TypeSpec token.
|
||||
PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
|
||||
ULONG *pcbSig); // [OUT] return size of signature.
|
||||
|
||||
HRESULT
|
||||
GetNameFromToken( // Not Recommended! May be removed!
|
||||
mdToken tk, // [IN] Token to get name from. Must have a name.
|
||||
MDUTF8CSTR *pszUtf8NamePtr); // [OUT] Return pointer to UTF8 name in heap.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumUnresolvedMethods( // S_OK, S_FALSE, or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
|
||||
mdToken rMethods[], // [OUT] Put MemberDefs here.
|
||||
ULONG cMax, // [IN] Max MemberDefs to put.
|
||||
ULONG *pcTokens); // [OUT] Put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetUserString( // S_OK or error.
|
||||
mdString stk, // [IN] String token.
|
||||
_Out_writes_to_opt_(cchString, *pchString)
|
||||
LPWSTR szString, // [OUT] Copy of string.
|
||||
ULONG cchString, // [IN] Max chars of room in szString.
|
||||
ULONG *pchString); // [OUT] How many chars in actual string.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPinvokeMap( // S_OK or error.
|
||||
mdToken tk, // [IN] FieldDef or MethodDef.
|
||||
DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
|
||||
_Out_writes_to_opt_(cchImportName, *pchImportName)
|
||||
LPWSTR szImportName, // [OUT] Import name.
|
||||
ULONG cchImportName, // [IN] Size of the name buffer.
|
||||
ULONG *pchImportName, // [OUT] Actual number of characters stored.
|
||||
mdModuleRef *pmrImportDLL); // [OUT] ModuleRef token for the target DLL.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumSignatures( // S_OK or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
|
||||
mdSignature rSignatures[], // [OUT] put signatures here.
|
||||
ULONG cmax, // [IN] max signatures to put.
|
||||
ULONG *pcSignatures); // [OUT] put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumTypeSpecs( // S_OK or error.
|
||||
HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
|
||||
mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
|
||||
ULONG cmax, // [IN] max TypeSpecs to put.
|
||||
ULONG *pcTypeSpecs); // [OUT] put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumUserStrings( // S_OK or error.
|
||||
HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
|
||||
mdString rStrings[], // [OUT] put Strings here.
|
||||
ULONG cmax, // [IN] max Strings to put.
|
||||
ULONG *pcStrings); // [OUT] put # put here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetParamForMethodIndex( // S_OK or error.
|
||||
mdMethodDef md, // [IN] Method token.
|
||||
ULONG ulParamSeq, // [IN] Parameter sequence.
|
||||
mdParamDef *ppd); // [IN] Put Param token here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnumCustomAttributes( // S_OK or error.
|
||||
HCORENUM *phEnum, // [IN, OUT] COR enumerator.
|
||||
mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
|
||||
mdToken tkType, // [IN] Type of interest, 0 for all.
|
||||
mdCustomAttribute
|
||||
rCustomAttributes[], // [OUT] Put custom attribute tokens here.
|
||||
ULONG cMax, // [IN] Size of rCustomAttributes.
|
||||
ULONG *pcCustomAttributes); // [OUT, OPTIONAL] Put count of token values
|
||||
// here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetCustomAttributeProps( // S_OK or error.
|
||||
mdCustomAttribute cv, // [IN] CustomAttribute token.
|
||||
mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
|
||||
mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
|
||||
void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
|
||||
ULONG *pcbSize); // [OUT, OPTIONAL] Put size of date here.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE FindTypeRef(
|
||||
mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
|
||||
LPCWSTR szName, // [IN] TypeRef Name.
|
||||
mdTypeRef *ptr); // [OUT] matching TypeRef.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetMemberProps(
|
||||
mdToken mb, // The member for which to get props.
|
||||
mdTypeDef *pClass, // Put member's class here.
|
||||
_Out_writes_to_opt_(cchMember, *pchMember)
|
||||
LPWSTR szMember, // Put member's name here.
|
||||
ULONG cchMember, // Size of szMember buffer in wide chars.
|
||||
ULONG *pchMember, // Put actual size here
|
||||
DWORD *pdwAttr, // Put flags here.
|
||||
PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
|
||||
ULONG *pcbSigBlob, // [OUT] actual size of signature blob
|
||||
ULONG *pulCodeRVA, // [OUT] codeRVA
|
||||
DWORD *pdwImplFlags, // [OUT] Impl. Flags
|
||||
DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected
|
||||
// ELEMENT_TYPE_*
|
||||
UVCP_CONSTANT *ppValue, // [OUT] constant value
|
||||
ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for
|
||||
// non-strings.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetFieldProps(
|
||||
mdFieldDef mb, // The field for which to get props.
|
||||
mdTypeDef *pClass, // Put field's class here.
|
||||
_Out_writes_to_opt_(cchField, *pchField)
|
||||
LPWSTR szField, // Put field's name here.
|
||||
ULONG cchField, // Size of szField buffer in wide chars.
|
||||
ULONG *pchField, // Put actual size here
|
||||
DWORD *pdwAttr, // Put flags here.
|
||||
PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
|
||||
ULONG *pcbSigBlob, // [OUT] actual size of signature blob
|
||||
DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected
|
||||
// ELEMENT_TYPE_*
|
||||
UVCP_CONSTANT *ppValue, // [OUT] constant value
|
||||
ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for
|
||||
// non-strings.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPropertyProps( // S_OK, S_FALSE, or error.
|
||||
mdProperty prop, // [IN] property token
|
||||
mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
|
||||
LPCWSTR szProperty, // [OUT] Property name
|
||||
ULONG cchProperty, // [IN] the count of wchar of szProperty
|
||||
ULONG *pchProperty, // [OUT] actual count of wchar for property name
|
||||
DWORD *pdwPropFlags, // [OUT] property flags.
|
||||
PCCOR_SIGNATURE
|
||||
*ppvSig, // [OUT] property type. pointing to meta data internal blob
|
||||
ULONG *pbSig, // [OUT] count of bytes in *ppvSig
|
||||
DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected
|
||||
// ELEMENT_TYPE_*
|
||||
UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value
|
||||
ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for
|
||||
// non-strings.
|
||||
mdMethodDef *pmdSetter, // [OUT] setter method of the property
|
||||
mdMethodDef *pmdGetter, // [OUT] getter method of the property
|
||||
mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
|
||||
ULONG cMax, // [IN] size of rmdOtherMethod
|
||||
ULONG *
|
||||
pcOtherMethod); // [OUT] total number of other method of this property
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetParamProps( // S_OK or error.
|
||||
mdParamDef tk, // [IN]The Parameter.
|
||||
mdMethodDef *pmd, // [OUT] Parent Method token.
|
||||
ULONG *pulSequence, // [OUT] Parameter sequence.
|
||||
_Out_writes_to_opt_(cchName, *pchName)
|
||||
LPWSTR szName, // [OUT] Put name here.
|
||||
ULONG cchName, // [OUT] Size of name buffer.
|
||||
ULONG *pchName, // [OUT] Put actual size of name here.
|
||||
DWORD *pdwAttr, // [OUT] Put flags here.
|
||||
DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected
|
||||
// ELEMENT_TYPE_*.
|
||||
UVCP_CONSTANT *ppValue, // [OUT] Constant value.
|
||||
ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for
|
||||
// non-strings.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetCustomAttributeByName( // S_OK or error.
|
||||
mdToken tkObj, // [IN] Object with Custom Attribute.
|
||||
LPCWSTR szName, // [IN] Name of desired Custom Attribute.
|
||||
const void **ppData, // [OUT] Put pointer to data here.
|
||||
ULONG *pcbData); // [OUT] Put size of data here.
|
||||
|
||||
BOOL IsValidToken( // True or False.
|
||||
mdToken tk); // [IN] Given token.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetNestedClassProps( // S_OK or error.
|
||||
mdTypeDef tdNestedClass, // [IN] NestedClass token.
|
||||
mdTypeDef *ptdEnclosingClass); // [OUT] EnclosingClass token.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetNativeCallConvFromSig( // S_OK or error.
|
||||
void const *pvSig, // [IN] Pointer to signature.
|
||||
ULONG cbSig, // [IN] Count of signature bytes.
|
||||
ULONG *pCallConv); // [OUT] Put calling conv here (see CorPinvokemap).
|
||||
|
||||
HRESULT STDMETHODCALLTYPE IsGlobal( // S_OK or error.
|
||||
mdToken pd, // [IN] Type, Field, or Method token.
|
||||
int *pbGlobal); // [OUT] Put 1 if global, 0 otherwise.
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,379 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-THREAD.CPP
|
||||
//
|
||||
|
||||
#include <cordb-appdomain.h>
|
||||
#include <cordb-blocking-obj.h>
|
||||
#include <cordb-chain.h>
|
||||
#include <cordb-eval.h>
|
||||
#include <cordb-frame.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb-register.h>
|
||||
#include <cordb-stepper.h>
|
||||
#include <cordb-thread.h>
|
||||
#include <cordb-stackwalk.h>
|
||||
#include <cordb.h>
|
||||
|
||||
CordbThread::CordbThread(Connection* conn, CordbProcess* ppProcess, long thread_id) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_pProcess = ppProcess;
|
||||
this->m_threadId = thread_id;
|
||||
m_pRegisterSet = NULL;
|
||||
m_pCurrentFrame = NULL;
|
||||
m_pBlockingObject = NULL;
|
||||
ppProcess->AddThread(this);
|
||||
}
|
||||
|
||||
CordbThread::~CordbThread()
|
||||
{
|
||||
if (m_pCurrentFrame)
|
||||
m_pCurrentFrame->InternalRelease();
|
||||
if (m_pBlockingObject)
|
||||
m_pBlockingObject->InternalRelease();
|
||||
if (m_pRegisterSet)
|
||||
m_pRegisterSet->InternalRelease();
|
||||
}
|
||||
|
||||
void CordbThread::SetRegisterSet(CordbRegisterSet* rs)
|
||||
{
|
||||
if (m_pRegisterSet != NULL)
|
||||
m_pRegisterSet->InternalRelease();
|
||||
m_pRegisterSet = rs;
|
||||
m_pRegisterSet->InternalAddRef();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::HasUnhandledException(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - HasUnhandledException - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetBlockingObjects(ICorDebugBlockingObjectEnum** ppBlockingObjectEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - GetBlockingObjects - IMPLEMENTED\n"));
|
||||
if (m_pBlockingObject == NULL)
|
||||
{
|
||||
m_pBlockingObject = new CordbBlockingObjectEnum(conn);
|
||||
m_pBlockingObject->InternalAddRef();
|
||||
}
|
||||
m_pBlockingObject->QueryInterface(IID_ICorDebugBlockingObjectEnum, (void**)ppBlockingObjectEnum);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetCurrentCustomDebuggerNotification(ICorDebugValue** ppNotificationObject)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000,
|
||||
"CordbThread - GetCurrentCustomDebuggerNotification - NOT "
|
||||
"IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::CreateStackWalk(ICorDebugStackWalk** ppStackWalk)
|
||||
{
|
||||
ICorDebugStackWalk* stackWalk = new CordbStackWalk(conn, this);
|
||||
return stackWalk->QueryInterface(IID_ICorDebugStackWalk, (void**)ppStackWalk);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetActiveInternalFrames(ULONG32 cInternalFrames,
|
||||
ULONG32* pcInternalFrames,
|
||||
ICorDebugInternalFrame2* ppInternalFrames[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetActiveInternalFrames - NOT IMPLEMENTED\n"));
|
||||
*pcInternalFrames = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetActiveFunctions(ULONG32 cFunctions,
|
||||
ULONG32* pcFunctions,
|
||||
COR_ACTIVE_FUNCTION pFunctions[])
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetActiveFunctions - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetConnectionID(CONNID* pdwConnectionId)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetConnectionID - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetTaskID(TASKID* pTaskId)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetTaskID - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetVolatileOSThreadID(DWORD* pdwTid)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - GetActiveFrame - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, GetThreadId());
|
||||
|
||||
int cmdId = this->conn->SendEvent(MDBGPROT_CMD_SET_THREAD, MDBGPROT_CMD_THREAD_GET_TID, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
*pdwTid = (DWORD) m_dbgprot_decode_long(pReply->p, &pReply->p, pReply->end);
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::InterceptCurrentException(
|
||||
|
||||
ICorDebugFrame* pFrame)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - InterceptCurrentException - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetProcess(ICorDebugProcess** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetProcess - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetID(DWORD* pdwThreadId)
|
||||
{
|
||||
*pdwThreadId = GetThreadId();
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - GetID - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetHandle(HTHREAD* phThreadHandle)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetHandle - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetAppDomain(ICorDebugAppDomain** ppAppDomain)
|
||||
{
|
||||
conn->GetCurrentAppDomain()->QueryInterface(IID_ICorDebugAppDomain, (void**)ppAppDomain);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - GetAppDomain - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::SetDebugState(CorDebugThreadState state)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - SetDebugState - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetDebugState(CorDebugThreadState* pState)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetDebugState - NOT IMPLEMENTED\n"));
|
||||
*pState = THREAD_RUN;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetUserState(CorDebugUserState* pState)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetUserState - NOT IMPLEMENTED\n"));
|
||||
|
||||
*pState = (CorDebugUserState)0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetCurrentException(ICorDebugValue** ppExceptionObject)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - GetCurrentException - IMPLEMENTED\n"));
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::ClearCurrentException(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - ClearCurrentException - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::CreateStepper(ICorDebugStepper** ppStepper)
|
||||
{
|
||||
m_pStepper = new CordbStepper(conn, this);
|
||||
m_pStepper->InternalAddRef();
|
||||
m_pStepper->QueryInterface(IID_ICorDebugStepper, (void**)ppStepper);
|
||||
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - CreateStepper - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::EnumerateChains(ICorDebugChainEnum** ppChains)
|
||||
{
|
||||
CordbChainEnum* pChains = new CordbChainEnum(conn, this);
|
||||
pChains->AddRef();
|
||||
*ppChains = static_cast<ICorDebugChainEnum*>(pChains);
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - EnumerateChains - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetActiveChain(ICorDebugChain** ppChain)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetActiveChain - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetActiveFrame(ICorDebugFrame** ppFrame)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - GetActiveFrame - IMPLEMENTED\n"));
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, GetThreadId());
|
||||
m_dbgprot_buffer_add_int(&localbuf, 0);
|
||||
m_dbgprot_buffer_add_int(&localbuf, -1);
|
||||
|
||||
int cmdId = this->conn->SendEvent(MDBGPROT_CMD_SET_THREAD, MDBGPROT_CMD_THREAD_GET_FRAME_INFO, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
int nframes = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
if (nframes > 0)
|
||||
{
|
||||
int frameid = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
int methodId = m_dbgprot_decode_id(pReply->p, &pReply->p, pReply->end);
|
||||
int il_offset = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
int flags = m_dbgprot_decode_byte(pReply->p, &pReply->p, pReply->end);
|
||||
if (m_pCurrentFrame)
|
||||
m_pCurrentFrame->InternalRelease();
|
||||
m_pCurrentFrame = new CordbNativeFrame(conn, frameid, methodId, il_offset, flags, this, 0);
|
||||
m_pCurrentFrame->InternalAddRef();
|
||||
m_pCurrentFrame->QueryInterface(IID_ICorDebugFrame, (void**)ppFrame);
|
||||
}
|
||||
SetRegisterSet(new CordbRegisterSet(conn, 0));
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetRegisterSet(ICorDebugRegisterSet** ppRegisters)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - GetRegisterSet - IMPLEMENTED\n"));
|
||||
if (m_pRegisterSet != NULL)
|
||||
m_pRegisterSet->InternalRelease();
|
||||
HRESULT hr = S_OK;
|
||||
EX_TRY
|
||||
{
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_id(&localbuf, GetThreadId());
|
||||
m_dbgprot_buffer_add_int(&localbuf, 0);
|
||||
|
||||
int cmdId = conn->SendEvent(MDBGPROT_CMD_SET_THREAD, MDBGPROT_CMD_THREAD_GET_CONTEXT, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = conn->GetReplyWithError(cmdId);
|
||||
CHECK_ERROR_RETURN_FALSE(received_reply_packet);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
int contextSizeReceived = 0;
|
||||
int64_t stack_pointer = m_dbgprot_decode_long(pReply->p, &pReply->p, pReply->end);
|
||||
m_pRegisterSet = new CordbRegisterSet(conn, stack_pointer);
|
||||
m_pRegisterSet->InternalAddRef();
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetRegisterSet - IMPLEMENTED - %ld\n", stack_pointer));
|
||||
}
|
||||
EX_CATCH_HRESULT(hr);
|
||||
|
||||
m_pRegisterSet->QueryInterface(IID_ICorDebugRegisterSet, (void**)ppRegisters);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::CreateEval(ICorDebugEval** ppEval)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbThread - CreateEval - IMPLEMENTED\n"));
|
||||
CordbEval* eval = new CordbEval(this->conn, this);
|
||||
eval->QueryInterface(IID_ICorDebugEval, (void**)ppEval);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::GetObject(ICorDebugValue** ppObject)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbThread - GetObject - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThread::QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* ppInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugThread)
|
||||
{
|
||||
*ppInterface = static_cast<ICorDebugThread*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugThread2)
|
||||
{
|
||||
*ppInterface = static_cast<ICorDebugThread2*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugThread3)
|
||||
{
|
||||
*ppInterface = static_cast<ICorDebugThread3*>(this);
|
||||
}
|
||||
else if (id == IID_ICorDebugThread4)
|
||||
{
|
||||
*ppInterface = static_cast<ICorDebugThread4*>(this);
|
||||
}
|
||||
else if (id == IID_IUnknown)
|
||||
{
|
||||
*ppInterface = static_cast<IUnknown*>(static_cast<ICorDebugThread*>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CordbThreadEnum::CordbThreadEnum(Connection* conn) : CordbBaseMono(conn)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbThreadEnum::Next(ULONG celt, ICorDebugThread* values[], ULONG* pceltFetched)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CordbThreadEnum::Skip(ULONG celt)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CordbThreadEnum::Reset(void)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CordbThreadEnum::Clone(ICorDebugEnum** ppEnum)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CordbThreadEnum::GetCount(ULONG* pcelt)
|
||||
{
|
||||
*pcelt = 0;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CordbThreadEnum::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_IUnknown)
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugThreadEnum*>(this));
|
||||
else if (id == IID_ICorDebugThreadEnum)
|
||||
*pInterface = static_cast<ICorDebugThreadEnum*>(this);
|
||||
else if (id == IID_ICorDebugEnum)
|
||||
*pInterface = static_cast<ICorDebugEnum*>(this);
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-THREAD.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_THREAD_H__
|
||||
#define __MONO_DEBUGGER_CORDB_THREAD_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbThread : public CordbBaseMono,
|
||||
public ICorDebugThread,
|
||||
public ICorDebugThread2,
|
||||
public ICorDebugThread3,
|
||||
public ICorDebugThread4
|
||||
{
|
||||
long m_threadId;
|
||||
CordbProcess* m_pProcess;
|
||||
CordbStepper* m_pStepper;
|
||||
CordbRegisterSet* m_pRegisterSet;
|
||||
CordbNativeFrame* m_pCurrentFrame;
|
||||
CordbBlockingObjectEnum* m_pBlockingObject;
|
||||
|
||||
public:
|
||||
CordbThread(Connection* conn, CordbProcess* ppProcess, long thread_id);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbThread";
|
||||
}
|
||||
~CordbThread();
|
||||
void SetRegisterSet(CordbRegisterSet* rs);
|
||||
HRESULT STDMETHODCALLTYPE HasUnhandledException(void);
|
||||
HRESULT STDMETHODCALLTYPE GetBlockingObjects(ICorDebugBlockingObjectEnum** ppBlockingObjectEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCurrentCustomDebuggerNotification(ICorDebugValue** ppNotificationObject);
|
||||
HRESULT STDMETHODCALLTYPE CreateStackWalk(ICorDebugStackWalk** ppStackWalk);
|
||||
HRESULT STDMETHODCALLTYPE GetActiveInternalFrames(ULONG32 cInternalFrames,
|
||||
ULONG32* pcInternalFrames,
|
||||
ICorDebugInternalFrame2* ppInternalFrames[]);
|
||||
HRESULT STDMETHODCALLTYPE GetActiveFunctions(ULONG32 cFunctions, ULONG32* pcFunctions, COR_ACTIVE_FUNCTION pFunctions[]);
|
||||
HRESULT STDMETHODCALLTYPE GetConnectionID(CONNID* pdwConnectionId);
|
||||
HRESULT STDMETHODCALLTYPE GetTaskID(TASKID* pTaskId);
|
||||
HRESULT STDMETHODCALLTYPE GetVolatileOSThreadID(DWORD* pdwTid);
|
||||
HRESULT STDMETHODCALLTYPE InterceptCurrentException(ICorDebugFrame* pFrame);
|
||||
HRESULT STDMETHODCALLTYPE GetProcess(ICorDebugProcess** ppProcess);
|
||||
HRESULT STDMETHODCALLTYPE GetID(DWORD* pdwThreadId);
|
||||
HRESULT STDMETHODCALLTYPE GetHandle(HTHREAD* phThreadHandle);
|
||||
HRESULT STDMETHODCALLTYPE GetAppDomain(ICorDebugAppDomain** ppAppDomain);
|
||||
HRESULT STDMETHODCALLTYPE SetDebugState(CorDebugThreadState state);
|
||||
HRESULT STDMETHODCALLTYPE GetDebugState(CorDebugThreadState* pState);
|
||||
HRESULT STDMETHODCALLTYPE GetUserState(CorDebugUserState* pState);
|
||||
HRESULT STDMETHODCALLTYPE GetCurrentException(ICorDebugValue** ppExceptionObject);
|
||||
HRESULT STDMETHODCALLTYPE ClearCurrentException(void);
|
||||
HRESULT STDMETHODCALLTYPE CreateStepper(ICorDebugStepper** ppStepper);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateChains(ICorDebugChainEnum** ppChains);
|
||||
HRESULT STDMETHODCALLTYPE GetActiveChain(ICorDebugChain** ppChain);
|
||||
HRESULT STDMETHODCALLTYPE GetActiveFrame(ICorDebugFrame** ppFrame);
|
||||
HRESULT STDMETHODCALLTYPE GetRegisterSet(ICorDebugRegisterSet** ppRegisters);
|
||||
HRESULT STDMETHODCALLTYPE CreateEval(ICorDebugEval** ppEval);
|
||||
HRESULT STDMETHODCALLTYPE GetObject(ICorDebugValue** ppObject);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface);
|
||||
|
||||
long GetThreadId() const
|
||||
{
|
||||
return m_threadId;
|
||||
}
|
||||
};
|
||||
|
||||
class CordbThreadEnum : public CordbBaseMono, public ICorDebugThreadEnum
|
||||
{
|
||||
public:
|
||||
CordbThreadEnum(Connection* conn);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbThreadEnum";
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE Next(ULONG celt, ICorDebugThread* values[], ULONG* pceltFetched);
|
||||
HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
|
||||
HRESULT STDMETHODCALLTYPE Reset(void);
|
||||
HRESULT STDMETHODCALLTYPE Clone(ICorDebugEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCount(ULONG* pcelt);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,189 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-TYPE.CPP
|
||||
//
|
||||
|
||||
#include <cordb-breakpoint.h>
|
||||
#include <cordb-class.h>
|
||||
#include <cordb-type.h>
|
||||
#include <cordb.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CordbType::CordbType(CorElementType type, Connection* conn, CordbClass* klass, CordbType* typeParameter)
|
||||
: CordbBaseMono(conn)
|
||||
{
|
||||
if (type == ELEMENT_TYPE_CLASS && klass == NULL)
|
||||
assert(0);
|
||||
this->m_pClass = klass;
|
||||
this->m_type = type;
|
||||
this->m_pTypeParameter = typeParameter;
|
||||
m_pTypeEnum = NULL;
|
||||
if (typeParameter)
|
||||
typeParameter->InternalAddRef();
|
||||
if (klass)
|
||||
klass->InternalAddRef();
|
||||
}
|
||||
|
||||
CordbType::~CordbType()
|
||||
{
|
||||
if (m_pClass)
|
||||
m_pClass->InternalRelease();
|
||||
if (m_pTypeParameter)
|
||||
m_pTypeParameter->InternalRelease();
|
||||
if (m_pTypeEnum)
|
||||
m_pTypeEnum->InternalRelease();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::GetType(CorElementType* ty)
|
||||
{
|
||||
*ty = m_type;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbType - GetType - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::GetClass(ICorDebugClass** ppClass)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbType - GetClass - IMPLEMENTED\n"));
|
||||
if (!m_pClass)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbType - GetClass - NO CLASS\n"));
|
||||
return S_OK;
|
||||
}
|
||||
m_pClass->QueryInterface(IID_ICorDebugClass, (void**)ppClass);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::EnumerateTypeParameters(ICorDebugTypeEnum** ppTyParEnum)
|
||||
{
|
||||
if (m_pTypeEnum == NULL)
|
||||
{
|
||||
m_pTypeEnum = new CordbTypeEnum(conn, m_pTypeParameter);
|
||||
m_pTypeEnum->InternalAddRef();
|
||||
}
|
||||
m_pTypeEnum->QueryInterface(IID_ICorDebugTypeEnum, (void**)ppTyParEnum);
|
||||
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbType - EnumerateTypeParameters - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::GetFirstTypeParameter(ICorDebugType** value)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbType - GetFirstTypeParameter - IMPLEMENTED\n"));
|
||||
m_pTypeParameter->QueryInterface(IID_ICorDebugType, (void**)value);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::GetBase(ICorDebugType** pBase)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbType - GetBase - IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::GetStaticFieldValue(mdFieldDef fieldDef,
|
||||
ICorDebugFrame* pFrame,
|
||||
ICorDebugValue** ppValue)
|
||||
{
|
||||
if (m_pClass) {
|
||||
return m_pClass->GetStaticFieldValue(fieldDef, pFrame, ppValue);
|
||||
}
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::GetRank(ULONG32* pnRank)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbType - GetRank - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugType)
|
||||
*pInterface = static_cast<ICorDebugType*>(this);
|
||||
else if (id == IID_ICorDebugType2)
|
||||
*pInterface = static_cast<ICorDebugType2*>(this);
|
||||
else if (id == IID_IUnknown)
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugType*>(this));
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbType::GetTypeID(COR_TYPEID* id)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbType - GetTypeID - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
CordbTypeEnum::CordbTypeEnum(Connection* conn, CordbType* type) : CordbBaseMono(conn)
|
||||
{
|
||||
this->m_pType = type;
|
||||
if (type)
|
||||
type->InternalAddRef();
|
||||
}
|
||||
|
||||
CordbTypeEnum::~CordbTypeEnum()
|
||||
{
|
||||
if (m_pType)
|
||||
m_pType->InternalRelease();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbTypeEnum::Next(ULONG celt, ICorDebugType* values[], ULONG* pceltFetched)
|
||||
{
|
||||
if (m_pType != NULL) {
|
||||
m_pType->QueryInterface(IID_ICorDebugType, (void**)&values[0]);
|
||||
*pceltFetched = celt;
|
||||
}
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbTypeEnum - Next - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbTypeEnum::Skip(ULONG celt)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbTypeEnum - Skip - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbTypeEnum::Reset(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbTypeEnum - Reset - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbTypeEnum::Clone(ICorDebugEnum** ppEnum)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CordbTypeEnum - Clone - NOT IMPLEMENTED\n"));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbTypeEnum::GetCount(ULONG* pcelt)
|
||||
{
|
||||
if (m_pType != NULL)
|
||||
*pcelt = 1;
|
||||
else
|
||||
*pcelt = 0;
|
||||
LOG((LF_CORDB, LL_INFO1000000, "CordbTypeEnum - GetCount - IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CordbTypeEnum::QueryInterface(REFIID id, void** pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebugEnum)
|
||||
*pInterface = static_cast<ICorDebugEnum*>(this);
|
||||
else if (id == IID_ICorDebugTypeEnum)
|
||||
*pInterface = static_cast<ICorDebugTypeEnum*>(this);
|
||||
else if (id == IID_IUnknown)
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugTypeEnum*>(this));
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-TYPE.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_TYPE_H__
|
||||
#define __MONO_DEBUGGER_CORDB_TYPE_H__
|
||||
|
||||
#include <cordb.h>
|
||||
|
||||
class CordbType : public CordbBaseMono, public ICorDebugType, public ICorDebugType2
|
||||
{
|
||||
CorElementType m_type;
|
||||
CordbClass* m_pClass;
|
||||
CordbType* m_pTypeParameter;
|
||||
CordbTypeEnum* m_pTypeEnum;
|
||||
|
||||
public:
|
||||
CordbType(CorElementType type, Connection* conn, CordbClass* klass = NULL, CordbType* typeParameter = NULL);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbType";
|
||||
}
|
||||
~CordbType();
|
||||
HRESULT STDMETHODCALLTYPE GetType(CorElementType* ty);
|
||||
HRESULT STDMETHODCALLTYPE GetClass(ICorDebugClass** ppClass);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateTypeParameters(ICorDebugTypeEnum** ppTyParEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetFirstTypeParameter(ICorDebugType** value);
|
||||
HRESULT STDMETHODCALLTYPE GetBase(ICorDebugType** pBase);
|
||||
HRESULT STDMETHODCALLTYPE GetStaticFieldValue(mdFieldDef fieldDef, ICorDebugFrame* pFrame, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetRank(ULONG32* pnRank);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetTypeID(COR_TYPEID* id);
|
||||
};
|
||||
|
||||
class CordbTypeEnum : public CordbBaseMono, public ICorDebugTypeEnum
|
||||
{
|
||||
CordbType* m_pType;
|
||||
|
||||
public:
|
||||
CordbTypeEnum(Connection* conn, CordbType* type);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbTypeEnum";
|
||||
}
|
||||
~CordbTypeEnum();
|
||||
virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, ICorDebugType* values[], ULONG* pceltFetched);
|
||||
HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
|
||||
HRESULT STDMETHODCALLTYPE Reset(void);
|
||||
HRESULT STDMETHODCALLTYPE Clone(ICorDebugEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCount(ULONG* pcelt);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,282 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB-VALUE.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_VALUE_H__
|
||||
#define __MONO_DEBUGGER_CORDB_VALUE_H__
|
||||
|
||||
#include <cordb-type.h>
|
||||
#include <cordb.h>
|
||||
|
||||
union CordbContent
|
||||
{
|
||||
int16_t charValue;
|
||||
int8_t booleanValue;
|
||||
int32_t intValue;
|
||||
int64_t longValue;
|
||||
CORDB_ADDRESS pointerValue;
|
||||
};
|
||||
|
||||
class CordbValue : public CordbBaseMono, public ICorDebugValue2, public ICorDebugValue3, public ICorDebugGenericValue
|
||||
{
|
||||
CorElementType m_type;
|
||||
CordbContent m_value;
|
||||
int m_size;
|
||||
CordbType* m_pType;
|
||||
|
||||
public:
|
||||
CordbValue(Connection* conn, CorElementType type, CordbContent value, int size);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbValue";
|
||||
}
|
||||
~CordbValue();
|
||||
HRESULT STDMETHODCALLTYPE GetType(CorElementType* pType);
|
||||
HRESULT STDMETHODCALLTYPE GetSize(ULONG32* pSize);
|
||||
HRESULT STDMETHODCALLTYPE GetAddress(CORDB_ADDRESS* pAddress);
|
||||
HRESULT STDMETHODCALLTYPE CreateBreakpoint(ICorDebugValueBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetExactType(ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetSize64(ULONG64* pSize);
|
||||
HRESULT STDMETHODCALLTYPE GetValue(void* pTo);
|
||||
HRESULT STDMETHODCALLTYPE SetValue(void* pFrom);
|
||||
CordbContent* GetValue() {return &m_value;}
|
||||
};
|
||||
|
||||
class CordbReferenceValue : public CordbBaseMono,
|
||||
public ICorDebugReferenceValue,
|
||||
public ICorDebugValue2,
|
||||
public ICorDebugValue3,
|
||||
public ICorDebugGenericValue
|
||||
{
|
||||
CorElementType m_type;
|
||||
int m_debuggerId;
|
||||
CordbClass* m_pClass;
|
||||
CordbType* m_pCordbType;
|
||||
CORDB_ADDRESS m_pAddress;
|
||||
public:
|
||||
CordbReferenceValue(Connection* conn, CorElementType type, int object_id, CordbClass* klass = NULL, CordbType* cordbType = NULL, CORDB_ADDRESS cordbAddress = NULL);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbReferenceValue";
|
||||
}
|
||||
~CordbReferenceValue();
|
||||
HRESULT STDMETHODCALLTYPE GetType(CorElementType* pType);
|
||||
HRESULT STDMETHODCALLTYPE GetSize(ULONG32* pSize);
|
||||
HRESULT STDMETHODCALLTYPE GetAddress(CORDB_ADDRESS* pAddress);
|
||||
HRESULT STDMETHODCALLTYPE CreateBreakpoint(ICorDebugValueBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetExactType(ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetSize64(ULONG64* pSize);
|
||||
HRESULT STDMETHODCALLTYPE GetValue(void* pTo);
|
||||
HRESULT STDMETHODCALLTYPE SetValue(void* pFrom);
|
||||
HRESULT STDMETHODCALLTYPE IsNull(BOOL* pbNull);
|
||||
HRESULT STDMETHODCALLTYPE GetValue(CORDB_ADDRESS* pValue);
|
||||
HRESULT STDMETHODCALLTYPE SetValue(CORDB_ADDRESS value);
|
||||
HRESULT STDMETHODCALLTYPE Dereference(ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE DereferenceStrong(ICorDebugValue** ppValue);
|
||||
};
|
||||
|
||||
class CordbObjectValue : public CordbBaseMono,
|
||||
public ICorDebugObjectValue,
|
||||
public ICorDebugObjectValue2,
|
||||
public ICorDebugGenericValue,
|
||||
public ICorDebugStringValue,
|
||||
public ICorDebugValue2,
|
||||
public ICorDebugValue3,
|
||||
public ICorDebugHeapValue2,
|
||||
public ICorDebugHeapValue3,
|
||||
public ICorDebugExceptionObjectValue,
|
||||
public ICorDebugComObjectValue,
|
||||
public ICorDebugDelegateObjectValue
|
||||
{
|
||||
CorElementType m_type;
|
||||
int m_debuggerId;
|
||||
CordbClass* m_pClass;
|
||||
CordbType* m_pCordbType;
|
||||
|
||||
public:
|
||||
CordbObjectValue(Connection* conn, CorElementType type, int object_id, CordbClass* klass);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbObjectValue";
|
||||
}
|
||||
~CordbObjectValue();
|
||||
HRESULT STDMETHODCALLTYPE GetClass(ICorDebugClass** ppClass);
|
||||
HRESULT STDMETHODCALLTYPE GetFieldValue(ICorDebugClass* pClass, mdFieldDef fieldDef, ICorDebugValue** ppValue);
|
||||
static HRESULT CreateCordbValue(Connection* conn, MdbgProtBuffer* pReply, ICorDebugValue** ppValue);
|
||||
static int GetTypeSize(int type);
|
||||
HRESULT STDMETHODCALLTYPE GetVirtualMethod(mdMemberRef memberRef, ICorDebugFunction** ppFunction);
|
||||
HRESULT STDMETHODCALLTYPE GetContext(ICorDebugContext** ppContext);
|
||||
HRESULT STDMETHODCALLTYPE IsValueClass(BOOL* pbIsValueClass);
|
||||
HRESULT STDMETHODCALLTYPE GetManagedCopy(IUnknown** ppObject);
|
||||
HRESULT STDMETHODCALLTYPE SetFromManagedCopy(IUnknown* pObject);
|
||||
HRESULT STDMETHODCALLTYPE IsValid(BOOL* pbValid);
|
||||
HRESULT STDMETHODCALLTYPE CreateRelocBreakpoint(ICorDebugValueBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE GetType(CorElementType* pType);
|
||||
HRESULT STDMETHODCALLTYPE GetSize(ULONG32* pSize);
|
||||
HRESULT STDMETHODCALLTYPE GetAddress(CORDB_ADDRESS* pAddress);
|
||||
HRESULT STDMETHODCALLTYPE CreateBreakpoint(ICorDebugValueBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetExactType(ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetSize64(ULONG64* pSize);
|
||||
HRESULT STDMETHODCALLTYPE GetValue(void* pTo);
|
||||
HRESULT STDMETHODCALLTYPE SetValue(void* pFrom);
|
||||
HRESULT STDMETHODCALLTYPE GetVirtualMethodAndType(mdMemberRef memberRef, ICorDebugFunction** ppFunction, ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetLength(ULONG32* pcchString);
|
||||
HRESULT STDMETHODCALLTYPE GetString(ULONG32 cchString, ULONG32* pcchString, WCHAR szString[]);
|
||||
HRESULT STDMETHODCALLTYPE CreateHandle(CorDebugHandleType type, ICorDebugHandleValue** ppHandle);
|
||||
HRESULT STDMETHODCALLTYPE GetThreadOwningMonitorLock(ICorDebugThread** ppThread, DWORD* pAcquisitionCount);
|
||||
HRESULT STDMETHODCALLTYPE GetMonitorEventWaitList(ICorDebugThreadEnum** ppThreadEnum);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateExceptionCallStack(ICorDebugExceptionObjectCallStackEnum** ppCallStackEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCachedInterfaceTypes(BOOL bIInspectableOnly, ICorDebugTypeEnum** ppInterfacesEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCachedInterfacePointers(BOOL bIInspectableOnly,
|
||||
ULONG32 celt,
|
||||
ULONG32* pcEltFetched,
|
||||
CORDB_ADDRESS* ptrs);
|
||||
HRESULT STDMETHODCALLTYPE GetTarget(ICorDebugReferenceValue** ppObject);
|
||||
HRESULT STDMETHODCALLTYPE GetFunction(ICorDebugFunction** ppFunction);
|
||||
};
|
||||
|
||||
class CordbArrayValue : public CordbBaseMono,
|
||||
public ICorDebugObjectValue,
|
||||
public ICorDebugObjectValue2,
|
||||
public ICorDebugGenericValue,
|
||||
public ICorDebugStringValue,
|
||||
public ICorDebugValue2,
|
||||
public ICorDebugValue3,
|
||||
public ICorDebugHeapValue2,
|
||||
public ICorDebugHeapValue3,
|
||||
public ICorDebugExceptionObjectValue,
|
||||
public ICorDebugComObjectValue,
|
||||
public ICorDebugDelegateObjectValue,
|
||||
public ICorDebugArrayValue
|
||||
{
|
||||
CordbType* m_pCordbType;
|
||||
int m_debuggerId;
|
||||
CordbClass* m_pClass;
|
||||
int m_nCount;
|
||||
|
||||
public:
|
||||
CordbArrayValue(Connection* conn, CordbType* type, int object_id, CordbClass* klass);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbArrayValue";
|
||||
}
|
||||
~CordbArrayValue();
|
||||
HRESULT STDMETHODCALLTYPE GetClass(ICorDebugClass** ppClass);
|
||||
HRESULT STDMETHODCALLTYPE GetFieldValue(ICorDebugClass* pClass, mdFieldDef fieldDef, ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetVirtualMethod(mdMemberRef memberRef, ICorDebugFunction** ppFunction);
|
||||
HRESULT STDMETHODCALLTYPE GetContext(ICorDebugContext** ppContext);
|
||||
HRESULT STDMETHODCALLTYPE IsValueClass(BOOL* pbIsValueClass);
|
||||
HRESULT STDMETHODCALLTYPE GetManagedCopy(IUnknown** ppObject);
|
||||
HRESULT STDMETHODCALLTYPE SetFromManagedCopy(IUnknown* pObject);
|
||||
HRESULT STDMETHODCALLTYPE GetType(CorElementType* pType);
|
||||
HRESULT STDMETHODCALLTYPE GetSize(ULONG32* pSize);
|
||||
HRESULT STDMETHODCALLTYPE GetAddress(CORDB_ADDRESS* pAddress);
|
||||
HRESULT STDMETHODCALLTYPE CreateBreakpoint(ICorDebugValueBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetVirtualMethodAndType(mdMemberRef memberRef, ICorDebugFunction** ppFunction, ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetValue(void* pTo);
|
||||
HRESULT STDMETHODCALLTYPE SetValue(void* pFrom);
|
||||
HRESULT STDMETHODCALLTYPE GetLength(ULONG32* pcchString);
|
||||
HRESULT STDMETHODCALLTYPE GetString(ULONG32 cchString, ULONG32* pcchString, WCHAR szString[]);
|
||||
HRESULT STDMETHODCALLTYPE IsValid(BOOL* pbValid);
|
||||
HRESULT STDMETHODCALLTYPE CreateRelocBreakpoint(ICorDebugValueBreakpoint** ppBreakpoint);
|
||||
HRESULT STDMETHODCALLTYPE GetExactType(ICorDebugType** ppType);
|
||||
HRESULT STDMETHODCALLTYPE GetSize64(ULONG64* pSize);
|
||||
HRESULT STDMETHODCALLTYPE CreateHandle(CorDebugHandleType type, ICorDebugHandleValue** ppHandle);
|
||||
HRESULT STDMETHODCALLTYPE GetThreadOwningMonitorLock(ICorDebugThread** ppThread, DWORD* pAcquisitionCount);
|
||||
HRESULT STDMETHODCALLTYPE GetMonitorEventWaitList(ICorDebugThreadEnum** ppThreadEnum);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateExceptionCallStack(ICorDebugExceptionObjectCallStackEnum** ppCallStackEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCachedInterfaceTypes(BOOL bIInspectableOnly, ICorDebugTypeEnum** ppInterfacesEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCachedInterfacePointers(BOOL bIInspectableOnly,
|
||||
ULONG32 celt,
|
||||
ULONG32* pcEltFetched,
|
||||
CORDB_ADDRESS* ptrs);
|
||||
HRESULT STDMETHODCALLTYPE GetTarget(ICorDebugReferenceValue** ppObject);
|
||||
HRESULT STDMETHODCALLTYPE GetFunction(ICorDebugFunction** ppFunction);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetElementType(CorElementType* pType);
|
||||
HRESULT STDMETHODCALLTYPE GetRank(ULONG32* pnRank);
|
||||
HRESULT STDMETHODCALLTYPE GetCount(ULONG32* pnCount);
|
||||
HRESULT STDMETHODCALLTYPE GetDimensions(ULONG32 cdim, ULONG32 dims[]);
|
||||
HRESULT STDMETHODCALLTYPE HasBaseIndicies(BOOL* pbHasBaseIndicies);
|
||||
HRESULT STDMETHODCALLTYPE GetBaseIndicies(ULONG32 cdim, ULONG32 indices[]);
|
||||
HRESULT STDMETHODCALLTYPE GetElement(ULONG32 cdim, ULONG32 indices[], ICorDebugValue** ppValue);
|
||||
HRESULT STDMETHODCALLTYPE GetElementAtPosition(ULONG32 nPosition, ICorDebugValue** ppValue);
|
||||
};
|
||||
|
||||
class CordbValueEnum : public CordbBaseMono,
|
||||
public ICorDebugValueEnum
|
||||
{
|
||||
long m_nThreadDebuggerId;
|
||||
long m_nFrameDebuggerId;
|
||||
int m_nCurrentValuePos;
|
||||
int m_nCount;
|
||||
ILCodeKind m_nFlags;
|
||||
bool m_bIsArgument;
|
||||
ICorDebugValue** m_pValues;
|
||||
public:
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "CordbValueEnum";
|
||||
}
|
||||
|
||||
CordbValueEnum(Connection* conn, long nThreadDebuggerId, long nFrameDebuggerId, bool bIsArgument, ILCodeKind m_nFlags = ILCODE_ORIGINAL_IL);
|
||||
HRESULT STDMETHODCALLTYPE Next(ULONG celt, ICorDebugValue* values[], ULONG* pceltFetched);
|
||||
HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
|
||||
HRESULT STDMETHODCALLTYPE Reset(void);
|
||||
HRESULT STDMETHODCALLTYPE Clone(ICorDebugEnum** ppEnum);
|
||||
HRESULT STDMETHODCALLTYPE GetCount(ULONG* pcelt);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,616 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB.CPP
|
||||
//
|
||||
|
||||
#include <cordb-appdomain.h>
|
||||
#include <cordb-assembly.h>
|
||||
#include <cordb-breakpoint.h>
|
||||
#include <cordb-code.h>
|
||||
#include <cordb-eval.h>
|
||||
#include <cordb-function.h>
|
||||
#include <cordb-process.h>
|
||||
#include <cordb-stepper.h>
|
||||
#include <cordb-thread.h>
|
||||
#include <cordb.h>
|
||||
#include <socket.h>
|
||||
|
||||
#define DEBUG_ADDRESS "127.0.0.1"
|
||||
|
||||
MONO_API HRESULT CoreCLRCreateCordbObjectEx(
|
||||
int iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, HMODULE hmodTargetCLR, void** ppCordb)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "CoreCLRCreateCordbObjectEx\n"));
|
||||
*ppCordb = new Cordb(pid);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void receive_thread(Connection* c)
|
||||
{
|
||||
c->Receive();
|
||||
}
|
||||
|
||||
static void debugger_thread(void* m_pProcess)
|
||||
{
|
||||
Connection* connection = new Connection((CordbProcess*)m_pProcess, ((CordbProcess*)m_pProcess)->GetCordb());
|
||||
((CordbProcess*)m_pProcess)->SetConnection(connection);
|
||||
connection->StartConnection();
|
||||
connection->TransportHandshake();
|
||||
connection->LoopSendReceive();
|
||||
connection->CloseConnection();
|
||||
}
|
||||
|
||||
HRESULT Cordb::Initialize(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Cordb - Initialize - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::Terminate(void)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Cordb - Terminate - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::SetManagedHandler(ICorDebugManagedCallback* pCallback)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "Cordb - SetManagedHandler - IMPLEMENTED\n"));
|
||||
this->m_pCallback = pCallback;
|
||||
this->GetCallback()->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::SetUnmanagedHandler(ICorDebugUnmanagedCallback* pCallback)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Cordb - SetUnmanagedHandler - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::CreateProcess(LPCWSTR lpApplicationName,
|
||||
LPWSTR lpCommandLine,
|
||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
BOOL bInheritHandles,
|
||||
DWORD dwCreationFlags,
|
||||
PVOID lpEnvironment,
|
||||
LPCWSTR lpCurrentDirectory,
|
||||
LPSTARTUPINFOW lpStartupInfo,
|
||||
LPPROCESS_INFORMATION lpProcessInformation,
|
||||
CorDebugCreateProcessFlags debuggingFlags,
|
||||
ICorDebugProcess** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Cordb - CreateProcess - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::DebugActiveProcess(DWORD id, BOOL win32Attach, ICorDebugProcess** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO1000000, "Cordb - DebugActiveProcess - IMPLEMENTED\n"));
|
||||
m_pProcess = new CordbProcess(this);
|
||||
m_pProcess->InternalAddRef();
|
||||
m_pProcess->QueryInterface(IID_ICorDebugProcess, (void**)ppProcess);
|
||||
|
||||
DWORD thread_id;
|
||||
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)debugger_thread, m_pProcess, 0, &thread_id);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::EnumerateProcesses(ICorDebugProcessEnum** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Cordb - EnumerateProcesses - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::GetProcess(DWORD dwProcessId, ICorDebugProcess** ppProcess)
|
||||
{
|
||||
m_pProcess->QueryInterface(IID_ICorDebugProcess, (void**)ppProcess);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::CanLaunchOrAttach(DWORD dwProcessId, BOOL win32DebuggingEnabled)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Cordb - CanLaunchOrAttach - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Cordb::Cordb(DWORD PID) : CordbBaseMono(NULL)
|
||||
{
|
||||
m_pCallback = NULL;
|
||||
m_pSemReadWrite = new UTSemReadWrite();
|
||||
m_nPID = PID;
|
||||
|
||||
#ifndef TARGET_WINDOWS
|
||||
PAL_InitializeDLL();
|
||||
#endif
|
||||
|
||||
#ifdef LOGGING
|
||||
InitializeLogging();
|
||||
#endif
|
||||
}
|
||||
|
||||
Cordb::~Cordb()
|
||||
{
|
||||
this->GetCallback()->Release();
|
||||
m_pProcess->InternalRelease();
|
||||
delete m_pSemReadWrite;
|
||||
#ifdef LOGGING
|
||||
ShutdownLogging();
|
||||
#endif
|
||||
}
|
||||
|
||||
HRESULT
|
||||
Cordb::QueryInterface(REFIID id, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* pInterface)
|
||||
{
|
||||
if (id == IID_ICorDebug)
|
||||
*pInterface = static_cast<ICorDebug*>(this);
|
||||
else if (id == IID_IUnknown)
|
||||
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebug*>(this));
|
||||
else
|
||||
{
|
||||
*pInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::CreateProcessEx(ICorDebugRemoteTarget* pRemoteTarget,
|
||||
LPCWSTR lpApplicationName,
|
||||
_In_ LPWSTR lpCommandLine,
|
||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
BOOL bInheritHandles,
|
||||
DWORD dwCreationFlags,
|
||||
PVOID lpEnvironment,
|
||||
LPCWSTR lpCurrentDirectory,
|
||||
LPSTARTUPINFOW lpStartupInfo,
|
||||
LPPROCESS_INFORMATION lpProcessInformation,
|
||||
CorDebugCreateProcessFlags debuggingFlags,
|
||||
ICorDebugProcess** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Cordb - CreateProcessEx - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Cordb::DebugActiveProcessEx(ICorDebugRemoteTarget* pRemoteTarget,
|
||||
DWORD dwProcessId,
|
||||
BOOL fWin32Attach,
|
||||
ICorDebugProcess** ppProcess)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Cordb - DebugActiveProcessEx - NOT IMPLEMENTED\n"));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ReceivedReplyPacket::ReceivedReplyPacket(int error, int error_2, int id, MdbgProtBuffer* buf)
|
||||
{
|
||||
this->error = error;
|
||||
this->error_2 = error_2;
|
||||
this->id = id;
|
||||
this->buf = buf;
|
||||
}
|
||||
|
||||
ReceivedReplyPacket::~ReceivedReplyPacket()
|
||||
{
|
||||
if (buf)
|
||||
{
|
||||
m_dbgprot_buffer_free(buf);
|
||||
delete buf;
|
||||
}
|
||||
}
|
||||
|
||||
Connection::Connection(CordbProcess* proc, Cordb* cordb)
|
||||
{
|
||||
m_pProcess = proc;
|
||||
m_pCordb = cordb;
|
||||
m_pReceiveReplies = new ArrayList();
|
||||
m_pReceivedPacketsToProcess = new ArrayList();
|
||||
}
|
||||
|
||||
Connection::~Connection()
|
||||
{
|
||||
DWORD i = 0;
|
||||
while (i < m_pReceiveReplies->GetCount())
|
||||
{
|
||||
ReceivedReplyPacket* rrp = (ReceivedReplyPacket*)m_pReceiveReplies->Get(i);
|
||||
if (rrp)
|
||||
{
|
||||
delete rrp;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
while (i < m_pReceivedPacketsToProcess->GetCount())
|
||||
{
|
||||
MdbgProtBuffer* buf = (MdbgProtBuffer*)m_pReceivedPacketsToProcess->Get(i);
|
||||
if (buf)
|
||||
{
|
||||
m_dbgprot_buffer_free(buf);
|
||||
delete buf;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
delete m_socket;
|
||||
delete m_pReceiveReplies;
|
||||
delete m_pReceivedPacketsToProcess;
|
||||
}
|
||||
|
||||
void Connection::Receive()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
MdbgProtBuffer recvbuf_header;
|
||||
m_dbgprot_buffer_init(&recvbuf_header, HEADER_LENGTH);
|
||||
|
||||
int iResult = m_socket->Receive((char*)recvbuf_header.buf, HEADER_LENGTH);
|
||||
|
||||
if (iResult == -1)
|
||||
{
|
||||
m_dbgprot_buffer_free(&recvbuf_header);
|
||||
m_pCordb->GetCallback()->ExitProcess(static_cast<ICorDebugProcess*>(GetProcess()));
|
||||
break;
|
||||
}
|
||||
while (iResult == 0)
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "transport_recv () sleep returned %d, expected %d.\n", iResult,
|
||||
HEADER_LENGTH));
|
||||
iResult = m_socket->Receive((char*)recvbuf_header.buf, HEADER_LENGTH);
|
||||
Sleep(1000);
|
||||
}
|
||||
|
||||
MdbgProtHeader header;
|
||||
m_dbgprot_decode_command_header(&recvbuf_header, &header);
|
||||
m_dbgprot_buffer_free(&recvbuf_header);
|
||||
if (header.len < HEADER_LENGTH)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MdbgProtBuffer* recvbuf = new MdbgProtBuffer();
|
||||
m_dbgprot_buffer_init(recvbuf, header.len - HEADER_LENGTH);
|
||||
if (header.len - HEADER_LENGTH != 0)
|
||||
{
|
||||
iResult = m_socket->Receive((char*)recvbuf->p, header.len - HEADER_LENGTH);
|
||||
int totalRead = iResult;
|
||||
while (totalRead < header.len - HEADER_LENGTH)
|
||||
{
|
||||
iResult = m_socket->Receive((char*)recvbuf->p + totalRead, (header.len - HEADER_LENGTH) - totalRead);
|
||||
totalRead += iResult;
|
||||
}
|
||||
}
|
||||
|
||||
dbg_lock();
|
||||
if (header.flags == REPLY_PACKET)
|
||||
{
|
||||
ReceivedReplyPacket* rp = new ReceivedReplyPacket(header.error, header.error_2, header.id, recvbuf);
|
||||
m_pReceiveReplies->Append(rp);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pReceivedPacketsToProcess->Append(recvbuf);
|
||||
}
|
||||
dbg_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
ReceivedReplyPacket* Connection::GetReplyWithError(int cmdId)
|
||||
{
|
||||
ReceivedReplyPacket* rrp = NULL;
|
||||
while (rrp == NULL || rrp->Id() != cmdId)
|
||||
{
|
||||
dbg_lock();
|
||||
for (int i = m_pReceiveReplies->GetCount() - 1; i >= 0; i--)
|
||||
{
|
||||
rrp = (ReceivedReplyPacket*)m_pReceiveReplies->Get(i);
|
||||
if (rrp->Id() == cmdId)
|
||||
break;
|
||||
}
|
||||
dbg_unlock();
|
||||
}
|
||||
return rrp;
|
||||
}
|
||||
|
||||
CordbAppDomain* Connection::GetCurrentAppDomain()
|
||||
{
|
||||
return GetProcess()->GetCurrentAppDomain();
|
||||
}
|
||||
|
||||
void Connection::ProcessPacketInternal(MdbgProtBuffer* recvbuf)
|
||||
{
|
||||
int spolicy = m_dbgprot_decode_byte(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
int nevents = m_dbgprot_decode_int(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
CordbAppDomain* pCorDebugAppDomain = GetCurrentAppDomain();
|
||||
for (int i = 0; i < nevents; ++i)
|
||||
{
|
||||
|
||||
int kind = m_dbgprot_decode_byte(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
int req_id = m_dbgprot_decode_int(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
|
||||
MdbgProtEventKind etype = (MdbgProtEventKind)kind;
|
||||
|
||||
long thread_id = m_dbgprot_decode_id(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
|
||||
LOG((LF_CORDB, LL_INFO100000, "Received %d %d events %s, suspend=%d\n", i, nevents,
|
||||
m_dbgprot_event_to_string(etype), spolicy));
|
||||
|
||||
switch (etype)
|
||||
{
|
||||
case MDBGPROT_EVENT_KIND_VM_START:
|
||||
{
|
||||
m_pCordb->GetCallback()->CreateProcess(static_cast<ICorDebugProcess*>(GetProcess()));
|
||||
}
|
||||
break;
|
||||
case MDBGPROT_EVENT_KIND_VM_DEATH:
|
||||
{
|
||||
m_pCordb->GetCallback()->ExitProcess(static_cast<ICorDebugProcess*>(GetProcess()));
|
||||
}
|
||||
break;
|
||||
case MDBGPROT_EVENT_KIND_THREAD_START:
|
||||
{
|
||||
CordbThread* thread = new CordbThread(this, GetProcess(), thread_id);
|
||||
m_pCordb->GetCallback()->CreateThread(pCorDebugAppDomain, thread);
|
||||
}
|
||||
break;
|
||||
case MDBGPROT_EVENT_KIND_APPDOMAIN_CREATE:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case MDBGPROT_EVENT_KIND_ASSEMBLY_LOAD:
|
||||
{
|
||||
// all the callbacks call a resume, in this case that we are faking 2
|
||||
// callbacks without receive command, we should not send the continue
|
||||
int assembly_id = m_dbgprot_decode_id(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
if (pCorDebugAppDomain == NULL)
|
||||
{
|
||||
pCorDebugAppDomain = new CordbAppDomain(this, GetProcess());
|
||||
GetProcess()->Stop(false);
|
||||
m_pCordb->GetCallback()->CreateAppDomain(static_cast<ICorDebugProcess*>(GetProcess()),
|
||||
pCorDebugAppDomain);
|
||||
}
|
||||
CordbAssembly* pAssembly = new CordbAssembly(this, GetProcess(), pCorDebugAppDomain, assembly_id);
|
||||
CordbModule* pModule = new CordbModule(this, GetProcess(), (CordbAssembly*)pAssembly, assembly_id);
|
||||
|
||||
GetProcess()->Stop(false);
|
||||
m_pCordb->GetCallback()->LoadAssembly(pCorDebugAppDomain, pAssembly);
|
||||
|
||||
m_pCordb->GetCallback()->LoadModule(pCorDebugAppDomain, pModule);
|
||||
}
|
||||
break;
|
||||
case MDBGPROT_EVENT_KIND_BREAKPOINT:
|
||||
{
|
||||
int method_id = m_dbgprot_decode_id(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
int64_t offset = m_dbgprot_decode_long(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
CordbThread* thread = GetProcess()->FindThread(thread_id);
|
||||
if (thread == NULL)
|
||||
{
|
||||
thread = new CordbThread(this, GetProcess(), thread_id);
|
||||
GetProcess()->Stop(false);
|
||||
m_pCordb->GetCallback()->CreateThread(pCorDebugAppDomain, thread);
|
||||
}
|
||||
DWORD i = 0;
|
||||
CordbFunctionBreakpoint* breakpoint = GetProcess()->GetBreakpoint(req_id);
|
||||
m_pCordb->GetCallback()->Breakpoint(pCorDebugAppDomain, thread,
|
||||
static_cast<ICorDebugFunctionBreakpoint*>(breakpoint));
|
||||
}
|
||||
break;
|
||||
case MDBGPROT_EVENT_KIND_STEP:
|
||||
{
|
||||
int method_id = m_dbgprot_decode_id(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
int64_t offset = m_dbgprot_decode_long(recvbuf->p, &recvbuf->p, recvbuf->end);
|
||||
CordbThread* thread = GetProcess()->FindThread(thread_id);
|
||||
if (thread == NULL)
|
||||
{
|
||||
thread = new CordbThread(this, GetProcess(), thread_id);
|
||||
GetProcess()->Stop(false);
|
||||
m_pCordb->GetCallback()->CreateThread(pCorDebugAppDomain, thread);
|
||||
}
|
||||
CordbStepper* stepper = GetProcess()->GetStepper(req_id);
|
||||
stepper->Deactivate();
|
||||
m_pCordb->GetCallback()->StepComplete(pCorDebugAppDomain, thread, stepper, STEP_NORMAL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Not implemented - %s\n", m_dbgprot_event_to_string(etype)));
|
||||
}
|
||||
}
|
||||
}
|
||||
// m_dbgprot_buffer_free(&recvbuf);
|
||||
}
|
||||
|
||||
int Connection::ProcessPacket(bool is_answer)
|
||||
{
|
||||
if (!is_answer)
|
||||
ProcessPacketFromQueue();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Connection::ProcessPacketFromQueue()
|
||||
{
|
||||
DWORD i = 0;
|
||||
while (i < m_pReceivedPacketsToProcess->GetCount())
|
||||
{
|
||||
MdbgProtBuffer* req = (MdbgProtBuffer*)m_pReceivedPacketsToProcess->Get(i);
|
||||
if (req)
|
||||
{
|
||||
ProcessPacketInternal(req);
|
||||
dbg_lock();
|
||||
m_pReceivedPacketsToProcess->Set(i, NULL);
|
||||
dbg_unlock();
|
||||
m_dbgprot_buffer_free(req);
|
||||
delete req;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
GetProcess()->CheckPendingEval();
|
||||
}
|
||||
|
||||
void Connection::LoopSendReceive()
|
||||
{
|
||||
DWORD thread_id;
|
||||
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)receive_thread, this, 0, &thread_id);
|
||||
|
||||
EnableEvent(MDBGPROT_EVENT_KIND_ASSEMBLY_LOAD);
|
||||
EnableEvent(MDBGPROT_EVENT_KIND_APPDOMAIN_CREATE);
|
||||
EnableEvent(MDBGPROT_EVENT_KIND_THREAD_START);
|
||||
EnableEvent(MDBGPROT_EVENT_KIND_THREAD_DEATH);
|
||||
EnableEvent(MDBGPROT_EVENT_KIND_APPDOMAIN_UNLOAD);
|
||||
EnableEvent(MDBGPROT_EVENT_KIND_USER_BREAK);
|
||||
EnableEvent(MDBGPROT_EVENT_KIND_USER_LOG);
|
||||
EnableEvent(MDBGPROT_EVENT_KIND_VM_DEATH);
|
||||
|
||||
MdbgProtBuffer localbuf;
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
m_dbgprot_buffer_add_int(&localbuf, MAJOR_VERSION);
|
||||
m_dbgprot_buffer_add_int(&localbuf, MINOR_VERSION);
|
||||
m_dbgprot_buffer_add_byte(&localbuf, true);
|
||||
int cmdId = SendEvent(MDBGPROT_CMD_SET_VM, MDBGPROT_CMD_VM_SET_PROTOCOL_VERSION, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
m_dbgprot_buffer_init(&localbuf, 128);
|
||||
cmdId = SendEvent(MDBGPROT_CMD_SET_VM, MDBGPROT_CMD_VM_VERSION, &localbuf);
|
||||
m_dbgprot_buffer_free(&localbuf);
|
||||
|
||||
ReceivedReplyPacket* received_reply_packet = GetReplyWithError(cmdId);
|
||||
MdbgProtBuffer* pReply = received_reply_packet->Buffer();
|
||||
|
||||
char* vm_version = m_dbgprot_decode_string(pReply->p, &pReply->p, pReply->end);
|
||||
int major_version = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
int minor_version = m_dbgprot_decode_int(pReply->p, &pReply->p, pReply->end);
|
||||
|
||||
LOG((LF_CORDB, LL_INFO100000, "Protocol version %d.%d, server protocol version %d.%d.\n", MAJOR_VERSION,
|
||||
MINOR_VERSION, major_version, minor_version));
|
||||
free(vm_version);
|
||||
|
||||
int iResult = 0;
|
||||
// Receive until the peer closes the connection
|
||||
do
|
||||
{
|
||||
iResult = ProcessPacket();
|
||||
Sleep(100);
|
||||
} while (iResult >= 0);
|
||||
}
|
||||
|
||||
void Connection::EnableEvent(MdbgProtEventKind eventKind)
|
||||
{
|
||||
MdbgProtBuffer sendbuf;
|
||||
int buflen = 128;
|
||||
m_dbgprot_buffer_init(&sendbuf, buflen);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, eventKind);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, MDBGPROT_SUSPEND_POLICY_ALL);
|
||||
m_dbgprot_buffer_add_byte(&sendbuf, 0); // modifiers
|
||||
SendEvent(MDBGPROT_CMD_SET_EVENT_REQUEST, MDBGPROT_CMD_EVENT_REQUEST_SET, &sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
}
|
||||
|
||||
void Connection::CloseConnection()
|
||||
{
|
||||
m_socket->Close();
|
||||
}
|
||||
|
||||
void Connection::StartConnection()
|
||||
{
|
||||
LOG((LF_CORDB, LL_INFO100000, "Start Connection\n"));
|
||||
|
||||
m_socket = new Socket();
|
||||
int port = 56000 + (m_pCordb->PID() % 1000);
|
||||
char* s_port = new char[10];
|
||||
sprintf_s(s_port, 10, "%d", port);
|
||||
LOG((LF_CORDB, LL_INFO100000, "Listening to %s:%s\n", DEBUG_ADDRESS, s_port));
|
||||
|
||||
int ret = m_socket->OpenSocketAcceptConnection(DEBUG_ADDRESS, s_port);
|
||||
delete[] s_port;
|
||||
if (ret == -1)
|
||||
exit(1);
|
||||
|
||||
LOG((LF_CORDB, LL_INFO100000, "Accepted connection from client.\n"));
|
||||
}
|
||||
|
||||
void Connection::TransportHandshake()
|
||||
{
|
||||
int buflen = 128;
|
||||
|
||||
MdbgProtBuffer sendbuf;
|
||||
m_dbgprot_buffer_init(&sendbuf, buflen);
|
||||
|
||||
MdbgProtBuffer recvbuf;
|
||||
m_dbgprot_buffer_init(&recvbuf, buflen);
|
||||
|
||||
int iResult;
|
||||
iResult = m_socket->Receive((char*)recvbuf.buf, buflen);
|
||||
|
||||
// Send an initial buffer
|
||||
m_dbgprot_buffer_add_data(&sendbuf, (uint8_t*)"DWP-Handshake", 13);
|
||||
SendPacket(sendbuf);
|
||||
m_dbgprot_buffer_free(&sendbuf);
|
||||
m_dbgprot_buffer_free(&recvbuf);
|
||||
}
|
||||
|
||||
void Connection::SendPacket(MdbgProtBuffer& sendbuf)
|
||||
{
|
||||
int iResult = m_socket->Send((const char*)sendbuf.buf, m_dbgprot_buffer_len(&sendbuf));
|
||||
if (iResult == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int Connection::SendEvent(int cmd_set, int cmd, MdbgProtBuffer* sendbuf)
|
||||
{
|
||||
MdbgProtBuffer outbuf;
|
||||
int ret = m_dbgprot_buffer_add_command_header(sendbuf, cmd_set, cmd, &outbuf);
|
||||
SendPacket(outbuf);
|
||||
m_dbgprot_buffer_free(&outbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
MONO_API HRESULT CoreCLRCreateCordbObject(int iDebuggerVersion, DWORD pid, HMODULE hmodTargetCLR, void** ppCordb)
|
||||
{
|
||||
*ppCordb = new Cordb(pid);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MONO_API HRESULT CreateCordbObject(int iDebuggerVersion, void** ppCordb)
|
||||
{
|
||||
*ppCordb = new Cordb(0);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CordbBaseMono::CordbBaseMono(Connection* conn)
|
||||
{
|
||||
this->conn = conn;
|
||||
m_cRef = 0;
|
||||
}
|
||||
|
||||
CordbBaseMono::~CordbBaseMono() {}
|
||||
|
||||
ULONG CordbBaseMono::InternalAddRef()
|
||||
{
|
||||
return BaseAddRef();
|
||||
}
|
||||
|
||||
ULONG CordbBaseMono::InternalRelease()
|
||||
{
|
||||
return BaseRelease();
|
||||
}
|
||||
|
||||
ULONG CordbBaseMono::BaseAddRef()
|
||||
{
|
||||
return InterlockedIncrement((volatile LONG*)&m_cRef);
|
||||
}
|
||||
|
||||
ULONG CordbBaseMono::BaseRelease()
|
||||
{
|
||||
ULONG cRef = InterlockedDecrement((volatile LONG*)&m_cRef);
|
||||
if (cRef == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
return cRef;
|
||||
}
|
||||
|
||||
void CordbBaseMono::SetConnection(Connection* conn)
|
||||
{
|
||||
this->conn = conn;
|
||||
}
|
|
@ -1,263 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: CORDB.H
|
||||
//
|
||||
|
||||
#ifndef __MONO_DEBUGGER_CORDB_H__
|
||||
#define __MONO_DEBUGGER_CORDB_H__
|
||||
|
||||
#include "cor.h"
|
||||
#include "cordebug.h"
|
||||
#include "corhdr.h"
|
||||
#include "xcordebug.h"
|
||||
|
||||
#include <mono/component/debugger-protocol.h>
|
||||
#include <mono/utils/mono-publib.h>
|
||||
|
||||
#include "arraylist.h"
|
||||
#include "utsem.h"
|
||||
#include "ex.h"
|
||||
#include "log.h"
|
||||
|
||||
#ifdef HOST_WIN32
|
||||
#include <windows.h>
|
||||
#include <ws2tcpip.h>
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#else
|
||||
#define DIR_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
#define return_if_nok(error) \
|
||||
do \
|
||||
{ \
|
||||
if (!is_ok((error))) \
|
||||
return S_FALSE; \
|
||||
} while (0)
|
||||
|
||||
static UTSemReadWrite* m_pSemReadWrite;
|
||||
|
||||
#define dbg_lock() m_pSemReadWrite->LockRead();
|
||||
#define dbg_unlock() m_pSemReadWrite->UnlockRead();
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define LOGGING
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_AMD64
|
||||
#define POS_RSP 0x98
|
||||
#else
|
||||
#define POS_RSP 0 //TODO fix for other platforms
|
||||
#endif
|
||||
|
||||
|
||||
#define CreateProcess CreateProcessW
|
||||
|
||||
class Socket;
|
||||
class Cordb;
|
||||
class CordbProcess;
|
||||
class CordbAppDomain;
|
||||
class CordbAssembly;
|
||||
class CordbModule;
|
||||
class CordbCode;
|
||||
class CordbThread;
|
||||
class CordbFunction;
|
||||
class CordbStepper;
|
||||
class RegMeta;
|
||||
class CordbRegisterSet;
|
||||
class CordbClass;
|
||||
class CordbNativeFrame;
|
||||
class CordbAppDomainEnum;
|
||||
class CordbTypeEnum;
|
||||
class CordbBlockingObjectEnum;
|
||||
class CordbFunctionBreakpoint;
|
||||
class CordbEval;
|
||||
class CordbType;
|
||||
class CordbStackWalk;
|
||||
|
||||
enum CordbTypeKind {
|
||||
CordbTypeKindSimpleType,
|
||||
CordbTypeKindClassType,
|
||||
CordbTypeKindArrayType,
|
||||
CordbTypeKindTotal
|
||||
};
|
||||
|
||||
class ReceivedReplyPacket
|
||||
{
|
||||
int error;
|
||||
int error_2;
|
||||
int id;
|
||||
MdbgProtBuffer* buf;
|
||||
|
||||
public:
|
||||
ReceivedReplyPacket(int error, int error_2, int id, MdbgProtBuffer* buf);
|
||||
~ReceivedReplyPacket();
|
||||
MdbgProtBuffer* Buffer()
|
||||
{
|
||||
return buf;
|
||||
}
|
||||
int Error()
|
||||
{
|
||||
return error;
|
||||
}
|
||||
int Error2()
|
||||
{
|
||||
return error_2;
|
||||
}
|
||||
int Id()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
};
|
||||
|
||||
class Connection
|
||||
{
|
||||
Socket* m_socket;
|
||||
CordbProcess* m_pProcess;
|
||||
Cordb* m_pCordb;
|
||||
ArrayList* m_pReceiveReplies; // TODO use hashmap
|
||||
ArrayList* m_pReceivedPacketsToProcess;
|
||||
|
||||
void ProcessPacketInternal(MdbgProtBuffer* recvbuf);
|
||||
void ProcessPacketFromQueue();
|
||||
void EnableEvent(MdbgProtEventKind eventKind);
|
||||
void SendPacket(MdbgProtBuffer& sendbuf);
|
||||
int ProcessPacket(bool is_answer = false);
|
||||
|
||||
public:
|
||||
CordbProcess* GetProcess() const
|
||||
{
|
||||
return m_pProcess;
|
||||
}
|
||||
Cordb* GetCordb() const
|
||||
{
|
||||
return m_pCordb;
|
||||
}
|
||||
Connection(CordbProcess* proc, Cordb* cordb);
|
||||
~Connection();
|
||||
|
||||
void LoopSendReceive();
|
||||
void CloseConnection();
|
||||
void StartConnection();
|
||||
void TransportHandshake();
|
||||
void Receive();
|
||||
|
||||
int SendEvent(int cmd_set, int cmd, MdbgProtBuffer* sendbuf);
|
||||
ReceivedReplyPacket* GetReplyWithError(int cmdId);
|
||||
CordbAppDomain* GetCurrentAppDomain();
|
||||
};
|
||||
|
||||
class CordbBaseMono
|
||||
{
|
||||
protected:
|
||||
Connection* conn;
|
||||
ULONG m_cRef; // Ref count.
|
||||
public:
|
||||
CordbBaseMono(Connection* conn);
|
||||
virtual ~CordbBaseMono();
|
||||
void SetConnection(Connection* conn);
|
||||
ULONG BaseAddRef(void);
|
||||
ULONG BaseRelease(void);
|
||||
ULONG InternalAddRef(void);
|
||||
ULONG InternalRelease(void);
|
||||
virtual const char* GetClassName()
|
||||
{
|
||||
return "CordbBaseMono";
|
||||
}
|
||||
};
|
||||
|
||||
class Cordb : public ICorDebug, public ICorDebugRemote, public CordbBaseMono
|
||||
{
|
||||
ICorDebugManagedCallback* m_pCallback;
|
||||
CordbProcess* m_pProcess;
|
||||
DWORD m_nPID;
|
||||
public:
|
||||
DWORD PID()
|
||||
{
|
||||
return m_nPID;
|
||||
}
|
||||
ICorDebugManagedCallback* GetCallback() const
|
||||
{
|
||||
return m_pCallback;
|
||||
}
|
||||
Cordb(DWORD pid);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void)
|
||||
{
|
||||
return (BaseAddRef());
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release(void)
|
||||
{
|
||||
return (BaseRelease());
|
||||
}
|
||||
const char* GetClassName()
|
||||
{
|
||||
return "Cordb";
|
||||
}
|
||||
~Cordb();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Initialize(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Terminate(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetManagedHandler(ICorDebugManagedCallback* pCallback);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetUnmanagedHandler(ICorDebugUnmanagedCallback* pCallback);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateProcess(LPCWSTR lpApplicationName,
|
||||
LPWSTR lpCommandLine,
|
||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
BOOL bInheritHandles,
|
||||
DWORD dwCreationFlags,
|
||||
PVOID lpEnvironment,
|
||||
LPCWSTR lpCurrentDirectory,
|
||||
LPSTARTUPINFOW lpStartupInfo,
|
||||
LPPROCESS_INFORMATION lpProcessInformation,
|
||||
CorDebugCreateProcessFlags debuggingFlags,
|
||||
ICorDebugProcess** ppProcess);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DebugActiveProcess(DWORD id, BOOL win32Attach, ICorDebugProcess** ppProcess);
|
||||
HRESULT STDMETHODCALLTYPE EnumerateProcesses(ICorDebugProcessEnum** ppProcess);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetProcess(DWORD dwProcessId, ICorDebugProcess** ppProcess);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CanLaunchOrAttach(DWORD dwProcessId, BOOL win32DebuggingEnabled);
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, _COM_Outptr_ void __RPC_FAR* __RPC_FAR* ppvObject);
|
||||
HRESULT STDMETHODCALLTYPE CreateProcessEx(ICorDebugRemoteTarget* pRemoteTarget,
|
||||
LPCWSTR lpApplicationName,
|
||||
_In_ LPWSTR lpCommandLine,
|
||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
BOOL bInheritHandles,
|
||||
DWORD dwCreationFlags,
|
||||
PVOID lpEnvironment,
|
||||
LPCWSTR lpCurrentDirectory,
|
||||
LPSTARTUPINFOW lpStartupInfo,
|
||||
LPPROCESS_INFORMATION lpProcessInformation,
|
||||
CorDebugCreateProcessFlags debuggingFlags,
|
||||
ICorDebugProcess** ppProcess);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DebugActiveProcessEx(ICorDebugRemoteTarget* pRemoteTarget,
|
||||
DWORD dwProcessId,
|
||||
BOOL fWin32Attach,
|
||||
ICorDebugProcess** ppProcess);
|
||||
};
|
||||
|
||||
#define CHECK_ERROR_RETURN_FALSE(localbuf) \
|
||||
do \
|
||||
{ \
|
||||
if (localbuf->Error() > 0 || localbuf->Error2() > 0) \
|
||||
{\
|
||||
if (localbuf->Buffer()->end > localbuf->Buffer()->p) {\
|
||||
char *error_msg = m_dbgprot_decode_string(localbuf->Buffer()->p, &localbuf->Buffer()->p, localbuf->Buffer()->end); \
|
||||
LOG((LF_CORDB, LL_INFO100000, "ERROR RECEIVED - %s\n", error_msg)); \
|
||||
free(error_msg); \
|
||||
}\
|
||||
else {\
|
||||
LOG((LF_CORDB, LL_INFO100000, "ERROR RECEIVED - %d - %d\n", localbuf->Error(), localbuf->Error2())); \
|
||||
}\
|
||||
EX_THROW(HRException, (E_FAIL)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
|
@ -1,22 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: DEBUGGER-CORECLR-COMPAT.H
|
||||
//
|
||||
|
||||
#ifndef __DBG_CORECLR_MONO_COMPAT_H__
|
||||
#define __DBG_CORECLR_MONO_COMPAT_H__
|
||||
|
||||
#define g_malloc malloc
|
||||
#define g_free free
|
||||
#define g_assert assert
|
||||
#define g_realloc realloc
|
||||
#include "stdafx.h"
|
||||
|
||||
static inline int32_t dbg_rt_atomic_inc_int32_t(volatile int32_t* value)
|
||||
{
|
||||
STATIC_CONTRACT_NOTHROW;
|
||||
return static_cast<int32_t>(InterlockedIncrement((volatile LONG*)(value)));
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,10 +0,0 @@
|
|||
project(socket-dbi)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(socket_sources
|
||||
socket.cpp
|
||||
socket.h
|
||||
)
|
||||
|
||||
add_library(socket-dbi STATIC ${socket_sources})
|
|
@ -1,116 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: SOCKET.CPP
|
||||
//
|
||||
|
||||
#include "socket.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <net/if.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
#include <sys/un.h>
|
||||
#if defined(__APPLE__)
|
||||
#include <sys/socketvar.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#define INVALID_SOCKET -1
|
||||
#define SOCKET_ERROR -1
|
||||
#endif
|
||||
|
||||
Socket::~Socket()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
int Socket::OpenSocketAcceptConnection(const char *address, const char *port) {
|
||||
socketId = INVALID_SOCKET;
|
||||
|
||||
#ifdef WIN32
|
||||
WSADATA wsadata;
|
||||
int err;
|
||||
|
||||
err = WSAStartup (2, &wsadata);
|
||||
if (err) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct addrinfo *result = NULL, *ptr = NULL, hints;
|
||||
int iResult;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
// Resolve the server address and port
|
||||
iResult = getaddrinfo(address, port, &hints, &result);
|
||||
if (iResult != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Attempt to connect to an address until one succeeds
|
||||
for (ptr = result; ptr != NULL; ptr = ptr->ai_next) {
|
||||
|
||||
// Create a SOCKET for connecting to server
|
||||
socketId = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
|
||||
|
||||
if (socketId == INVALID_SOCKET) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int flag = 1;
|
||||
if (setsockopt(socketId, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof(int)))
|
||||
continue;
|
||||
|
||||
iResult = bind(socketId, ptr->ai_addr, (int)ptr->ai_addrlen);
|
||||
if (iResult == SOCKET_ERROR)
|
||||
continue;
|
||||
|
||||
iResult = listen(socketId, 16);
|
||||
if (iResult == SOCKET_ERROR)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (iResult != SOCKET_ERROR)
|
||||
socketId = accept(socketId, NULL, NULL);
|
||||
|
||||
freeaddrinfo(result);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Socket::Receive(char *buff, int buflen) {
|
||||
return recv(socketId, buff, buflen, 0);
|
||||
}
|
||||
|
||||
void Socket::Close() {
|
||||
#ifdef WIN32
|
||||
closesocket (socketId);
|
||||
#else
|
||||
close (socketId);
|
||||
#endif
|
||||
}
|
||||
|
||||
int Socket::Send(const char *buff, int buflen) {
|
||||
return send(socketId, buff, buflen, 0);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
//
|
||||
// File: SOCKET.H
|
||||
//
|
||||
|
||||
#ifndef __SOCKET_DBI_H__
|
||||
#define __SOCKET_DBI_H__
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
class Socket {
|
||||
#ifdef WIN32
|
||||
SOCKET socketId;
|
||||
#else
|
||||
long long socketId;
|
||||
#endif
|
||||
|
||||
public:
|
||||
~Socket();
|
||||
int OpenSocketAcceptConnection(const char *address, const char *port);
|
||||
void Close();
|
||||
int Receive(char *buff, int buflen);
|
||||
int Send(const char *buff, int buflen);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -705,11 +705,6 @@ JS_ENGINES = [NODE_JS]
|
|||
<_MonoCXXFLAGS Condition="'$(Platform)' == 'arm'" Include="-march=armv7-a" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Devloop features -->
|
||||
<ItemGroup Condition="'$(MonoMsCorDbi)' == 'true'">
|
||||
<_MonoCMakeArgs Include="-DENABLE_MSCORDBI=1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'">
|
||||
<_MonoCMakeArgs Include="-DFEATURE_PERFTRACING_PAL_TCP=1"/>
|
||||
<_MonoCMakeArgs Include="-DFEATURE_PERFTRACING_DISABLE_DEFAULT_LISTEN_PORT=1"/>
|
||||
|
@ -1225,9 +1220,6 @@ JS_ENGINES = [NODE_JS]
|
|||
<_MonoRuntimeArtifacts Condition="('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true') and '$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(MonoObjDir)_deps\fetchzlibng-build\libz.a">
|
||||
<Destination>$(RuntimeBinDir)libz.a</Destination>
|
||||
</_MonoRuntimeArtifacts>
|
||||
<_MonoICorDebugArtifacts Condition="'$(MonoMsCorDbi)' == 'true'" Include="$(MonoObjDir)out\lib\$(LibPrefix)mscordbi$(LibSuffix)">
|
||||
<Destination>$(RuntimeBinDir)$(LibPrefix)mscordbi$(LibSuffix)</Destination>
|
||||
</_MonoICorDebugArtifacts>
|
||||
</ItemGroup>
|
||||
|
||||
<Copy SourceFiles="@(_MonoRuntimeArtifacts)"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue