* (PPC64) 64 bit GDB unable to set br in 32bit app
@ 2004-03-09 5:55 Manoj Iyer
2004-03-09 20:03 ` Andrew Cagney
0 siblings, 1 reply; 6+ messages in thread
From: Manoj Iyer @ 2004-03-09 5:55 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (PPC64) 64 bit GDB unable to set br in 32bit app
2004-03-09 5:55 (PPC64) 64 bit GDB unable to set br in 32bit app Manoj Iyer
@ 2004-03-09 20:03 ` Andrew Cagney
2004-03-10 19:28 ` Manoj Iyer
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2004-03-09 20:03 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb
> Andrew,
>
> I am trying to debug a 32 bit app using a 64 bit GDB on a PowerPC64 bit
> machine,
You'll need a very recent GDB (which contains fixes for the can't insert
breakpoint problem you noticed) a long with these fixes:
http://sources.redhat.com/ml/gdb-patches/2004-03/msg00177.html
http://sources.redhat.com/ml/gdb-patches/2004-03/msg00176.html
which make GDB's handling of register sets more robust.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (PPC64) 64 bit GDB unable to set br in 32bit app
2004-03-09 20:03 ` Andrew Cagney
@ 2004-03-10 19:28 ` Manoj Iyer
2004-03-11 19:30 ` Andrew Cagney
0 siblings, 1 reply; 6+ messages in thread
From: Manoj Iyer @ 2004-03-10 19:28 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb
Andrew,
> You'll need a very recent GDB (which contains fixes for the can't insert
> breakpoint problem you noticed) a long with these fixes:
> http://sources.redhat.com/ml/gdb-patches/2004-03/msg00177.html
> http://sources.redhat.com/ml/gdb-patches/2004-03/msg00176.html
> which make GDB's handling of register sets more robust.
Are these patches valid for gdb 6.1 as well?? or does gdb6.1 take care of
these problems? I tried these patches on a 6.1 tree and seems like I am
missing something... I get an ppc-linux-tdep.c:1046: error:
`ppc32_linux_gregset' undeclared (first use in this function)
Thanks
Manoj
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (PPC64) 64 bit GDB unable to set br in 32bit app
2004-03-10 19:28 ` Manoj Iyer
@ 2004-03-11 19:30 ` Andrew Cagney
2004-03-11 20:30 ` Manoj Iyer
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2004-03-11 19:30 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb
> Andrew,
>
>
>>> You'll need a very recent GDB (which contains fixes for the can't insert
>>> breakpoint problem you noticed) a long with these fixes:
>>> http://sources.redhat.com/ml/gdb-patches/2004-03/msg00177.html
>>> http://sources.redhat.com/ml/gdb-patches/2004-03/msg00176.html
>>> which make GDB's handling of register sets more robust.
>
>
> Are these patches valid for gdb 6.1 as well?? or does gdb6.1 take care of
> these problems? I tried these patches on a 6.1 tree and seems like I am
> missing something... I get an ppc-linux-tdep.c:1046: error:
> `ppc32_linux_gregset' undeclared (first use in this function)
They are mainline patches that may get backported to 6.1. I'm wondering
if the patches applied cleanly as they appear to contain:
+static struct regset ppc32_linux_gregset = {
+ NULL, ppc32_linux_supply_gregset
+};
...
+ppc_linux_regset_from_core_section (struct gdbarch *core_arch,
+ const char *sect_name, size_t sect_size)
...
+ if (tdep->wordsize == 4)
+ return &ppc32_linux_gregset;
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (PPC64) 64 bit GDB unable to set br in 32bit app
2004-03-11 19:30 ` Andrew Cagney
@ 2004-03-11 20:30 ` Manoj Iyer
2004-03-12 22:00 ` Andrew Cagney
0 siblings, 1 reply; 6+ messages in thread
From: Manoj Iyer @ 2004-03-11 20:30 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb
On Thu, 11 Mar 2004, Andrew Cagney wrote:
>
> They are mainline patches that may get backported to 6.1. I'm wondering
> if the patches applied cleanly as they appear to contain:
>
> +static struct regset ppc32_linux_gregset = {
> + NULL, ppc32_linux_supply_gregset
> +};
> ...
> +ppc_linux_regset_from_core_section (struct gdbarch *core_arch,
> + const char *sect_name, size_t sect_size)
> ...
> + if (tdep->wordsize == 4)
> + return &ppc32_linux_gregset;
>
No some of them did not, I had to hand edit the code by looking at the
patch. BUT. When I use the latest compiler(powerpc64-linux-gcc (GCC)
3.3.3-hammer), ppc-linux-tdep.c fails to compile, it complains of
undeclared variables ppc32_linux_gregset.
--
Manjo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (PPC64) 64 bit GDB unable to set br in 32bit app
2004-03-11 20:30 ` Manoj Iyer
@ 2004-03-12 22:00 ` Andrew Cagney
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2004-03-12 22:00 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb
> On Thu, 11 Mar 2004, Andrew Cagney wrote:
>
>
>>>
>>> They are mainline patches that may get backported to 6.1. I'm wondering
>>> if the patches applied cleanly as they appear to contain:
>>>
>>> +static struct regset ppc32_linux_gregset = {
>>> + NULL, ppc32_linux_supply_gregset
>>> +};
>>> ...
>>> +ppc_linux_regset_from_core_section (struct gdbarch *core_arch,
>>> + const char *sect_name, size_t sect_size)
>>> ...
>>> + if (tdep->wordsize == 4)
>>> + return &ppc32_linux_gregset;
>>>
>
>
> No some of them did not, I had to hand edit the code by looking at the
> patch.
It sounds like a problem with the hand editing then - per the above the
variable does appear to have been added.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-03-12 22:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-09 5:55 (PPC64) 64 bit GDB unable to set br in 32bit app Manoj Iyer
2004-03-09 20:03 ` Andrew Cagney
2004-03-10 19:28 ` Manoj Iyer
2004-03-11 19:30 ` Andrew Cagney
2004-03-11 20:30 ` Manoj Iyer
2004-03-12 22:00 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox