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/15274] New: add-symbol-file loads symbols at wrongaddress


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

             Bug #: 15274
           Summary: add-symbol-file loads symbols at wrong address
           Product: gdb
           Version: 7.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
        AssignedTo: unassigned@sourceware.org
        ReportedBy: ehunter@broadcom.com
    Classification: Unclassified


Created attachment 6933
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6933
Demonstration code

I have found that GDB loads symbols at the wrong addresses in the following
case:

An ELF file loaded using the command "add-symbol-file xxx.elf 0"  where:
*  .text is not at address zero
*  There is another ELF section at a starting at a non-zero address that is
lower than the .text address.

The symbols are incorrectly offset from the correct locations by the start
address of the lower section.

The attached code demonstrates the problem. Simply unzip and run make.

Below is a patch that fixes the problem by commenting out the offending
function call that incorrectly offsets the ELF symbols.

diff -Naur gdb-7.4/gdb/gdb/symfile.c gdb-7.4-new/gdb/symfile.c
--- gdb-7.4/gdb/symfile.c    2013-03-13 13:12:25 +1100
+++ gdb-7.4-new/gdb/symfile.c    2013-03-13 13:11:54 +1100
@@ -986,8 +986,8 @@

      We no longer warn if the lowest section is not a text segment (as
      happens for the PA64 port.  */
-  if (addrs && addrs->other[0].name)
-    addr_info_make_relative (addrs, objfile->obfd);
+//  if (addrs && addrs->other[0].name)
+//    addr_info_make_relative (addrs, objfile->obfd);

   /* Initialize symbol reading routines for this objfile, allow complaints to
      appear for this new file, and record how verbose to be, then do the

-- 
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]