From d3b7dc1399d0214d627a4197be1fab734a84e05f Mon Sep 17 00:00:00 2001 From: Thays Grazia Date: Fri, 24 Feb 2023 17:06:06 -0300 Subject: [PATCH] [mono][debugger] Show loaded symbols on VS module window (#82587) * Fix 82417 * testing size of the ppdb * Addressing @akoeplinger comments of 82555 PR --- src/mono/mono/component/debugger-agent.c | 18 +++++++++++++++++- src/mono/mono/component/debugger-protocol.h | 3 ++- src/mono/mono/metadata/debug-mono-ppdb.c | 4 ++-- src/mono/mono/metadata/debug-mono-ppdb.h | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index 47c47cf..9c0ed65 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -7963,7 +7963,7 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf) char *ppdb_path; GArray *pdb_checksum_hash_type = g_array_new (FALSE, TRUE, sizeof (char*)); GArray *pdb_checksum = g_array_new (FALSE, TRUE, sizeof (guint8*)); - gboolean has_debug_info = get_pe_debug_info_full (ass->image, pe_guid, &pe_age, &pe_timestamp, &ppdb_data, &ppdb_size, &ppdb_compressed_size, &ppdb_path, pdb_checksum_hash_type, pdb_checksum); + gboolean has_debug_info = mono_get_pe_debug_info_full (ass->image, pe_guid, &pe_age, &pe_timestamp, &ppdb_data, &ppdb_size, &ppdb_compressed_size, &ppdb_path, pdb_checksum_hash_type, pdb_checksum); if (!has_debug_info || ppdb_size > 0) { buffer_add_byte (buf, 0); @@ -7990,6 +7990,22 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf) g_array_free (pdb_checksum, TRUE); break; } + case MDBGPROT_CMD_ASSEMBLY_HAS_DEBUG_INFO_LOADED: { + MonoImage* image = ass->image; + MonoDebugHandle* handle = mono_debug_get_handle (image); + if (!handle) { + buffer_add_byte (buf, 0); + return ERR_NONE; + } + MonoPPDBFile* ppdb = handle->ppdb; + if (ppdb) { + image = mono_ppdb_get_image (ppdb); + buffer_add_byte (buf, image->raw_data_len > 0); + } else { + buffer_add_byte (buf, 0); + } + break; + } default: return ERR_NOT_IMPLEMENTED; } diff --git a/src/mono/mono/component/debugger-protocol.h b/src/mono/mono/component/debugger-protocol.h index ef65413..475bc80 100644 --- a/src/mono/mono/component/debugger-protocol.h +++ b/src/mono/mono/component/debugger-protocol.h @@ -149,7 +149,8 @@ typedef enum { MDBGPROT_CMD_ASSEMBLY_GET_CATTRS = 14, MDBGPROT_CMD_ASSEMBLY_GET_CUSTOM_ATTRIBUTES = 15, MDBGPROT_CMD_ASSEMBLY_GET_PEIMAGE_ADDRESS = 16, - MDBGPROT_CMD_ASSEMBLY_GET_DEBUG_INFORMATION = 17 + MDBGPROT_CMD_ASSEMBLY_GET_DEBUG_INFORMATION = 17, + MDBGPROT_CMD_ASSEMBLY_HAS_DEBUG_INFO_LOADED = 18 } MdbgProtCmdAssembly; typedef enum { diff --git a/src/mono/mono/metadata/debug-mono-ppdb.c b/src/mono/mono/metadata/debug-mono-ppdb.c index 2499526..1352cfe 100644 --- a/src/mono/mono/metadata/debug-mono-ppdb.c +++ b/src/mono/mono/metadata/debug-mono-ppdb.c @@ -61,7 +61,7 @@ enum { }; gboolean -get_pe_debug_info_full (MonoImage *image, guint8 *out_guid, gint32 *out_age, gint32 *out_timestamp, guint8 **ppdb_data, +mono_get_pe_debug_info_full (MonoImage *image, guint8 *out_guid, gint32 *out_age, gint32 *out_timestamp, guint8 **ppdb_data, int *ppdb_uncompressed_size, int *ppdb_compressed_size, char **pdb_path, GArray *pdb_checksum_hash_type, GArray *pdb_checksum) { MonoPEDirEntry *debug_dir_entry; @@ -130,7 +130,7 @@ static gboolean get_pe_debug_info (MonoImage *image, guint8 *out_guid, gint32 *out_age, gint32 *out_timestamp, guint8 **ppdb_data, int *ppdb_uncompressed_size, int *ppdb_compressed_size) { - return get_pe_debug_info_full (image, out_guid, out_age, out_timestamp, ppdb_data, ppdb_uncompressed_size, ppdb_compressed_size, NULL, NULL, NULL); + return mono_get_pe_debug_info_full (image, out_guid, out_age, out_timestamp, ppdb_data, ppdb_uncompressed_size, ppdb_compressed_size, NULL, NULL, NULL); } static void diff --git a/src/mono/mono/metadata/debug-mono-ppdb.h b/src/mono/mono/metadata/debug-mono-ppdb.h index 716057a..91fea5f 100644 --- a/src/mono/mono/metadata/debug-mono-ppdb.h +++ b/src/mono/mono/metadata/debug-mono-ppdb.h @@ -75,6 +75,6 @@ MONO_COMPONENT_API MonoPPDBFile* mono_create_ppdb_file (MonoImage *ppdb_image, gboolean is_embedded_ppdb); MONO_COMPONENT_API gboolean -get_pe_debug_info_full (MonoImage *image, guint8 *out_guid, gint32 *out_age, gint32 *out_timestamp, guint8 **ppdb_data, +mono_get_pe_debug_info_full (MonoImage *image, guint8 *out_guid, gint32 *out_age, gint32 *out_timestamp, guint8 **ppdb_data, int *ppdb_uncompressed_size, int *ppdb_compressed_size, char **pdb_path, GArray *pdb_checksum_hash_type, GArray *pdb_checksum); #endif -- 2.7.4