Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WP command to list interop native assemblies #710

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/CLR/Debugger/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2760,6 +2760,43 @@ bool CLR_DBG_Debugger::Debugging_Value_Assign( WP_Message* msg)

//--//

bool CLR_DBG_Debugger::Debugging_TypeSys_InteropNativeAssemblies( WP_Message* msg)
{
NATIVE_PROFILE_CLR_DEBUGGER();

extern const CLR_RT_NativeAssemblyData *g_CLR_InteropAssembliesNativeData[];

int nativeAssembliesCount = 0;
NativeAssembly_Details* interopNativeAssemblies;

// because the Interop assemblies list is assembled during the build we have to count how many are there before allocating memory for the array
for ( int i = 0; g_CLR_InteropAssembliesNativeData[i]; i++ )
{
if (g_CLR_InteropAssembliesNativeData[i] != NULL)
{
nativeAssembliesCount++;
}
}

interopNativeAssemblies = (NativeAssembly_Details*)platform_malloc(sizeof(NativeAssembly_Details) * nativeAssembliesCount);

// fill the array
for ( int i = 0; i < nativeAssembliesCount; i++ )
{
if (g_CLR_InteropAssembliesNativeData[i] != NULL)
{
interopNativeAssemblies[i].CheckSum = g_CLR_InteropAssembliesNativeData[i]->m_checkSum;
hal_strcpy_s((char*)interopNativeAssemblies[i].AssemblyName, ARRAYSIZE(interopNativeAssemblies[i].AssemblyName), g_CLR_InteropAssembliesNativeData[i]->m_szAssemblyName);
}
}

WP_ReplyToCommand( msg, true, false, interopNativeAssemblies, (sizeof(NativeAssembly_Details) * nativeAssembliesCount));

platform_free(interopNativeAssemblies);

return true;
}

bool CLR_DBG_Debugger::Debugging_TypeSys_Assemblies( WP_Message* msg)
{
NATIVE_PROFILE_CLR_DEBUGGER();
Expand Down
7 changes: 4 additions & 3 deletions src/CLR/Debugger/Debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ typedef enum CLR_DBG_Commands_Debugging
CLR_DBG_Commands_c_Debugging_Value_AllocateArray = 0x0002003A, // Creates a new instance of an array.
CLR_DBG_Commands_c_Debugging_Value_Assign = 0x0002003B, // Assigns a value to another value.

CLR_DBG_Commands_c_Debugging_TypeSys_Assemblies = 0x00020040, // Lists all the assemblies in the system.
CLR_DBG_Commands_c_Debugging_TypeSys_AppDomains = 0x00020044, // Lists all the AppDomans loaded.

CLR_DBG_Commands_c_Debugging_TypeSys_Assemblies = 0x00020040, // Lists all the assemblies in the system.
CLR_DBG_Commands_c_Debugging_TypeSys_AppDomains = 0x00020044, // Lists all the AppDomans loaded.
CLR_DBG_Commands_c_Debugging_TypeSys_InteropNativeAssemblies = 0x00020045, // Lists all the Interop Native Assemblies.

CLR_DBG_Commands_c_Debugging_Resolve_Assembly = 0x00020050, // Resolves an assembly.
CLR_DBG_Commands_c_Debugging_Resolve_Type = 0x00020051, // Resolves a type to a string.
CLR_DBG_Commands_c_Debugging_Resolve_Field = 0x00020052, // Resolves a field to a string.
Expand Down
5 changes: 3 additions & 2 deletions src/CLR/Debugger/Debugger_full.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ const CLR_Messaging_CommandHandlerLookup c_Debugger_Lookup_Request[] =
DEFINE_CMD(Value_AllocateArray ),
DEFINE_CMD(Value_Assign ),
//
DEFINE_CMD(TypeSys_Assemblies ),
DEFINE_CMD(TypeSys_AppDomains ),
DEFINE_CMD(TypeSys_Assemblies ),
DEFINE_CMD(TypeSys_AppDomains ),
DEFINE_CMD(TypeSys_InteropNativeAssemblies ),
//
DEFINE_CMD(Resolve_AppDomain ),
DEFINE_CMD(Resolve_Assembly ),
Expand Down
7 changes: 7 additions & 0 deletions src/CLR/Include/WireProtocol_MonitorCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ typedef struct CLR_DBG_Commands_Monitor_MemoryMap

}CLR_DBG_Commands_Monitor_MemoryMap;

typedef struct NativeAssembly_Details
{
uint32_t CheckSum;
// version Version // TODO add 'version info' in a future version
uint8_t AssemblyName[128];

}NativeAssembly_Details;

//////////////////////////////////////////
// function declarations (commands)
Expand Down
10 changes: 6 additions & 4 deletions src/CLR/Include/nanoCLR_Debugging.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,9 @@ struct CLR_DBG_Commands
static const unsigned int c_Debugging_Value_AllocateArray = 0x0002003A; // Creates a new instance of an array.
static const unsigned int c_Debugging_Value_Assign = 0x0002003B; // Assigns a value to another value.

static const unsigned int c_Debugging_TypeSys_Assemblies = 0x00020040; // Lists all the assemblies in the system.
static const unsigned int c_Debugging_TypeSys_AppDomains = 0x00020044; // Lists all the AppDomans loaded.
static const unsigned int c_Debugging_TypeSys_Assemblies = 0x00020040; // Lists all the assemblies in the system.
static const unsigned int c_Debugging_TypeSys_AppDomains = 0x00020044; // Lists all the AppDomans loaded.
static const unsigned int c_Debugging_TypeSys_InteropNativeAssemblies = 0x00020045; // Lists all the Interop Native Assemblies.

static const unsigned int c_Debugging_Resolve_Assembly = 0x00020050; // Resolves an assembly.
static const unsigned int c_Debugging_Resolve_Type = 0x00020051; // Resolves a type to a string.
Expand Down Expand Up @@ -1104,8 +1105,9 @@ struct CLR_DBG_Debugger
static bool Debugging_Value_AllocateArray ( WP_Message* msg );
static bool Debugging_Value_Assign ( WP_Message* msg );

static bool Debugging_TypeSys_Assemblies ( WP_Message* msg );
static bool Debugging_TypeSys_AppDomains ( WP_Message* msg );
static bool Debugging_TypeSys_Assemblies ( WP_Message* msg );
static bool Debugging_TypeSys_AppDomains ( WP_Message* msg );
static bool Debugging_TypeSys_InteropNativeAssemblies ( WP_Message* msg );

static bool Debugging_Resolve_AppDomain ( WP_Message* msg );
static bool Debugging_Resolve_Assembly ( WP_Message* msg );
Expand Down