diff options
author | Daniel Jacobowitz <drow@false.org> | 2009-07-28 18:26:51 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2009-07-28 18:26:51 +0000 |
commit | 58d6951de562a3ef2214927006541fc16f0e5bd0 (patch) | |
tree | 53dbf386a054ee94e4559b475732f0ef2c821f95 /gdb/gdbserver | |
parent | 12b42a12507a884c4e78b2a8c31ecab4d4534ae6 (diff) | |
download | gdb-58d6951de562a3ef2214927006541fc16f0e5bd0.zip gdb-58d6951de562a3ef2214927006541fc16f0e5bd0.tar.gz gdb-58d6951de562a3ef2214927006541fc16f0e5bd0.tar.bz2 |
* NEWS: Mention ARM VFP support.
* target-descriptions.c (tdesc_register_type): Make public.
(tdesc_unnumbered_register): New function.
(tdesc_register_reggroup_p): Allow missing
pseudo_register_reggroup_p.
* target-descriptions.h (tdesc_register_type): Declare.
(tdesc_unnumbered_register): Declare.
* arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions.
(arm_push_dummy_call): Use arm_neon_quad_write.
(arm_neon_double_type, arm_neon_quad_type): New functions.
(arm_register_type): Handle VFP and NEON registers. Override the
types of double-precision registers for NEON. Disable FPA registers
if they are not present.
(arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers.
(arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read.
(arm_register_name): Handle VFP single and NEON quad registers.
(arm_pseudo_read, arm_pseudo_write): New functions.
(arm_gdbarch_init): Check for VFP and NEON in the target description.
Assign numbers to double-precision registers. Register VFP and NEON
pseudo registers. Remove a shadowed "i" variable.
* arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and
ARM_D31_REGNUM.
(struct gdbarch_tdep): Add have_neon_pseudos, have_neon,
have_vfp_registers, have_vfp_pseudos, neon_double_type,
and neon_quad_type.
* features/Makefile: Make expedite settings only architecture
specific.
(WHICH): Add new ARM descriptions.
* features/arm-with-neon.xml, features/arm-with-vfpv2.c,
features/arm-with-vfpv3.c, features/arm-vfpv2.xml,
features/arm-vfpv3.xml, features/arm-with-vfpv2.xml,
features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files.
* regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat,
regformats/arm-with-vfpv3.dat: Generate.
doc/
* gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and
org.gnu.gdb.arm.neon.
gdbserver/
* linux-low.c (linux_write_memory): Update debugging output.
* Makefile.in (clean): Add new descriptions.
(arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o)
(arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules.
* configure.srv: Add new files for arm*-*-linux*.
* linux-arm-low.c: Add new declarations.
(PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined.
(arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3)
(HWCAP_VFPv3D16): New.
(arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT
instead of __IWMMXT__.
(arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap)
(arm_arch_setup): New.
(target_regsets): Remove #ifdef. Add VFP regset.
(the_low_target): Use arm_arch_setup.
testsuite/
* gdb.base/float.exp: Handle VFP registers.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 18 | ||||
-rw-r--r-- | gdb/gdbserver/Makefile.in | 13 | ||||
-rw-r--r-- | gdb/gdbserver/configure.srv | 8 | ||||
-rw-r--r-- | gdb/gdbserver/linux-arm-low.c | 153 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 11 |
5 files changed, 189 insertions, 14 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index b878baf..27838a5 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,23 @@ 2009-07-28 Daniel Jacobowitz <dan@codesourcery.com> + * linux-low.c (linux_write_memory): Update debugging output. + * Makefile.in (clean): Add new descriptions. + (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) + (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. + * configure.srv: Add new files for arm*-*-linux*. + * linux-arm-low.c: Add new declarations. + (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. + (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) + (HWCAP_VFPv3D16): New. + (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT + instead of __IWMMXT__. + (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) + (arm_arch_setup): New. + (target_regsets): Remove #ifdef. Add VFP regset. + (the_low_target): Use arm_arch_setup. + +2009-07-28 Daniel Jacobowitz <dan@codesourcery.com> + * linux-low.c (linux_kill_one_lwp): Adjust kernel workaround to skip the main thread again. diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 37d6095..eea59a1 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -205,7 +205,9 @@ clean: rm -f reg-arm.c reg-i386.c reg-ia64.c reg-m32r.c reg-m68k.c rm -f reg-sh.c reg-sparc.c reg-spu.c reg-x86-64.c reg-i386-linux.c rm -f reg-cris.c reg-crisv32.c reg-x86-64-linux.c reg-xtensa.c - rm -f arm-with-iwmmxt.c mips-linux.c mips64-linux.c + rm -f arm-with-iwmmxt.c + rm -f arm-with-vfpv2.c arm-with-vfpv3.c arm-with-neon.c + rm -f mips-linux.c mips64-linux.c rm -f powerpc-32l.c powerpc-64l.c powerpc-e500l.c rm -f powerpc-altivec32l.c powerpc-vsx32l.c powerpc-altivec64l.c rm -f powerpc-vsx64l.c @@ -326,6 +328,15 @@ reg-arm.c : $(srcdir)/../regformats/reg-arm.dat $(regdat_sh) arm-with-iwmmxt.o : arm-with-iwmmxt.c $(regdef_h) arm-with-iwmmxt.c : $(srcdir)/../regformats/arm-with-iwmmxt.dat $(regdat_sh) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/arm-with-iwmmxt.dat arm-with-iwmmxt.c +arm-with-vfpv2.o : arm-with-vfpv2.c $(regdef_h) +arm-with-vfpv2.c : $(srcdir)/../regformats/arm-with-vfpv2.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/arm-with-vfpv2.dat arm-with-vfpv2.c +arm-with-vfpv3.o : arm-with-vfpv3.c $(regdef_h) +arm-with-vfpv3.c : $(srcdir)/../regformats/arm-with-vfpv3.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/arm-with-vfpv3.dat arm-with-vfpv3.c +arm-with-neon.o : arm-with-neon.c $(regdef_h) +arm-with-neon.c : $(srcdir)/../regformats/arm-with-neon.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/arm-with-neon.dat arm-with-neon.c reg-cris.o : reg-cris.c $(regdef_h) reg-cris.c : $(srcdir)/../regformats/reg-cris.dat $(regdat_sh) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-cris.dat reg-cris.c diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index b3ab622..900b565 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -26,10 +26,18 @@ srv_hostio_err_objs="hostio-errno.o" case "${target}" in arm*-*-linux*) srv_regobj="reg-arm.o arm-with-iwmmxt.o" + srv_regobj="${srv_regobj} arm-with-vfpv2.o" + srv_regobj="${srv_regobj} arm-with-vfpv3.o" + srv_regobj="${srv_regobj} arm-with-neon.o" srv_tgtobj="linux-low.o linux-arm-low.o" srv_xmlfiles="arm-with-iwmmxt.xml" + srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv2.xml" + srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv3.xml" + srv_xmlfiles="${srv_xmlfiles} arm-with-neon.xml" srv_xmlfiles="${srv_xmlfiles} arm-core.xml" srv_xmlfiles="${srv_xmlfiles} xscale-iwmmxt.xml" + srv_xmlfiles="${srv_xmlfiles} arm-vfpv2.xml" + srv_xmlfiles="${srv_xmlfiles} arm-vfpv3.xml" srv_linux_usrregs=yes srv_linux_regsets=yes srv_linux_thread_db=yes diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 70597fc..d47ee97 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -20,14 +20,17 @@ #include "server.h" #include "linux-low.h" +#include <elf.h> #include <sys/ptrace.h> #include "gdb_proc_service.h" -/* Defined in auto-generated file reg-arm.c. */ +/* Defined in auto-generated files. */ void init_registers_arm (void); -/* Defined in auto-generated file arm-with-iwmmxt.c. */ void init_registers_arm_with_iwmmxt (void); +void init_registers_arm_with_vfpv2 (void); +void init_registers_arm_with_vfpv3 (void); +void init_registers_arm_with_neon (void); #ifndef PTRACE_GET_THREAD_AREA #define PTRACE_GET_THREAD_AREA 22 @@ -38,6 +41,20 @@ void init_registers_arm_with_iwmmxt (void); # define PTRACE_SETWMMXREGS 19 #endif +#ifndef PTRACE_GETVFPREGS +# define PTRACE_GETVFPREGS 27 +# define PTRACE_SETVFPREGS 28 +#endif + +static unsigned long arm_hwcap; + +/* These are in <asm/elf.h> in current kernels. */ +#define HWCAP_VFP 64 +#define HWCAP_IWMMXT 512 +#define HWCAP_NEON 4096 +#define HWCAP_VFPv3 8192 +#define HWCAP_VFPv3D16 16384 + #ifdef HAVE_SYS_REG_H #include <sys/reg.h> #endif @@ -87,13 +104,14 @@ arm_store_gregset (const void *buf) supply_register (i, zerobuf); } -#ifdef __IWMMXT__ - static void arm_fill_wmmxregset (void *buf) { int i; + if (!(arm_hwcap & HWCAP_IWMMXT)) + return; + for (i = 0; i < 16; i++) collect_register (arm_num_regs + i, (char *) buf + i * 8); @@ -107,6 +125,9 @@ arm_store_wmmxregset (const void *buf) { int i; + if (!(arm_hwcap & HWCAP_IWMMXT)) + return; + for (i = 0; i < 16; i++) supply_register (arm_num_regs + i, (char *) buf + i * 8); @@ -115,7 +136,45 @@ arm_store_wmmxregset (const void *buf) supply_register (arm_num_regs + i + 16, (char *) buf + 16 * 8 + i * 4); } -#endif /* __IWMMXT__ */ +static void +arm_fill_vfpregset (void *buf) +{ + int i, num, base; + + if (!(arm_hwcap & HWCAP_VFP)) + return; + + if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3) + num = 32; + else + num = 16; + + base = find_regno ("d0"); + for (i = 0; i < num; i++) + collect_register (base + i, (char *) buf + i * 8); + + collect_register_by_name ("fpscr", (char *) buf + 32 * 8); +} + +static void +arm_store_vfpregset (const void *buf) +{ + int i, num, base; + + if (!(arm_hwcap & HWCAP_VFP)) + return; + + if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3) + num = 32; + else + num = 16; + + base = find_regno ("d0"); + for (i = 0; i < num; i++) + supply_register (base + i, (char *) buf + i * 8); + + supply_register_by_name ("fpscr", (char *) buf + 32 * 8); +} extern int debug_threads; @@ -208,24 +267,94 @@ ps_get_thread_area (const struct ps_prochandle *ph, return PS_OK; } +static int +arm_get_hwcap (unsigned long *valp) +{ + unsigned char *data = alloca (8); + int offset = 0; + + while ((*the_target->read_auxv) (offset, data, 8) == 8) + { + unsigned int *data_p = (unsigned int *)data; + if (data_p[0] == AT_HWCAP) + { + *valp = data_p[1]; + return 1; + } + + offset += 8; + } + + *valp = 0; + return 0; +} + +static void +arm_arch_setup (void) +{ + arm_hwcap = 0; + if (arm_get_hwcap (&arm_hwcap) == 0) + { + init_registers_arm (); + return; + } + + if (arm_hwcap & HWCAP_IWMMXT) + { + init_registers_arm_with_iwmmxt (); + return; + } + + if (arm_hwcap & HWCAP_VFP) + { + int pid; + char *buf; + + /* NEON implies either no VFP, or VFPv3-D32. We only support + it with VFP. */ + if (arm_hwcap & HWCAP_NEON) + init_registers_arm_with_neon (); + else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3) + init_registers_arm_with_vfpv3 (); + else + init_registers_arm_with_vfpv2 (); + + /* Now make sure that the kernel supports reading these + registers. Support was added in 2.6.30. */ + pid = lwpid_of (get_thread_lwp (current_inferior)); + errno = 0; + buf = malloc (32 * 8 + 4); + if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0 + && errno == EIO) + { + arm_hwcap = 0; + init_registers_arm (); + } + free (buf); + + return; + } + + /* The default configuration uses legacy FPA registers, probably + simulated. */ + init_registers_arm (); +} + struct regset_info target_regsets[] = { { PTRACE_GETREGS, PTRACE_SETREGS, 18 * 4, GENERAL_REGS, arm_fill_gregset, arm_store_gregset }, -#ifdef __IWMMXT__ { PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 16 * 8 + 6 * 4, EXTENDED_REGS, arm_fill_wmmxregset, arm_store_wmmxregset }, -#endif + { PTRACE_GETVFPREGS, PTRACE_SETVFPREGS, 32 * 8 + 4, + EXTENDED_REGS, + arm_fill_vfpregset, arm_store_vfpregset }, { 0, 0, -1, -1, NULL, NULL } }; struct linux_target_ops the_low_target = { -#ifdef __IWMMXT__ - init_registers_arm_with_iwmmxt, -#else - init_registers_arm, -#endif + arm_arch_setup, arm_num_regs, arm_regmap, arm_cannot_fetch_register, diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 6d677f2..5edc473 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -2394,7 +2394,16 @@ linux_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len) if (debug_threads) { - fprintf (stderr, "Writing %02x to %08lx\n", (unsigned)myaddr[0], (long)memaddr); + /* Dump up to four bytes. */ + unsigned int val = * (unsigned int *) myaddr; + if (len == 1) + val = val & 0xff; + else if (len == 2) + val = val & 0xffff; + else if (len == 3) + val = val & 0xffffff; + fprintf (stderr, "Writing %0*x to 0x%08lx\n", 2 * ((len < 4) ? len : 4), + val, (long)memaddr); } /* Fill start and end extra bytes of buffer with existing memory data. */ |