dbghelp/stabs: Decode the Stabs type more carefully.

This commit is contained in:
Ken Thomases 2009-03-11 09:05:42 -05:00 committed by Alexandre Julliard
parent 1ecd634c4b
commit 82a3f8fcb2

View file

@ -63,9 +63,24 @@
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_stabs); 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 #ifndef N_UNDF
#define N_UNDF 0x00 #define N_UNDF 0x00
#endif #endif
#ifndef N_ABS
#define N_ABS 0x02
#endif
#define N_GSYM 0x20 #define N_GSYM 0x20
#define N_FUN 0x24 #define N_FUN 0x24
@ -1197,6 +1212,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
struct pending_block pending; struct pending_block pending;
BOOL ret = TRUE; BOOL ret = TRUE;
struct location loc; struct location loc;
unsigned char type;
nstab = stablen / sizeof(struct stab_nlist); nstab = stablen / sizeof(struct stab_nlist);
strs_end = strs + strtablen; strs_end = strs + strtablen;
@ -1244,8 +1260,13 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
ptr = stabbuff; 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 */ /* only symbol entries contain a typedef */
switch (stab_ptr->n_type) switch (type)
{ {
case N_GSYM: case N_GSYM:
case N_LCSYM: 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: 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. */ /* Always ignore these, they seem to be used only on Darwin. */
break; break;
default: default:
ERR("Unknown stab type 0x%02x\n", stab_ptr->n_type); ERR("Unknown stab type 0x%02x\n", type);
break; break;
} }
stabbuff[0] = '\0'; stabbuff[0] = '\0';