public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* RE: Determining base address of shared library from core file
@ 2004-07-26 19:33 Bloch, Jack
  2004-07-26 21:09 ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Bloch, Jack @ 2004-07-26 19:33 UTC (permalink / raw)
  To: 'Kevin Buettner'; +Cc: gdb

When doing this, I find a DT_DEBUG entry but is has a zero in the d_un.d_val
field (I am supposed to look at the executable and not the core dump right?)

-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Wednesday, July 21, 2004 1:53 PM
To: Bloch, Jack
Cc: gdb@sources.redhat.com
Subject: Re: Determining base address of shared library from core file


On Mon, 19 Jul 2004 07:51:31 -0700
"Bloch, Jack" <Jack.Bloch@icn.siemens.com> wrote:

> Is there an easy way to determine the base address of a shared library
from
> a core file?

It depends upon what you mean by "easy".

For an SVR4-like system (which includes Linux), you have to traverse
the dynamic section to find the address of the r_debug struct.  Once
that is done, you still have to traverse the link_map structs to find
the desired address.  See solib-svr4.c for the gory details.

(IMO, this isn't very easy.)

Kevin

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

* Re: Determining base address of shared library from core file
  2004-07-26 19:33 Determining base address of shared library from core file Bloch, Jack
@ 2004-07-26 21:09 ` Kevin Buettner
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2004-07-26 21:09 UTC (permalink / raw)
  To: Bloch, Jack; +Cc: gdb

On Mon, 26 Jul 2004 12:20:10 -0700
"Bloch, Jack" <jack.bloch@siemens.com> wrote:

> When doing this, I find a DT_DEBUG entry but is has a zero in the d_un.d_val
> field

I don't know why you're seeing this.  (Let me know when you figure it out...)

> (I am supposed to look at the executable and not the core dump right?)

Right.

Kevin

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

* Re: Determining base address of shared library from core file
  2004-07-26 21:15 Bloch, Jack
@ 2004-07-27 22:06 ` Kevin Buettner
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2004-07-27 22:06 UTC (permalink / raw)
  To: Bloch, Jack; +Cc: gdb

On Mon, 26 Jul 2004 14:13:40 -0700
"Bloch, Jack" <jack.bloch@siemens.com> wrote:

> BTW, if I run readelf -d on my executable, it show a debug segment with a
> 0x0. I don't have to load the executable into memory somehow do I? 

Yes, you have to fetch the dynamic section from the loaded process and
scan it instead of the contents of the executable.  The dynamic linker
will have adjusted the in-memory copy of the dynamic section to contain
values relevant to the running process.

Kevin

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

* RE: Determining base address of shared library from core file
@ 2004-07-26 21:15 Bloch, Jack
  2004-07-27 22:06 ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Bloch, Jack @ 2004-07-26 21:15 UTC (permalink / raw)
  To: 'Kevin Buettner'; +Cc: gdb

BTW, if I run readelf -d on my executable, it show a debug segment with a
0x0. I don't have to load the executable into memory somehow do I? 

-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Wednesday, July 21, 2004 1:53 PM
To: Bloch, Jack
Cc: gdb@sources.redhat.com
Subject: Re: Determining base address of shared library from core file


On Mon, 19 Jul 2004 07:51:31 -0700
"Bloch, Jack" <Jack.Bloch@icn.siemens.com> wrote:

> Is there an easy way to determine the base address of a shared library
from
> a core file?

It depends upon what you mean by "easy".

For an SVR4-like system (which includes Linux), you have to traverse
the dynamic section to find the address of the r_debug struct.  Once
that is done, you still have to traverse the link_map structs to find
the desired address.  See solib-svr4.c for the gory details.

(IMO, this isn't very easy.)

Kevin

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

* Re: Determining base address of shared library from core file
  2004-07-19 18:28 Bloch, Jack
@ 2004-07-21 17:58 ` Kevin Buettner
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2004-07-21 17:58 UTC (permalink / raw)
  To: Bloch, Jack; +Cc: gdb

On Mon, 19 Jul 2004 07:51:31 -0700
"Bloch, Jack" <Jack.Bloch@icn.siemens.com> wrote:

> Is there an easy way to determine the base address of a shared library from
> a core file?

It depends upon what you mean by "easy".

For an SVR4-like system (which includes Linux), you have to traverse
the dynamic section to find the address of the r_debug struct.  Once
that is done, you still have to traverse the link_map structs to find
the desired address.  See solib-svr4.c for the gory details.

(IMO, this isn't very easy.)

Kevin

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

* Determining base address of shared library from core file
@ 2004-07-19 18:28 Bloch, Jack
  2004-07-21 17:58 ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Bloch, Jack @ 2004-07-19 18:28 UTC (permalink / raw)
  To: gdb

Is there an easy way to determine the base address of a shared library from
a core file?

Jack Bloch 
Siemens ICN
phone                (561) 923-6550
e-mail                jack.bloch@icn.siemens.com

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

end of thread, other threads:[~2004-07-27 21:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-26 19:33 Determining base address of shared library from core file Bloch, Jack
2004-07-26 21:09 ` Kevin Buettner
  -- strict thread matches above, loose matches on Subject: below --
2004-07-26 21:15 Bloch, Jack
2004-07-27 22:06 ` Kevin Buettner
2004-07-19 18:28 Bloch, Jack
2004-07-21 17:58 ` Kevin Buettner

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