This is the mail archive of the gdb-prs@sourceware.org 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]

[Bug symtab/13173] New: add-symbol-file -s option still requirestext address


http://sourceware.org/bugzilla/show_bug.cgi?id=13173

             Bug #: 13173
           Summary: add-symbol-file -s option still requires text address
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
        AssignedTo: unassigned@sourceware.org
        ReportedBy: konrad.schwarz@siemens.com
    Classification: Unclassified


The gbd.info file has the following synopsis for add-symbol-file:

add-symbol-file FILENAME ADDRESS
add-symbol-file FILENAME ADDRESS  [ -readnow ]
add-symbol-file FILENAME -sSECTION ADDRESS ...

Aside: the first synopsis is redundant, given the second.  You might want to 
delete the first line.

GDB does not actually accept the third synopsis.  Instead, it accepts:

add-symbol-file FILENAME ADDRESSS -sSECTION ADDRESS ...

where ADDRESS is the address of the .text section.

Given the following command line (that is, specify the .text section address
twice, once as a dummy 0, once as the real address)

add-symbol-file FILENAME 0 ... -s.text TEXT_ADDDRESS ...

GDB 7.0 used the -s.text TEXT_ADDRESS as the 
address of .text address and disregarded the 0 argument.  (I expect that
later arguments simply overwrote earlier arguments).

GDB 7.2 uses the first ADDRESS argument (0, in this case) as the .text
section address and reports an error when it is specified a second time.

This problem occurs in the context of debugging Linux kernel modules.  The 
Linux kernel module linker/loader allocates the large number of sections in a 
module at essentially random locations, so that the third synopsis form is 
required.

A short GDB script is required to walk  through Linux kernel module 
linker/loader data structures to discover which sections the linker/loader
has loaded where.  The .text section is not necessarily the first section
in this list.

Thus, when synthesizing the necessary add-symbol-file command,
it would be very nice if the third synopsis actually worked as advertised,
that is without requiring an initial ADDRESS implicitly understood
to be the address of the .text segment.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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