From: Scott Bambrough Date: Wed, 5 Apr 2000 15:38:05 +0000 (+0000) Subject: Unable to build x86 hosted debugger for ARM Linux, due to missing target X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=faf5f7ad8ab04c5999181c464f045b077948a4fa;p=binutils-gdb.git Unable to build x86 hosted debugger for ARM Linux, due to missing target dependencies. Created ARM Linux specific arm-linux-tdep.c file and moved missing code into it from arm-linux-nat.c. 2000-04-05 Scott Bambrough * arm-linux-tdep.c: New file. * arm-linux-nat.c (fetch_fpregs): Remove unused code. (arm_get_longjmp_target): Moved it and all defines it uses to arm-linux-tdep.c. (arm_linux_extract_return_value): Moved to arm-linux-tdep.c. * config/arm/linux.mt: Add arm-linux-tdep.c to TDEPFILES. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index deb5622cd8c..02217210c31 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2000-04-05 Scott Bambrough + + * arm-linux-tdep.c: New file. + * arm-linux-nat.c (fetch_fpregs): Remove unused code. + (arm_get_longjmp_target): Moved it and all defines + it uses to arm-linux-tdep.c. + (arm_linux_extract_return_value): Moved to + arm-linux-tdep.c. + * config/arm/linux.mt: Add arm-linux-tdep.c to TDEPFILES. + 2000-04-04 Nick Duffek * infrun.c (handle_inferior_event): Call target_mourn_inferior diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 2c8cc079021..b8d30e590af 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -170,7 +170,6 @@ fetch_fpregs (void) for (regno = F0_REGNUM; regno <= F7_REGNUM; regno++) { int fn = regno - F0_REGNUM; - unsigned int *p = (unsigned int *) ®isters[REGISTER_BYTE (regno)]; switch (fp.fType[fn]) { @@ -323,40 +322,6 @@ store_inferior_registers (int regno) store_fpregs (); } -#ifdef GET_LONGJMP_TARGET - -/* Figure out where the longjmp will land. We expect that we have - just entered longjmp and haven't yet altered r0, r1, so the - arguments are still in the registers. (A1_REGNUM) points at the - jmp_buf structure from which we extract the pc (JB_PC) that we will - land at. The pc is copied into ADDR. This routine returns true on - success. */ - -#define LONGJMP_TARGET_SIZE sizeof(int) -#define JB_ELEMENT_SIZE sizeof(int) -#define JB_SL 18 -#define JB_FP 19 -#define JB_SP 20 -#define JB_PC 21 - -int -arm_get_longjmp_target (CORE_ADDR * pc) -{ - CORE_ADDR jb_addr; - char buf[LONGJMP_TARGET_SIZE]; - - jb_addr = read_register (A1_REGNUM); - - if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf, - LONGJMP_TARGET_SIZE)) - return 0; - - *pc = extract_address (buf, LONGJMP_TARGET_SIZE); - return 1; -} - -#endif /* GET_LONGJMP_TARGET */ - /* Dynamic Linking on ARM Linux ---------------------------- @@ -495,25 +460,6 @@ arm_linux_kernel_u_size (void) return (sizeof (struct user)); } -/* Extract from an array REGBUF containing the (raw) register state - a function return value of type TYPE, and copy that, in virtual format, - into VALBUF. */ - -void -arm_linux_extract_return_value (struct type *type, - char regbuf[REGISTER_BYTES], - char *valbuf) -{ - /* ScottB: This needs to be looked at to handle the different - floating point emulators on ARM Linux. Right now the code - assumes that fetch inferior registers does the right thing for - GDB. I suspect this won't handle NWFPE registers correctly, nor - will the default ARM version (arm_extract_return_value()). */ - - int regnum = (TYPE_CODE_FLT == TYPE_CODE (type)) ? F0_REGNUM : A1_REGNUM; - memcpy (valbuf, ®buf[REGISTER_BYTE (regnum)], TYPE_LENGTH (type)); -} - static unsigned int get_linux_version (unsigned int *vmajor, unsigned int *vminor, diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c new file mode 100644 index 00000000000..76becf71c96 --- /dev/null +++ b/gdb/arm-linux-tdep.c @@ -0,0 +1,81 @@ +/* GNU/Linux on ARM target support. + Copyright 1999, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "symtab.h" +#include "gdbtypes.h" + +#ifdef GET_LONGJMP_TARGET + +/* Figure out where the longjmp will land. We expect that we have + just entered longjmp and haven't yet altered r0, r1, so the + arguments are still in the registers. (A1_REGNUM) points at the + jmp_buf structure from which we extract the pc (JB_PC) that we will + land at. The pc is copied into ADDR. This routine returns true on + success. */ + +#define LONGJMP_TARGET_SIZE sizeof(int) +#define JB_ELEMENT_SIZE sizeof(int) +#define JB_SL 18 +#define JB_FP 19 +#define JB_SP 20 +#define JB_PC 21 + +int +arm_get_longjmp_target (CORE_ADDR * pc) +{ + CORE_ADDR jb_addr; + char buf[LONGJMP_TARGET_SIZE]; + + jb_addr = read_register (A1_REGNUM); + + if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf, + LONGJMP_TARGET_SIZE)) + return 0; + + *pc = extract_address (buf, LONGJMP_TARGET_SIZE); + return 1; +} + +#endif /* GET_LONGJMP_TARGET */ + +/* Extract from an array REGBUF containing the (raw) register state + a function return value of type TYPE, and copy that, in virtual format, + into VALBUF. */ + +void +arm_linux_extract_return_value (struct type *type, + char regbuf[REGISTER_BYTES], + char *valbuf) +{ + /* ScottB: This needs to be looked at to handle the different + floating point emulators on ARM Linux. Right now the code + assumes that fetch inferior registers does the right thing for + GDB. I suspect this won't handle NWFPE registers correctly, nor + will the default ARM version (arm_extract_return_value()). */ + + int regnum = (TYPE_CODE_FLT == TYPE_CODE (type)) ? F0_REGNUM : A1_REGNUM; + memcpy (valbuf, ®buf[REGISTER_BYTE (regnum)], TYPE_LENGTH (type)); +} + +void +_initialize_arm_linux_tdep (void) +{ +} diff --git a/gdb/config/arm/linux.mt b/gdb/config/arm/linux.mt index b85ae48bf6d..4939d560ffd 100644 --- a/gdb/config/arm/linux.mt +++ b/gdb/config/arm/linux.mt @@ -1,5 +1,5 @@ # Target: ARM based machine running GNU/Linux TM_FILE= tm-linux.h -TDEPFILES= arm-tdep.o +TDEPFILES= arm-tdep.o arm-linux-tdep.o GDBSERVER_DEPFILES= low-linux.o