Skip to content

Commit

Permalink
[eventpipe] Use MonoImage:module_name when filename is NULL (#73018)
Browse files Browse the repository at this point in the history
* [eventpipe] Use MonoImage:module_name when available, if MonoImage:filename is null

   When assemblies are bundled (for example in WASM), the filename field
   is set to NULL. The module name comes from the metadata Module table and is something like
   "Foo.dll" even if the assembly is loaded from a bundle or from
   Assembly.Load(byte[]), whereas image->name might be "data-0x00abcdef" for byte loads
  • Loading branch information
lambdageek authored Aug 1, 2022
1 parent 0000c15 commit 73eb0cd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/mono/mono/eventpipe/ep-rt-mono.c
Original file line number Diff line number Diff line change
Expand Up @@ -3784,7 +3784,17 @@ get_module_event_data (
if (image && image->aot_module)
module_data->module_flags |= MODULE_FLAGS_NATIVE_MODULE;

module_data->module_il_path = image && image->filename ? image->filename : "";
module_data->module_il_path = NULL;
if (image && image->filename) {
/* if there's a filename, use it */
module_data->module_il_path = image->filename;
} else if (image && image->module_name) {
/* otherwise, use the module name */
module_data->module_il_path = image->module_name;
}
if (!module_data->module_il_path)
module_data->module_il_path = "";

module_data->module_il_pdb_path = "";
module_data->module_il_pdb_age = 0;

Expand Down

0 comments on commit 73eb0cd

Please sign in to comment.