public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/15274] New: add-symbol-file loads symbols at wrong address
@ 2013-03-13  5:53 ehunter at broadcom dot com
  2013-03-13  5:55 ` [Bug symtab/15274] " ehunter at broadcom dot com
  0 siblings, 1 reply; 2+ messages in thread
From: ehunter at broadcom dot com @ 2013-03-13  5:53 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug symtab/15274] add-symbol-file loads symbols at wrong address
  2013-03-13  5:53 [Bug symtab/15274] New: add-symbol-file loads symbols at wrong address ehunter at broadcom dot com
@ 2013-03-13  5:55 ` ehunter at broadcom dot com
  0 siblings, 0 replies; 2+ messages in thread
From: ehunter at broadcom dot com @ 2013-03-13  5:55 UTC (permalink / raw)
  To: gdb-prs

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

Evan Hunter <ehunter at broadcom dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ehunter at broadcom dot com

--- Comment #1 from Evan Hunter <ehunter at broadcom dot com> 2013-03-13 05:55:31 UTC ---
This problem mainly affects embedded debugging, but I have made the
demonstration code run on a Linux PC.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-13  5:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-13  5:53 [Bug symtab/15274] New: add-symbol-file loads symbols at wrong address ehunter at broadcom dot com
2013-03-13  5:55 ` [Bug symtab/15274] " ehunter at broadcom dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).