aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Guitton <guitton@adacore.com>2010-07-26 09:30:00 +0000
committerJerome Guitton <guitton@adacore.com>2010-07-26 09:30:00 +0000
commitcaac4577e57452617544ff0d881ad64258270671 (patch)
tree0ceddffe7ff91480a46f1d10c2bda2b570aa8091
parentad0a41197c0fee690adab9ecfbfd029e2966c581 (diff)
downloadfsf-binutils-gdb-caac4577e57452617544ff0d881ad64258270671.zip
fsf-binutils-gdb-caac4577e57452617544ff0d881ad64258270671.tar.gz
fsf-binutils-gdb-caac4577e57452617544ff0d881ad64258270671.tar.bz2
gdb/
* dwarf2read.c (add_partial_symbol): Do not add a global variable if its adress is null. Add comment to explain why. (new_symbol): Ditto.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2read.c28
2 files changed, 29 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9908178..a80f1cc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2010-07-26 Jerome Guitton <guitton@adacore.com>
+
+ * dwarf2read.c (add_partial_symbol): Do not add a global variable if
+ its adress is null. Add comment to explain why.
+ (new_symbol): Ditto.
+
2010-07-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* linux-nat.c (linux_nat_do_thread_registers): Convert STOP_SIGNAL to
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f4eb1f7..fb62b77 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3569,7 +3569,19 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
}
break;
case DW_TAG_variable:
- if (pdi->is_external)
+ if (pdi->locdesc)
+ addr = decode_locdesc (pdi->locdesc, cu);
+
+ if (pdi->locdesc
+ && addr == 0
+ && !dwarf2_per_objfile->has_section_at_zero)
+ {
+ /* A global or static variable may also have been stripped
+ out by the linker if unused, in which case its address
+ will be nullified; do not add such variables into partial
+ symbol table then. */
+ }
+ else if (pdi->is_external)
{
/* Global Variable.
Don't enter into the minimal symbol tables as there is
@@ -3584,8 +3596,6 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
used by GDB, but it comes in handy for debugging partial symbol
table building. */
- if (pdi->locdesc)
- addr = decode_locdesc (pdi->locdesc, cu);
if (pdi->locdesc || pdi->has_type)
psym = add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name,
@@ -3603,7 +3613,6 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
xfree (actual_name);
return;
}
- addr = decode_locdesc (pdi->locdesc, cu);
/*prim_record_minimal_symbol (actual_name, addr + baseaddr,
mst_file_data, objfile); */
psym = add_psymbol_to_list (actual_name, strlen (actual_name),
@@ -10006,7 +10015,16 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
var_decode_location (attr, sym, cu);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
- if (attr2 && (DW_UNSND (attr2) != 0))
+ if (SYMBOL_CLASS (sym) == LOC_STATIC
+ && SYMBOL_VALUE_ADDRESS (sym) == 0
+ && !dwarf2_per_objfile->has_section_at_zero)
+ {
+ /* When a static variable is eliminated by the linker,
+ the corresponding debug information is not stripped
+ out, but the variable address is set to null;
+ do not add such variables into symbol table. */
+ }
+ else if (attr2 && (DW_UNSND (attr2) != 0))
{
struct pending **list_to_add;