This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

symtab/1376: choice of section offset during STABS psymtab construction is careless


>Number:         1376
>Category:       symtab
>Synopsis:       choice of section offset during STABS psymtab construction is careless
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 13 00:48:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     jimb@redhat.com
>Release:        unknown-1.0
>Organization:
>Environment:
all environments
>Description:
The function read_dbx_symtab scans all the stabs in an executable file to construct the partial symbol table.  Among other things, it is responsible for applying the appropriate offset from objfile->section_offsets to the address of each global and static variable.  It ought to adjust each variable's address by the offset for the section containing the variable.

However, for ages, this code has simply assumed that the .data section's offset is appropriate for all variables.  That's clearly wrong, but there is no sufficiently quick way (that I can see) to find the right section.  This code is performance-critical, since it's scanning every symbol in the executable file before the user gets a prompt.
The stabs don't tell us the section.  We could look up the section by the variable's unrelocated address, using find_pc_section,  but that would be too slow.

Tangentially, the .data assumption also causes GDB to fail on files that have variables in a .bss section, but have no .data section.  GDB detects the attempt to read the offset of a section that doesn't exist, and reports an internal error.  We've worked around this by falling back to the offset of the .bss, then the .rodata, sections, but it's still fundamentally incorrect.



>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]