Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: Map offsets
@ 2002-03-16  7:47 Bäng-ha  
  2002-03-16  9:33 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Bäng-ha   @ 2002-03-16  7:47 UTC (permalink / raw)
  To: drow; +Cc: gdb

OK, now you made me curious... I've been thinking a long time about reading 
about ELF, but please tell me what that number indicates, would you?
I'm using gdb-5.0rh-5

----Original Message Follows----
From: Daniel Jacobowitz <drow@mvista.com>
To: Bäng-ha   <jpbarda@hotmail.com>
CC: gdb@sources.redhat.com
Subject: Re: Map offsets
Date: Sat, 9 Mar 2002 11:09:53 -0500
User-Agent: Mutt/1.3.23i

On Sat, Mar 09, 2002 at 03:52:34PM +0000, B?ng-ha ? wrote:
 > Hi!
 >
 > I'm sure this is a rather stupid question, but I'll ask it anyway:
 > I'm debugging a couple of processes under linux, and I want to load the
 > symbols from glibc. Now, the only way I've managed to figure out as to
 > perform the task of finding the base address of libc if to look at the
 > memory maps in /proc/?/maps, whence I get the base address of libc to be
 > e.g. 0x40020000 (this was for mingetty). So naturally, I do 
add-symbol-file
 > /lib/libc-2.2.2.so 0x4002000, but as it turns, it should be loaded
 > 0x4003BCB0, i.e. at an offset of 0x1BCB0 from what /proc says. (I got the
 > exact offset from looking at the dynamically linked function tables and
 > comparing the read function to what was acutally loaded, if that would
 > somehow matter) Anyway, I guess I could live with this small annoyance, 
if
 > it wasn't for that other libs wants to be loaded with other offsets. 
0x1BCB0
 >
 > didn't work with e.g. libresolv. And, I want to know the cause of this as
 > well, of
 > course.
 > So could someone tell me how to get the real offset, because I can't 
imagine
 >
 > that there isn't an error-free way to get the address, right?

objdump -x /lib/libc.so.6:

  10 .text         000e1460  0001d500  0001d500  0001d500  2**4
                   CONTENTS, ALLOC, LOAD, READONLY, CODE

That second number.

This should absolutely not be necessary!  GDB should do it
automatically.  What version of GDB are you using?

--
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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

* Re: Map offsets
  2002-03-16  7:47 Map offsets Bäng-ha  
@ 2002-03-16  9:33 ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-03-16  9:33 UTC (permalink / raw)
  To: =?unknown-8bit?B?QuRuZy1oYSCg?=; +Cc: gdb

On Sat, Mar 16, 2002 at 03:47:26PM +0000, B?ng-ha ? wrote:
> OK, now you made me curious... I've been thinking a long time about reading 
> about ELF, but please tell me what that number indicates, would you?
> I'm using gdb-5.0rh-5

VMA, or virtual memory address.  I would recommend a good ELF
reference, but I don't know of any.


> 
> ----Original Message Follows----
> From: Daniel Jacobowitz <drow@mvista.com>
> To: B?ng-ha ? <jpbarda@hotmail.com>
> CC: gdb@sources.redhat.com
> Subject: Re: Map offsets
> Date: Sat, 9 Mar 2002 11:09:53 -0500
> User-Agent: Mutt/1.3.23i
> 
> On Sat, Mar 09, 2002 at 03:52:34PM +0000, B?ng-ha ? wrote:
> > Hi!
> >
> > I'm sure this is a rather stupid question, but I'll ask it anyway:
> > I'm debugging a couple of processes under linux, and I want to load the
> > symbols from glibc. Now, the only way I've managed to figure out as to
> > perform the task of finding the base address of libc if to look at the
> > memory maps in /proc/?/maps, whence I get the base address of libc to be
> > e.g. 0x40020000 (this was for mingetty). So naturally, I do 
> add-symbol-file
> > /lib/libc-2.2.2.so 0x4002000, but as it turns, it should be loaded
> > 0x4003BCB0, i.e. at an offset of 0x1BCB0 from what /proc says. (I got the
> > exact offset from looking at the dynamically linked function tables and
> > comparing the read function to what was acutally loaded, if that would
> > somehow matter) Anyway, I guess I could live with this small annoyance, 
> if
> > it wasn't for that other libs wants to be loaded with other offsets. 
> 0x1BCB0
> >
> > didn't work with e.g. libresolv. And, I want to know the cause of this as
> > well, of
> > course.
> > So could someone tell me how to get the real offset, because I can't 
> imagine
> >
> > that there isn't an error-free way to get the address, right?
> 
> objdump -x /lib/libc.so.6:
> 
>  10 .text         000e1460  0001d500  0001d500  0001d500  2**4
>                   CONTENTS, ALLOC, LOAD, READONLY, CODE
> 
> That second number.
> 
> This should absolutely not be necessary!  GDB should do it
> automatically.  What version of GDB are you using?
> 
> --
> Daniel Jacobowitz                           Carnegie Mellon University
> MontaVista Software                         Debian GNU/Linux Developer
> 
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> 

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: Map offsets
  2002-03-09  7:52 Bäng-ha  
