This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

(PPC64) 64 bit GDB unable to set br in 32bit app


Andrew,

I am trying to debug a 32 bit app using a 64 bit GDB on a PowerPC64 bit
machine, I am not able to set a breakpoint in the 32 bit app. I get the
following error.

Warning:
Cannot insert breakpoint -1.
Error accessing memory address 0xffffc4f4: Input/output error.

(gdb)

To recreate the problem, you need a PowerPC64 machine, build GDB (GDB 6.0)
as a 64bit binary, and use any 32bit app and try to debug this app. Set a
break point in main() and use the gdb command run.

I did some amount of debugging and I found that read_pc() is not returning
the value of PC correctly instead returns 0. So the base address of the
dynamic linker is miscalculated.

File:regcache.c read_pc_pid(): raw_val = 0
File:regcache.c read_pc_pid(): pc_val = 0

read_pc() calls legacy_read_register_gen() function which calls
register_buffer() which is used to read the contents of the structure
(struct regcache *regcache) and returns a pointer to the register buffer
cache. I think this is where the problem is. The contents of the memory
location that this pointer points to are all 0x0's and that shouldint be
the case. legacy_read_register_gen() does a memcpy() from this location to
a variable myaddr ultimately used in the calculations to find the base
address of the dynamic linker.

So since the base address of the dynamic linker (ld.so), GDB is unable to
set default break points in _dl_debug_state. And GDB fails in the init
stage itself.

I dont have a good understanding of the structures regcache and
regcache_dscr to do more debugging.

Am I on the right track? Please help.

Thanks
Manoj Iyer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]