From 574f058bae68da60e7fa5ad18ebd9f6020c5bd19 Mon Sep 17 00:00:00 2001 From: Richard Cohen Date: Thu, 7 Aug 2003 02:56:55 +0000 Subject: [PATCH] Use the ELF sections for the addresses of globals, as the STABS are likely to be wrong. --- programs/winedbg/hash.c | 4 +++- programs/winedbg/stabs.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/programs/winedbg/hash.c b/programs/winedbg/hash.c index d3683fb7879..a4dbba697ad 100644 --- a/programs/winedbg/hash.c +++ b/programs/winedbg/hash.c @@ -225,7 +225,9 @@ DEBUG_AddSymbol( const char * name, const DBG_VALUE *value, * - a second time with the correct address * SYM_INVALID is set for the first pass, and cleared in the second * the code below gets most of information for both passes - * latest GCC version seem to provide correct address in first pass, + * + * some GCC versions may provide the correct address in the first pass + * but it does not seem to be sensible to rely on that. */ if (nh->value.addr.seg == 0 && nh->value.addr.off == 0 && c != 0) { diff --git a/programs/winedbg/stabs.c b/programs/winedbg/stabs.c index c621ea59338..52822e98962 100644 --- a/programs/winedbg/stabs.c +++ b/programs/winedbg/stabs.c @@ -980,16 +980,17 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, void *load_offset, * * With a.out or mingw, they actually do make some amount of sense. */ - new_value.addr.seg = 0; new_value.type = DEBUG_ParseStabType(ptr); - new_value.addr.off = (unsigned long)load_offset + stab_ptr->n_value; + new_value.addr.seg = 0; new_value.cookie = DV_TARGET; stab_strcpy(symname, sizeof(symname), ptr); #ifdef __ELF__ + new_value.addr.off = 0; curr_sym = DEBUG_AddSymbol( symname, &new_value, currpath, SYM_WINE | SYM_DATA | SYM_INVALID ); #else + new_value.addr.off = (unsigned long)load_offset + stab_ptr->n_value; curr_sym = DEBUG_AddSymbol( symname, &new_value, currpath, SYM_WINE | SYM_DATA ); #endif