remote debugging and source files

Hinko Kocevar hinko.kocevar@iskramedical.si
Wed Aug 25 13:58:00 GMT 2004


Kris Warkentin wrote:
> Hmm...according to your info shared, you have the loader here:
> 
> 0x40001460  0x40011914  No 
> /opt/arm-linux/gcc-3.3.3-glibc-2.3.2/arm-softfloat-linux-gnu/lib/ld-linux.so.2 
> 
> 
> so the breakpoint doesn't seem entirely unreasonable.  Is there any 
> possibility that you have a different ld-linux.so.2 on the host and 
> target? 

It is same version on the host and on the target - glibc-2.3.2., but the 
one on target is cross compiled for ARM architecture, though. Is there 
any other kind of difference we are interested here?

If debugging host application debugger stops on dynamic library load as 
expected and 'info shared' says
(gdb) info sharedlibrary
 From        To          Syms Read   Shared Object Library
0x40034680  0x400aadb4  Yes         /usr/X11R6/lib/libX11.so.6
0x40134b40  0x4022f7b4  Yes         /lib/i686/libc.so.6
0x40252eb0  0x40253de4  Yes         /lib/libdl.so.2
0x40000c00  0x400139ef  Yes         /lib/ld-linux.so.2

> Then gdb would be calculating the breakpoint incorrectly based 
> on the host loader.  If you take a look at /usr/include/link.h, you'll 
> find the r_debug structure.  The comments in there will help you 
> calculate the breakpoint by hand (look at the r_brk element) and then 
> you can compare it to what gdb is coming up with.
> 

Sounds easy, but to me, it is not - at all :).
OK, here goes...
I did 'maintenance info breakpoints' while debugging native app:
...
-16 shlib events   keep y   0x4000dd60 <_dl_debug_state_internal>
         breakpoint already hit 3 times
...

So debugger stoped on shared library event 3 times (three dynamic libs 
were loaded) at <_dl_debug_state_internal> symbol found in ld-2.3.2.so. 
Using objdump I got the same offset, 0x0000dd60, for 
_dl_debug_state_internal.

On ARM target using the same technique, shlib events are at 0x4000b8d8 
while arm-linux-objdump says that _dl_debug_state_internal is at offset 
0x0000c258. After setting breakpoint to 0x0000c258 debugger stopped 7 
times (according to comments around r_debug that is OK) before my app 
was stated.

Offset 0x0000b8d8 is location in _dl_signal_error.

So how do I convince gdb to use correct address for shlib event?


regards,
h

-- 
hinko <dot> kocevar <at> iskramedical <dot> si
Hinko Kocevar, developer
Iskra Medical d.o.o., Stegne 23, 1k LJ, SLO-EU

	"Aì rén"	|	[Analects XII:22]



More information about the Gdb mailing list