aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2003-09-12 23:34:55 +0000
committerJim Blandy <jimb@codesourcery.com>2003-09-12 23:34:55 +0000
commit4f49b26b87af3624ba0170fcb54d450a7812402a (patch)
tree04edb0124747e6ba4b8d3bde91dc2902021cdcbb
parent14f751370b30213bcbeb016c1737fa6bc1b11456 (diff)
downloadgdb-4f49b26b87af3624ba0170fcb54d450a7812402a.zip
gdb-4f49b26b87af3624ba0170fcb54d450a7812402a.tar.gz
gdb-4f49b26b87af3624ba0170fcb54d450a7812402a.tar.bz2
* dbxread.c (read_dbx_symtab): Add FIXME about finding section
offsets for global and static variables.
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/dbxread.c21
2 files changed, 23 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0060e87..17f2be9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
2003-09-12 Jim Blandy <jimb@redhat.com>
+ * dbxread.c (read_dbx_symtab): Add FIXME about finding section
+ offsets for global and static variables.
+
* dbxread.c (read_dbx_symtab): The N_DATA and N_DATA | N_EXT
symbol types are, by definition, in the .data section, so it is
correct to use SECT_OFF_DATA (objfile) here, not data_sect_index.
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index d0b3710..5720130 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1357,7 +1357,26 @@ read_dbx_symtab (struct objfile *objfile)
textlow_not_set = 1;
has_line_numbers = 0;
- /* If the objfile has no .data section, try using the .bss section. */
+ /* FIXME: jimb/2003-09-12: We don't apply the right section's offset
+ to global and static variables. The stab for a global or static
+ variable doesn't give us any indication of which section it's in,
+ so we can't tell immediately which offset in
+ objfile->section_offsets we should apply to the variable's
+ address.
+
+ We could certainly find out which section contains the variable
+ by looking up the variable's unrelocated address with
+ find_pc_section, but that would be expensive; this is the
+ function that constructs the partial symbol tables by examining
+ every symbol in the entire executable, and it's
+ performance-critical. So that expense would not be welcome. I'm
+ not sure what to do about this at the moment.
+
+ What we have done for years is to simply assume that the .data
+ section's offset is appropriate for all global and static
+ variables. Recently, this was expanded to fall back to the .bss
+ section's offset if there is no .data section, and then to the
+ .rodata section's offset. */
data_sect_index = objfile->sect_index_data;
if (data_sect_index == -1)
data_sect_index = SECT_OFF_BSS (objfile);