From 120dcce23f6acdc64dc17598ab414a72fe77fce0 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Sun, 8 May 2016 21:13:38 -0400 Subject: [PATCH] [ppdb] Avoid using pdb files for assemblies which are not compiled by csc using /debug:portable. Fixes #40886. --- mono/metadata/debug-mono-ppdb.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mono/metadata/debug-mono-ppdb.c b/mono/metadata/debug-mono-ppdb.c index e6d9cc95e2f..8357099a551 100644 --- a/mono/metadata/debug-mono-ppdb.c +++ b/mono/metadata/debug-mono-ppdb.c @@ -107,6 +107,9 @@ mono_ppdb_load_file (MonoImage *image, const guint8 *raw_contents, int size) gint32 pe_timestamp; MonoPPDBFile *ppdb; + if (!get_pe_debug_guid (image, pe_guid, &pe_age, &pe_timestamp)) + return NULL; + if (raw_contents) { if (size > 4 && strncmp ((char*)raw_contents, "BSJB", 4) == 0) ppdb_image = mono_image_open_from_data_internal ((char*)raw_contents, size, TRUE, &status, FALSE, TRUE, NULL); @@ -134,18 +137,16 @@ mono_ppdb_load_file (MonoImage *image, const guint8 *raw_contents, int size) * The same id is stored in the Debug Directory of the PE file, and in the * #Pdb stream in the ppdb file. */ - if (get_pe_debug_guid (image, pe_guid, &pe_age, &pe_timestamp)) { - PdbStreamHeader *pdb_stream = (PdbStreamHeader*)ppdb_image->heap_pdb.data; + PdbStreamHeader *pdb_stream = (PdbStreamHeader*)ppdb_image->heap_pdb.data; - g_assert (pdb_stream); + g_assert (pdb_stream); - /* The pdb id is a concentation of the pe guid and the timestamp */ - if (memcmp (pe_guid, pdb_stream->guid, 16) != 0 || memcmp (&pe_timestamp, pdb_stream->guid + 16, 4) != 0) { - g_warning ("Symbol file %s doesn't match image %s", ppdb_image->name, - image->name); - mono_image_close (ppdb_image); - return NULL; - } + /* The pdb id is a concentation of the pe guid and the timestamp */ + if (memcmp (pe_guid, pdb_stream->guid, 16) != 0 || memcmp (&pe_timestamp, pdb_stream->guid + 16, 4) != 0) { + g_warning ("Symbol file %s doesn't match image %s", ppdb_image->name, + image->name); + mono_image_close (ppdb_image); + return NULL; } ppdb = g_new0 (MonoPPDBFile, 1); -- 2.25.1