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] |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The attached patch makes gcore dump the contents of PPC Altivec registers. However, I'm not happy with declaring a bunch of PPC-specific stuff in gregset.h. But since FPXREGSET was there, I put everything in that file as well. I'm open to comments about how to make this better, so please give me some thoughts. Thanks and regards, - -- Carlos Eduardo Seo Software Engineer IBM Linux Technology Center -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHIj9Qqvq7Aov/qQARAqynAJ4yaW/b7X0jloBCvIluJmZZWP8jpQCff44Z suYd5ULIiP5pXvSnhyjX/T0= =qmI6 -----END PGP SIGNATURE-----
2007-10-26 Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> * linux-nat.c (linux_nat_do_thread_registers): Added support for PPC Altivec registers. * ppc-linux-nat.c: Removed definitions of SIZEOF_VRREGS and gdb_vrregset_t. * gregset.h: Added definitions of SIZEOF_VRREGS and gdb_vrregset_t. (fill_vrregset): Declare. Index: src/gdb/linux-nat.c =================================================================== --- src.orig/gdb/linux-nat.c +++ src/gdb/linux-nat.c @@ -2616,6 +2616,7 @@ linux_nat_do_thread_registers (bfd *obfd { gdb_gregset_t gregs; gdb_fpregset_t fpregs; + gdb_vrregset_t vrregs; #ifdef FILL_FPXREGSET gdb_fpxregset_t fpxregs; #endif @@ -2676,6 +2677,21 @@ linux_nat_do_thread_registers (bfd *obfd note_size, &fpxregs, sizeof (fpxregs)); #endif + + if (core_regset_p + && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg-ppc-vmx", + sizeof (vrregs))) != NULL + && regset->collect_regset != NULL) + regset->collect_regset (regset, regcache, -1, + &vrregs, sizeof (vrregs)); + else + fill_vrregset (regcache, &vrregs); + + note_data = (char *) elfcore_write_ppc_vmx (obfd, + note_data, + note_size, + &vrregs, sizeof (vrregs)); + return note_data; } Index: src/gdb/ppc-linux-nat.c =================================================================== --- src.orig/gdb/ppc-linux-nat.c +++ src/gdb/ppc-linux-nat.c @@ -79,38 +79,6 @@ #define PTRACE_GETSIGINFO 0x4202 #endif -/* This oddity is because the Linux kernel defines elf_vrregset_t as - an array of 33 16 bytes long elements. I.e. it leaves out vrsave. - However the PTRACE_GETVRREGS and PTRACE_SETVRREGS requests return - the vrsave as an extra 4 bytes at the end. I opted for creating a - flat array of chars, so that it is easier to manipulate for gdb. - - There are 32 vector registers 16 bytes longs, plus a VSCR register - which is only 4 bytes long, but is fetched as a 16 bytes - quantity. Up to here we have the elf_vrregset_t structure. - Appended to this there is space for the VRSAVE register: 4 bytes. - Even though this vrsave register is not included in the regset - typedef, it is handled by the ptrace requests. - - Note that GNU/Linux doesn't support little endian PPC hardware, - therefore the offset at which the real value of the VSCR register - is located will be always 12 bytes. - - The layout is like this (where x is the actual value of the vscr reg): */ - -/* *INDENT-OFF* */ -/* - |.|.|.|.|.....|.|.|.|.||.|.|.|x||.| - <-------> <-------><-------><-> - VR0 VR31 VSCR VRSAVE -*/ -/* *INDENT-ON* */ - -#define SIZEOF_VRREGS 33*16+4 - -typedef char gdb_vrregset_t[SIZEOF_VRREGS]; - - /* On PPC processors that support the the Signal Processing Extension (SPE) APU, the general-purpose registers are 64 bits long. However, the ordinary Linux kernel PTRACE_PEEKUSER / PTRACE_POKEUSER @@ -687,7 +655,7 @@ store_register (const struct regcache *r } } -static void +void fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp) { int i; Index: src/gdb/gregset.h =================================================================== --- src.orig/gdb/gregset.h +++ src/gdb/gregset.h @@ -72,4 +72,40 @@ extern void fill_fpxregset (const struct gdb_fpxregset_t *fpxregs, int regno); #endif +/* For PPC Altivec support */ + +/* This oddity is because the Linux kernel defines elf_vrregset_t as + an array of 33 16 bytes long elements. I.e. it leaves out vrsave. + However the PTRACE_GETVRREGS and PTRACE_SETVRREGS requests return + the vrsave as an extra 4 bytes at the end. I opted for creating a + flat array of chars, so that it is easier to manipulate for gdb. + + There are 32 vector registers 16 bytes longs, plus a VSCR register + which is only 4 bytes long, but is fetched as a 16 bytes + quantity. Up to here we have the elf_vrregset_t structure. + Appended to this there is space for the VRSAVE register: 4 bytes. + Even though this vrsave register is not included in the regset + typedef, it is handled by the ptrace requests. + + Note that GNU/Linux doesn't support little endian PPC hardware, + therefore the offset at which the real value of the VSCR register + is located will be always 12 bytes. + + The layout is like this (where x is the actual value of the vscr reg): */ + +/* *INDENT-OFF* */ +/* + |.|.|.|.|.....|.|.|.|.||.|.|.|x||.| + <-------> <-------><-------><-> + VR0 VR31 VSCR VRSAVE +*/ +/* *INDENT-ON* */ + +#define SIZEOF_VRREGS 33*16+4 + +typedef char gdb_vrregset_t[SIZEOF_VRREGS]; + +extern void +fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp); + #endif
Attachment:
gcore-altivec.diff.sig
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |