[PATCH 09/11] dbghelp, tools/winedump: update support for S_COMPILE* records

Eric Pouech eric.pouech at gmail.com
Sat Aug 21 03:23:13 CDT 2021


- updated all definitions

Don't mix up S_COMPILE records with compiland information

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/dbghelp/msc.c     |   34 ++++++---------
 include/wine/mscvpdb.h |   62 ++++++++++++++++++++++++---
 tools/winedump/msc.c   |  111 +++++++++++++++++++++++++-----------------------
 3 files changed, 127 insertions(+), 80 deletions(-)

diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index 2712d352a17..ff7507c797c 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -1826,23 +1826,24 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* roo
             break;
 
         case S_COMPILE:
-            TRACE("S-Compiland-V1 %x %s\n",
-                  sym->compiland_v1.unknown, terminate_string(&sym->compiland_v1.p_name));
+            TRACE("S-Compile-V1 machine:%x language:%x %s\n",
+                  sym->compile_v1.machine, sym->compile_v1.flags.language, terminate_string(&sym->compile_v1.p_name));
             break;
 
         case S_COMPILE2_ST:
-            TRACE("S-Compiland-V2 %s\n", terminate_string(&sym->compiland_v2.p_name));
-            if (TRACE_ON(dbghelp_msc))
-            {
-                const char* ptr1 = sym->compiland_v2.p_name.name + sym->compiland_v2.p_name.namelen;
-                const char* ptr2;
-                while (*ptr1)
-                {
-                    ptr2 = ptr1 + strlen(ptr1) + 1;
-                    TRACE("\t%s => %s\n", ptr1, debugstr_a(ptr2));
-                    ptr1 = ptr2 + strlen(ptr2) + 1;
-                }
-            }
+            TRACE("S-Compile-V2 machine:%x language:%x %s\n",
+                  sym->compile2_v2.machine, sym->compile2_v2.flags.iLanguage, terminate_string(&sym->compile2_v2.p_name));
+            break;
+
+        case S_COMPILE2:
+            TRACE("S-Compile-V3 machine:%x language:%x %s\n", sym->compile2_v3.machine, sym->compile2_v3.flags.iLanguage, sym->compile2_v3.name);
+            break;
+
+        case S_COMPILE3:
+            TRACE("S-Compile3-V3 machine:%x language:%x %s\n", sym->compile3_v3.machine, sym->compile3_v3.flags.iLanguage, sym->compile3_v3.name);
+            break;
+
+        case S_ENVBLOCK:
             break;
 
         case S_OBJNAME:
@@ -1983,11 +1984,6 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* roo
                 break;
             }
 
-        case S_COMPILE2: /* just to silence a few warnings */
-        case S_COMPILE3:
-        case S_ENVBLOCK:
-            break;
-
         case S_SSEARCH:
             TRACE("Start search: seg=0x%x at offset 0x%08x\n",
                   sym->ssearch_v1.segment, sym->ssearch_v1.offset);
diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h
index d40371f4cef..4027441453c 100644
--- a/include/wine/mscvpdb.h
+++ b/include/wine/mscvpdb.h
@@ -1573,26 +1573,74 @@ union codeview_symbol
     {
         unsigned short int      len;
         unsigned short int      id;
-        unsigned int            unknown;
+        unsigned char           machine;
+        struct
+        {
+        unsigned char           language : 8;
+        unsigned char           _dome : 8; /* other missing fields */
+        unsigned char           pad : 8;
+        } flags;
         struct p_string         p_name;
-    } compiland_v1;
+    } compile_v1;
 
     struct
     {
         unsigned short int      len;
         unsigned short int      id;
-        unsigned                unknown1[4];
-        unsigned short          unknown2;
+        struct {
+        unsigned int            iLanguage :  8;
+        unsigned int            _dome     :  9; /* other missing fields */
+        unsigned int            pad       : 15;
+        } flags;
+        unsigned short          machine;
+        unsigned short          fe_major;
+        unsigned short          fe_minor;
+        unsigned short          fe_build;
+        unsigned short          be_major;
+        unsigned short          be_minor;
+        unsigned short          be_build;
         struct p_string         p_name;
-    } compiland_v2;
+    } compile2_v2;
 
     struct
     {
         unsigned short int      len;
         unsigned short int      id;
-        unsigned int            unknown;
+        struct {
+        unsigned int            iLanguage :  8;
+        unsigned int            _dome     :  9; /* other missing fields */
+        unsigned int            pad       : 15;
+        } flags;
+        unsigned short          machine;
+        unsigned short          fe_major;
+        unsigned short          fe_minor;
+        unsigned short          fe_build;
+        unsigned short          be_major;
+        unsigned short          be_minor;
+        unsigned short          be_build;
+        char                    name[1];
+    } compile2_v3;
+
+    struct
+    {
+        unsigned short int      len;
+        unsigned short int      id;
+        struct {
+        unsigned int            iLanguage :  8;
+        unsigned int            _dome     : 12; /* other missing fields */
+        unsigned int            pad       : 12;
+        } flags;
+        unsigned short          machine;
+        unsigned short          fe_major;
+        unsigned short          fe_minor;
+        unsigned short          fe_build;
+        unsigned short          fe_qfe;
+        unsigned short          be_major;
+        unsigned short          be_minor;
+        unsigned short          be_build;
+        unsigned short          be_qfe;
         char                    name[1];
-    } compiland_v3;
+    } compile3_v3;
 
     struct
     {
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c
index 5def00df8ed..d2cf7b36d80 100644
--- a/tools/winedump/msc.c
+++ b/tools/winedump/msc.c
@@ -1330,19 +1330,23 @@ BOOL codeview_dump_symbols(const void* root, unsigned long size)
             break;
 
         case S_COMPILE:
-            printf("\tS-Compiland V1 '%s' %s %s unk:%x\n",
-                   p_string(&sym->compiland_v1.p_name),
-                   get_machine(sym->compiland_v1.unknown & 0xFF),
-                   get_language((sym->compiland_v1.unknown >> 8) & 0xFF),
-                   sym->compiland_v1.unknown >> 16);
+            printf("\tS-Compile V1 machine:%s lang:%s _unk:%x '%s'\n",
+                   get_machine(sym->compile_v1.machine),
+                   get_language(sym->compile_v1.flags.language),
+                   sym->compile_v1.flags._dome,
+                   p_string(&sym->compile_v1.p_name));
             break;
 
         case S_COMPILE2_ST:
-            printf("\tS-Compiland V2 '%s'\n",
-                   p_string(&sym->compiland_v2.p_name));
-            dump_data((const void*)sym, sym->generic.len + 2, "  ");
+            printf("\tS-Compile2-V2 lang:%s machine:%s _unk:%x front-end:%d.%d.%d back-end:%d.%d.%d '%s'\n",
+                   get_language(sym->compile2_v2.flags.iLanguage),
+                   get_machine(sym->compile2_v2.machine),
+                   sym->compile2_v2.flags._dome,
+                   sym->compile2_v2.fe_major, sym->compile2_v2.fe_minor, sym->compile2_v2.fe_build,
+                   sym->compile2_v2.be_major, sym->compile2_v2.be_minor, sym->compile2_v2.be_build,
+                   p_string(&sym->compile2_v2.p_name));
             {
-                const char* ptr = sym->compiland_v2.p_name.name + sym->compiland_v2.p_name.namelen;
+                const char* ptr = sym->compile2_v2.p_name.name + sym->compile2_v2.p_name.namelen;
                 while (*ptr)
                 {
                     printf("\t\t%s => ", ptr); ptr += strlen(ptr) + 1;
@@ -1351,6 +1355,50 @@ BOOL codeview_dump_symbols(const void* root, unsigned long size)
             }
             break;
 
+        case S_COMPILE2:
+            printf("\tS-Compile2-V3 lang:%s machine:%s _unk:%x front-end:%d.%d.%d back-end:%d.%d.%d '%s'\n",
+                   get_language(sym->compile2_v3.flags.iLanguage),
+                   get_machine(sym->compile2_v3.machine),
+                   sym->compile2_v3.flags._dome,
+                   sym->compile2_v3.fe_major, sym->compile2_v3.fe_minor, sym->compile2_v3.fe_build,
+                   sym->compile2_v3.be_major, sym->compile2_v3.be_minor, sym->compile2_v3.be_build,
+                   sym->compile2_v3.name);
+            {
+                const char* ptr = sym->compile2_v3.name + strlen(sym->compile2_v3.name) + 1;
+                while (*ptr)
+                {
+                    printf("\t\t%s => ", ptr); ptr += strlen(ptr) + 1;
+                    printf("%s\n", ptr); ptr += strlen(ptr) + 1;
+                }
+            }
+            break;
+
+        case S_COMPILE3:
+            printf("\tS-Compile3-V3 lang:%s machine:%s _unk:%x front-end:%d.%d.%d back-end:%d.%d.%d '%s'\n",
+                   get_language(sym->compile3_v3.flags.iLanguage),
+                   get_machine(sym->compile3_v3.machine),
+                   sym->compile3_v3.flags._dome,
+                   sym->compile3_v3.fe_major, sym->compile3_v3.fe_minor, sym->compile3_v3.fe_build,
+                   sym->compile3_v3.be_major, sym->compile3_v3.be_minor, sym->compile3_v3.be_build,
+                   sym->compile3_v3.name);
+            break;
+
+        case S_ENVBLOCK:
+            {
+                const char*             x1 = (const char*)sym + 4 + 1;
+                const char*             x2;
+
+                printf("\tTool conf V3\n");
+                while (*x1)
+                {
+                    x2 = x1 + strlen(x1) + 1;
+                    if (!*x2) break;
+                    printf("\t\t%s: %s\n", x1, x2);
+                    x1 = x2 + strlen(x2) + 1;
+                }
+            }
+            break;
+
         case S_OBJNAME:
             printf("\tS-ObjName V3 sig:%x '%s'\n",
                    sym->objname_v3.signature, sym->objname_v3.name);
@@ -1433,51 +1481,6 @@ BOOL codeview_dump_symbols(const void* root, unsigned long size)
                        p_string(pname));
             }
             break;
-        case S_COMPILE2:    /* info about tool used to create CU */
-            {
-                const unsigned short*   ptr = ((const unsigned short*)sym) + 2;
-                const char*             x1;
-                const char*             x2 = (const char*)&ptr[9];
-                /* FIXME: what are all those values for ? */
-                printf("\tTool V3 unk=%04x%04x%04x front=%d.%d.%d.0 back=%d.%d.%d.0 %s\n",
-                       ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7],
-                       ptr[8], x2);
-                while (*(x1 = x2 + strlen(x2) + 1))
-                {
-                    x2 = x1 + strlen(x1) + 1;
-                    if (!*x2) break;
-                    printf("\t\t%s: %s\n", x1, x2);
-                }
-            }
-            break;
-
-        case S_COMPILE3:
-            {
-                const unsigned short*   ptr = ((const unsigned short*)sym) + 2;
-
-                printf("\tTool info V3: unk=%04x%04x%04x front=%d.%d.%d.%d back=%d.%d.%d.%d %s\n",
-                       ptr[0], ptr[1], ptr[2],
-                       ptr[3], ptr[4], ptr[5], ptr[6],
-                       ptr[7], ptr[8], ptr[9], ptr[10],
-                       (const char*)(ptr + 11));
-            }
-            break;
-
-        case S_ENVBLOCK:
-            {
-                const char*             x1 = (const char*)sym + 4 + 1;
-                const char*             x2;
-
-                printf("\tTool conf V3\n");
-                while (*x1)
-                {
-                    x2 = x1 + strlen(x1) + 1;
-                    if (!*x2) break;
-                    printf("\t\t%s: %s\n", x1, x2);
-                    x1 = x2 + strlen(x2) + 1;
-                }
-            }
-            break;
 
         case S_ALIGN:
             /* simply skip it */




More information about the wine-devel mailing list