public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* add-symbol-file question
@ 2007-11-20  0:50 vb
  2007-11-20 12:19 ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: vb @ 2007-11-20  0:50 UTC (permalink / raw)
  To: gdb

Greetings,

I am trying to debug very early stages of bringing up a ppc82xx
kernel. (it's not relevant. but just in case: I'm using a bdi2000)

For some reason gdb fails to read the symbol table such that the text
segment is placed at 0:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
(gdb) show version
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=powerpc-8540-linux-gnu".
(gdb)  sym
Discard symbol table? (y or n) y
No symbol file now.
(gdb) add-symbol-file ../build/linux-2.6-lb4-powerpc/vmlinux  0x40000000
add symbol table from file "../build/linux-2.6-lb4-powerpc/vmlinux" at
        .text_addr = 0x40000000
(y or n) y
Reading symbols from
/local/vb/projects/vanilla-wt/build/linux-2.6-lb4-powerpc/vmlinux...done.
(gdb) p __start
$7 = {<text variable, no debug info>} 0x4000000c <__start>
(gdb) sym
Discard symbol table? (y or n) y
No symbol file now.
(gdb) add-symbol-file ../build/linux-2.6-lb4-powerpc/vmlinux  0x00000000
add symbol table from file "../build/linux-2.6-lb4-powerpc/vmlinux" at
        .text_addr = 0x0
(y or n) y
Reading symbols from
/local/vb/projects/vanilla-wt/build/linux-2.6-lb4-powerpc/vmlinux...done.
(gdb) p __start
$8 = {<text variable, no debug info>} 0x8000000c <__start>
(gdb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


I tried loading it at different offsets, anything else but 0 works
just fine, anyone knows what's wrong?!

TIA,
/vb

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

* Re: add-symbol-file question
  2007-11-20  0:50 add-symbol-file question vb
@ 2007-11-20 12:19 ` Michael Snyder
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2007-11-20 12:19 UTC (permalink / raw)
  To: vb; +Cc: gdb

On Mon, 2007-11-19 at 16:50 -0800, vb wrote:
> Greetings,
> 
> I am trying to debug very early stages of bringing up a ppc82xx
> kernel. (it's not relevant. but just in case: I'm using a bdi2000)
> 
> For some reason gdb fails to read the symbol table such that the text
> segment is placed at 0:
> 
> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
> (gdb) show version
> GNU gdb 6.5
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "--host=i686-pc-linux-gnu
> --target=powerpc-8540-linux-gnu".
> (gdb)  sym
> Discard symbol table? (y or n) y
> No symbol file now.
> (gdb) add-symbol-file ../build/linux-2.6-lb4-powerpc/vmlinux  0x40000000
> add symbol table from file "../build/linux-2.6-lb4-powerpc/vmlinux" at
>         .text_addr = 0x40000000
> (y or n) y
> Reading symbols from
> /local/vb/projects/vanilla-wt/build/linux-2.6-lb4-powerpc/vmlinux...done.
> (gdb) p __start
> $7 = {<text variable, no debug info>} 0x4000000c <__start>
> (gdb) sym
> Discard symbol table? (y or n) y
> No symbol file now.
> (gdb) add-symbol-file ../build/linux-2.6-lb4-powerpc/vmlinux  0x00000000
> add symbol table from file "../build/linux-2.6-lb4-powerpc/vmlinux" at
>         .text_addr = 0x0
> (y or n) y
> Reading symbols from
> /local/vb/projects/vanilla-wt/build/linux-2.6-lb4-powerpc/vmlinux...done.
> (gdb) p __start
> $8 = {<text variable, no debug info>} 0x8000000c <__start>
> (gdb)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> 
> I tried loading it at different offsets, anything else but 0 works
> just fine, anyone knows what's wrong?!

Interesting -- it appears to be setting the MSB.

Some sort of problem with sign bits, I expect...


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

* Re: add-symbol-file question
  2007-09-06  3:19 ` Daniel Jacobowitz
@ 2007-09-06  8:39   ` Mentat K.
  0 siblings, 0 replies; 5+ messages in thread
From: Mentat K. @ 2007-09-06  8:39 UTC (permalink / raw)
  To: Mentat K., gdb

On 9/5/07, Daniel Jacobowitz <drow@false.org> wrote:
> On Wed, Sep 05, 2007 at 07:30:23PM -0400, Mentat K. wrote:
<snip>
> If all you need is that type, build the definition of the type with
> -g into a new object file.  Load it with add-symbol-file at an out of
> the way address so that it does not overlap the code you care about.
> Then you should be able to use the class name and type.
>
> You have to be sure that debug info for the class is in the file you
> compile; sometimes it isn't, with G++.



Cool. Thanks a lot :) works great..



>
> --
> Daniel Jacobowitz
> CodeSourcery
>

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

* Re: add-symbol-file question
  2007-09-05 23:30 Mentat K.
@ 2007-09-06  3:19 ` Daniel Jacobowitz
  2007-09-06  8:39   ` Mentat K.
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-09-06  3:19 UTC (permalink / raw)
  To: Mentat K.; +Cc: gdb

On Wed, Sep 05, 2007 at 07:30:23PM -0400, Mentat K. wrote:
> Hello,
> I am debugging a core that was generated from an app that was compiled
> with gcc 3.2 with -O2 (but without -g). All the shared object libs
> that it links with were similary compiled with -O2 without -g
> 
> One of the shared object libs has a class and I know the address in
> the core file where an object of this class resides. I want to print
> out this object without doing the byte arithmetic myself.
> 
> What would be the simplest way of doing this?

If all you need is that type, build the definition of the type with
-g into a new object file.  Load it with add-symbol-file at an out of
the way address so that it does not overlap the code you care about.
Then you should be able to use the class name and type.

You have to be sure that debug info for the class is in the file you
compile; sometimes it isn't, with G++.

-- 
Daniel Jacobowitz
CodeSourcery

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

* add-symbol-file question
@ 2007-09-05 23:30 Mentat K.
  2007-09-06  3:19 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Mentat K. @ 2007-09-05 23:30 UTC (permalink / raw)
  To: gdb

Hello,
I am debugging a core that was generated from an app that was compiled
with gcc 3.2 with -O2 (but without -g). All the shared object libs
that it links with were similary compiled with -O2 without -g

One of the shared object libs has a class and I know the address in
the core file where an object of this class resides. I want to print
out this object without doing the byte arithmetic myself.

What would be the simplest way of doing this?

I tried the following:
Build that particular sharedlib with -O2-g and then use
add-symbol-file to update the symbol table. I have had luck with this
in the past but in this case, it seems to screw up the stack frames
(as reported by where) So I am guessing this is not always possible.
Also, this is somewhat of an overkill because I am only interested in
that one class.

I am a newbie with debugging techniques etc so any help is appreciated.

Thanks :)

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

end of thread, other threads:[~2007-11-20 12:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-20  0:50 add-symbol-file question vb
2007-11-20 12:19 ` Michael Snyder
  -- strict thread matches above, loose matches on Subject: below --
2007-09-05 23:30 Mentat K.
2007-09-06  3:19 ` Daniel Jacobowitz
2007-09-06  8:39   ` Mentat K.

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