@ 2002-03-09  8:09 ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-03-09  8:09 UTC (permalink / raw)
  To: =?unknown-8bit?B?QuRuZy1oYSCg?=; +Cc: gdb

On Sat, Mar 09, 2002 at 03:52:34PM +0000, B?ng-ha ? wrote:
> Hi!
> 
> I'm sure this is a rather stupid question, but I'll ask it anyway:
> I'm debugging a couple of processes under linux, and I want to load the 
> symbols from glibc. Now, the only way I've managed to figure out as to 
> perform the task of finding the base address of libc if to look at the 
> memory maps in /proc/?/maps, whence I get the base address of libc to be 
> e.g. 0x40020000 (this was for mingetty). So naturally, I do add-symbol-file 
> /lib/libc-2.2.2.so 0x4002000, but as it turns, it should be loaded 
> 0x4003BCB0, i.e. at an offset of 0x1BCB0 from what /proc says. (I got the 
> exact offset from looking at the dynamically linked function tables and 
> comparing the read function to what was acutally loaded, if that would
> somehow matter) Anyway, I guess I could live with this small annoyance, if 
> it wasn't for that other libs wants to be loaded with other offsets. 0x1BCB0 
> 
> didn't work with e.g. libresolv. And, I want to know the cause of this as 
> well, of
> course.
> So could someone tell me how to get the real offset, because I can't imagine 
> 
> that there isn't an error-free way to get the address, right?

objdump -x /lib/libc.so.6:

 10 .text         000e1460  0001d500  0001d500  0001d500  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

That second number.

This should absolutely not be necessary!  GDB should do it
automatically.  What version of GDB are you using?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Map offsets
@ 2002-03-09  7:52 Bäng-ha  
  2002-03-09  8:09 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Bäng-ha   @ 2002-03-09  7:52 UTC (permalink / raw)
  To: gdb

Hi!

I'm sure this is a rather stupid question, but I'll ask it anyway:
I'm debugging a couple of processes under linux, and I want to load the 
symbols from glibc. Now, the only way I've managed to figure out as to 
perform the task of finding the base address of libc if to look at the 
memory maps in /proc/?/maps, whence I get the base address of libc to be 
e.g. 0x40020000 (this was for mingetty). So naturally, I do add-symbol-file 
/lib/libc-2.2.2.so 0x4002000, but as it turns, it should be loaded 
0x4003BCB0, i.e. at an offset of 0x1BCB0 from what /proc says. (I got the 
exact offset from looking at the dynamically linked function tables and 
comparing the read function to what was acutally loaded, if that would
somehow matter) Anyway, I guess I could live with this small annoyance, if 
it wasn't for that other libs wants to be loaded with other offsets. 0x1BCB0 
didn't work with e.g. libresolv. And, I want to know the cause of this as 
well, of
course.
So could someone tell me how to get the real offset, because I can't imagine 
that there isn't an error-free way to get the address, right?

Thanks in advance
Fredrik Tolf


_________________________________________________________________
Join the worldÂ’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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

end of thread, other threads:[~2002-03-16 17:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-16  7:47 Map offsets Bäng-ha  
2002-03-16  9:33 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2002-03-09  7:52 Bäng-ha  
2002-03-09  8:09 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox