Ken Thomases : dbghelp/stabs: Decode the Stabs type more carefully.

Alexandre Julliard julliard at winehq.org
Thu Mar 12 09:54:31 CDT 2009


Module: wine
Branch: master
Commit: 82a3f8fcb22f3180f45aa86f7ecd24aa3a9516bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=82a3f8fcb22f3180f45aa86f7ecd24aa3a9516bb

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Mar 11 09:05:42 2009 -0500

dbghelp/stabs: Decode the Stabs type more carefully.

---

 dlls/dbghelp/stabs.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c
index 6605c96..58c7783 100644
--- a/dlls/dbghelp/stabs.c
+++ b/dlls/dbghelp/stabs.c
@@ -63,9 +63,24 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_stabs);
 
+/* Masks for n_type field */
+#ifndef N_STAB
+#define N_STAB		0xe0
+#endif
+#ifndef N_TYPE
+#define N_TYPE		0x1e
+#endif
+#ifndef N_EXT
+#define N_EXT		0x01
+#endif
+
+/* Values for (n_type & N_TYPE) */
 #ifndef N_UNDF
 #define N_UNDF		0x00
 #endif
+#ifndef N_ABS
+#define N_ABS		0x02
+#endif
 
 #define N_GSYM		0x20
 #define N_FUN		0x24
@@ -1197,6 +1212,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
     struct pending_block        pending;
     BOOL                        ret = TRUE;
     struct location             loc;
+    unsigned char               type;
 
     nstab = stablen / sizeof(struct stab_nlist);
     strs_end = strs + strtablen;
@@ -1244,8 +1260,13 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
             ptr = stabbuff;
         }
 
+        if (stab_ptr->n_type & N_STAB)
+            type = stab_ptr->n_type;
+        else
+            type = (stab_ptr->n_type & N_TYPE);
+
         /* only symbol entries contain a typedef */
-        switch (stab_ptr->n_type)
+        switch (type)
         {
         case N_GSYM:
         case N_LCSYM:
@@ -1275,7 +1296,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
             }
         }
 
-        switch (stab_ptr->n_type)
+        switch (type)
         {
         case N_GSYM:
             /*
@@ -1527,7 +1548,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
             /* Always ignore these, they seem to be used only on Darwin. */
             break;
         default:
-            ERR("Unknown stab type 0x%02x\n", stab_ptr->n_type);
+            ERR("Unknown stab type 0x%02x\n", type);
             break;
         }
         stabbuff[0] = '\0';




More information about the wine-cvs mailing list