summaryrefslogtreecommitdiff
path: root/gdb/minsyms.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2012-09-11 21:26:15 +0000
committerJoel Brobecker <brobecker@gnat.com>2012-09-11 21:26:15 +0000
commitf567384da7903ce70ca479aa2a904aae7fbf55b6 (patch)
tree5be9e6e8a4498baa1152bd0d3f42d6444cc14b95 /gdb/minsyms.c
parent3d981902a7c0dd5a0eabc8e2a11463f9f3217e5d (diff)
downloadgdb-f567384da7903ce70ca479aa2a904aae7fbf55b6.tar.gz
Name of symbol missing when printing global variable's address
The build_address_symbolic funnction filters out data symbols if their size is set to zero. But the problem is that the COFF symbol table (for instance) does not provide any size information, leaving the size to its default value of zero, thus always triggering the filter. This shows up when trying to print the address of a global variable when debugging a Windows executable, for instance. gdb/ChangeLog: * symtab.h (struct minimal_symbol) [has_size]: New field. (MSYMBOL_SIZE): Adjust to forbid macro from being used as lvalue. (SET_MSYMBOL_SIZE, MSYMBOL_HAS_SIZE): New macros. * printcmd.c (build_address_symbolic): Only filter out zero-sized minimal symbols if the symbol's size is actually known. * minsyms.c (prim_record_minimal_symbol_full): Adjust setting of msymbol's size field. Add comment. * elfread.c (elf_symtab_read, elf_rel_plt_read): Use SET_MSYMBOL_SIZE to set the minimal symbol size.
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r--gdb/minsyms.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index b6df4eae2d7..a3a376cf3be 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -937,7 +937,9 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
MSYMBOL_TYPE (msymbol) = ms_type;
MSYMBOL_TARGET_FLAG_1 (msymbol) = 0;
MSYMBOL_TARGET_FLAG_2 (msymbol) = 0;
- MSYMBOL_SIZE (msymbol) = 0;
+ /* Do not use the SET_MSYMBOL_SIZE macro to initialize the size,
+ as it would also set the has_size flag. */
+ msymbol->size = 0;
/* The hash pointers must be cleared! If they're not,
add_minsym_to_hash_table will NOT add this msymbol to the hash table. */