This is the mail archive of the gdb-patches@sourceware.org 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]

Re: powerpc-linux biarch corefile support


On Wed, Aug 29, 2007 at 01:03:05AM +0200, Ulrich Weigand wrote:
> In particular, the original code appears to treat CCR, XER, and CTR
> as left-aligned, and the others as right-aligned:
[snip]
> 
> Your new code makes no such distinction, they're all treated as
> right-aligned.
> 
> I wonder whether this change was deliberate?  It does appear the
> original code is actually wrong; the kernel stores CCR, XER, and
> CRT just the same as e.g. NIP and LNK, as far as I can see.

I should have mentioned this change.  It was deliberate.  The old code
was just plain wrong (and the reason why "info reg" on a 64-bit core
file always showed zero for CR and XER).  It was inconsistent too.
CTR used right fill in ppc-linux-nat.c:fill_gregset but left fill in
ppc-linux-tdep.c:ppc_linux_supply_gregset.  I suspect that using left
fill for CTR was just a copy and paste error, but the comment Andrew
Cagney added seems to indicate he meant to use left-fill for CR and
XER.  Perhaps the ppc64 linux kernel stored them that way at some
stage?  I'll ask some kernel experts.

> Did you verify that those registers are now handled correctly in
> both 64x64 and 32x64 cases (native and core)?

Yes.

> Also, you missed setting the gpr_size field in a couple of cases:
> rs6000-aix-tdep.c:rs6000_aix32_reg_offsets
> rs6000-aix-tdep.c:rs6000_aix64_reg_offsets
> ppcobsd-nat.c:ppcobsd_reg_offsets

Oops, shame on me.  I'll fix that.

> And, since you're now using gpr_size in the _fpregset routines as
> well, I guess ppcobsd_fpreg_offsets would need to set gpr_size too.
> However, I think it would be preferable to not use gpr_size in
> those routines in the first place; the size of this register is in
> fact always 4.

However, the fpscr field is 64 bits in struct ucontext on both
powerpc64-linux and powerpc-linux, and the definition of PT_FPSCR
points to the low 32 bits on powerpc-linux and the full 64-bit word on
powerpc64-linux.  Since the size passed to ppc_supply_reg and
ppc_collect_reg is that of the field, I figured that it ought to be 8
bytes on powerpc64-linux.  I could make the size 4 and adjust the
offset in ppc64_linux_reg_offsets, but I had ideas of using
ppc_greg_offset and ppc_fpreg_offset in place of
ppc-linux-nat.c:ppc_register_u_addr, which provides an offset into
ucontext.  PTRACE_PEEKUSER and PTRACE_POKEUSER bomb on ppc64 if the
offset isn't a multiple of 8...

-- 
Alan Modra
Australia Development Lab, IBM


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