diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2003-05-18 21:10:11 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@linux-m68k.org> | 2003-05-18 21:10:11 +0000 |
commit | d0b45d99e856027785d6ee913238f02f38ff91fe (patch) | |
tree | e8166b872a5ef49a0afb6e622b4611d68b340148 | |
parent | 55baeb84698049b1b03248655dde0ea1c7c9d540 (diff) | |
download | gdb-d0b45d99e856027785d6ee913238f02f38ff91fe.zip gdb-d0b45d99e856027785d6ee913238f02f38ff91fe.tar.gz gdb-d0b45d99e856027785d6ee913238f02f38ff91fe.tar.bz2 |
* Makefile (m68klinux-nat.o, m68klinux-tdep.o): Update
dependencies.
* config/m68k/tm-linux.h (DEPRECATED_EXTRACT_RETURN_VALUE): Define
as m68k_linux_extract_return_value.
(DEPRECATED_STORE_RETURN_VALUE): Define as
m68k_linux_store_return_value.
(DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS): Define as
m68k_linux_extract_struct_value_address.
* m68klinux-tdep.c (m68k_linux_sigtramp_saved_pc): Use
get_next_frame, get_frame_base, get_frame_pc.
(m68k_linux_frame_saved_pc): Use get_frame_base.
(m68k_linux_extract_return_value): New function.
(m68k_linux_store_return_value): New function.
(m68k_linux_extract_struct_value_address): New function.
* config/m68k/tm-m68k.h: Declare m68k_get_longjmp_target.
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/Makefile.in | 6 | ||||
-rw-r--r-- | gdb/config/m68k/tm-linux.h | 55 | ||||
-rw-r--r-- | gdb/config/m68k/tm-m68k.h | 2 | ||||
-rw-r--r-- | gdb/m68klinux-tdep.c | 57 |
5 files changed, 84 insertions, 52 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b9bdadf..bf94e29 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,21 @@ 2003-05-18 Andreas Schwab <schwab@suse.de> + * Makefile (m68klinux-nat.o, m68klinux-tdep.o): Update + dependencies. + * config/m68k/tm-linux.h (DEPRECATED_EXTRACT_RETURN_VALUE): Define + as m68k_linux_extract_return_value. + (DEPRECATED_STORE_RETURN_VALUE): Define as + m68k_linux_store_return_value. + (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS): Define as + m68k_linux_extract_struct_value_address. + * m68klinux-tdep.c (m68k_linux_sigtramp_saved_pc): Use + get_next_frame, get_frame_base, get_frame_pc. + (m68k_linux_frame_saved_pc): Use get_frame_base. + (m68k_linux_extract_return_value): New function. + (m68k_linux_store_return_value): New function. + (m68k_linux_extract_struct_value_address): New function. + * config/m68k/tm-m68k.h: Declare m68k_get_longjmp_target. + * c-exp.y (typebase): Remove duplicate occurence of `SIGNED_KEYWORD LONG LONG'. Use builtin_type_long_long instead of lookup_signed_typename. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 6061023..dd41697 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1920,10 +1920,10 @@ m68k-tdep.o: m68k-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbcore_h) \ $(value_h) $(gdb_string_h) $(inferior_h) $(regcache_h) \ $(arch_utils_h) $(gregset_h) $(m68k_tdep_h) m68klinux-nat.o: m68klinux-nat.c $(defs_h) $(frame_h) $(inferior_h) \ - $(language_h) $(gdbcore_h) $(regcache_h) $(gdb_stat_h) \ - $(floatformat_h) $(target_h) $(gregset_h) $(m68k_tdep_h) + $(language_h) $(gdbcore_h) $(gdb_string_h) $(regcache_h) \ + $(m68k_tdep_h) $(gdb_stat_h) $(floatformat_h) $(target_h) m68klinux-tdep.o: m68klinux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \ - $(target_h) + $(target_h) $(gdb_string_h) $(gdbtypes_h) $(m68k_tdep_t) m68knbsd-nat.o: m68knbsd-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ $(regcache_h) m68knbsd-tdep.o: m68knbsd-tdep.c $(defs_h) $(gdbtypes_h) $(regcache_h) diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h index cc20c62..b11c418 100644 --- a/gdb/config/m68k/tm-linux.h +++ b/gdb/config/m68k/tm-linux.h @@ -1,6 +1,6 @@ /* Definitions to target GDB to GNU/Linux on m680x0. - Copyright 1996, 1998, 1999, 2000, 2002 Free Software Foundation, + Copyright 1996, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -20,8 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config/tm-linux.h" +#include "m68k/tm-m68k.h" + #include "regcache.h" -#include "m68k-tdep.h" /* Number of traps that happen between exec'ing the shell to run an inferior, and when we finally get to the inferior code. This is 2 @@ -37,56 +39,24 @@ function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ -{ \ - if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ - { \ - REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE, \ - ((char *) (REGBUF) \ - + REGISTER_BYTE (FP0_REGNUM)), \ - VALBUF); \ - } \ - else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \ - memcpy (VALBUF, (char *) (REGBUF) + REGISTER_BYTE (M68K_A0_REGNUM), \ - TYPE_LENGTH (TYPE)); \ - else \ - memcpy (VALBUF, \ - ((char *) (REGBUF) \ - + (TYPE_LENGTH (TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH (TYPE))), \ - TYPE_LENGTH (TYPE)); \ -} +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ + m68k_linux_extract_return_value (TYPE, REGBUF, VALBUF) +extern void m68k_linux_extract_return_value (struct type *, char *, char *); /* Write into appropriate registers a function return value of type TYPE, given in virtual format. */ -#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ -{ \ - if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ - { \ - char raw_buffer[REGISTER_RAW_SIZE (FP0_REGNUM)]; \ - REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buffer); \ - deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \ - raw_buffer, TYPE_LENGTH (TYPE)); \ - } \ - else \ - { \ - if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \ - deprecated_write_register_bytes (REGISTER_BYTE (M68K_A0_REGNUM), VALBUF, \ - TYPE_LENGTH (TYPE)); \ - deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)); \ - } \ -} - -#include "config/tm-linux.h" -#include "m68k/tm-m68k.h" +#define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \ + m68k_linux_store_return_value (TYPE, VALBUF) +extern void m68k_linux_store_return_value (struct type *, char *); /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#undef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - (*(CORE_ADDR *)((char *) (REGBUF) + REGISTER_BYTE (M68K_A0_REGNUM))) + m68k_linux_extract_struct_value_address (REGBUF) +extern CORE_ADDR m68k_linux_extract_struct_value_address (char *); /* Offsets (in target ints) into jmp_buf. */ @@ -100,7 +70,6 @@ #define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) -#undef DEPRECATED_FRAME_SAVED_PC #define DEPRECATED_FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame) extern CORE_ADDR m68k_linux_frame_saved_pc (struct frame_info *); diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h index 523cc4a..cb72c98 100644 --- a/gdb/config/m68k/tm-m68k.h +++ b/gdb/config/m68k/tm-m68k.h @@ -22,3 +22,5 @@ #include "regcache.h" #define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL + +extern int m68k_get_longjmp_target (CORE_ADDR *); diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c index afd2d2d..752e58e 100644 --- a/gdb/m68klinux-tdep.c +++ b/gdb/m68klinux-tdep.c @@ -1,6 +1,6 @@ /* Motorola m68k target-dependent support for GNU/Linux. - Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation, + Copyright 1996, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -24,7 +24,9 @@ #include "gdbcore.h" #include "frame.h" #include "target.h" - +#include "gdb_string.h" +#include "gdbtypes.h" +#include "m68k-tdep.h" /* Check whether insn1 and insn2 are parts of a signal trampoline. */ @@ -93,9 +95,9 @@ m68k_linux_sigtramp_saved_pc (struct frame_info *frame) int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT; /* Get sigcontext address, it is the third parameter on the stack. */ - if (frame->next) + if (get_next_frame (frame)) sigcontext_addr - = read_memory_unsigned_integer (FRAME_ARGS_ADDRESS (frame->next) + = read_memory_unsigned_integer (get_frame_base (get_next_frame (frame)) + FRAME_ARGS_SKIP + sigcontext_offs, ptrbytes); @@ -107,7 +109,7 @@ m68k_linux_sigtramp_saved_pc (struct frame_info *frame) /* Don't cause a memory_error when accessing sigcontext in case the stack layout has changed or the stack is corrupt. */ - if (m68k_linux_in_sigtramp (frame->pc) == 2) + if (m68k_linux_in_sigtramp (get_frame_pc (frame)) == 2) target_read_memory (sigcontext_addr + UCONTEXT_PC_OFFSET, buf, ptrbytes); else target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes); @@ -122,5 +124,48 @@ m68k_linux_frame_saved_pc (struct frame_info *frame) if (get_frame_type (frame) == SIGTRAMP_FRAME) return m68k_linux_sigtramp_saved_pc (frame); - return read_memory_unsigned_integer (frame->frame + 4, 4); + return read_memory_unsigned_integer (get_frame_base (frame) + 4, 4); +} + +void +m68k_linux_extract_return_value (struct type *type, char *regbuf, char *valbuf) +{ + if (TYPE_CODE (type) == TYPE_CODE_FLT) + { + REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, type, + regbuf + REGISTER_BYTE (FP0_REGNUM), + valbuf); + } + else if (TYPE_CODE (type) == TYPE_CODE_PTR) + memcpy (valbuf, regbuf + REGISTER_BYTE (M68K_A0_REGNUM), + TYPE_LENGTH (type)); + else + memcpy (valbuf, + regbuf + (TYPE_LENGTH (type) >= 4 ? 0 : 4 - TYPE_LENGTH (type)), + TYPE_LENGTH (type)); +} + +void +m68k_linux_store_return_value (struct type *type, char *valbuf) +{ + if (TYPE_CODE (type) == TYPE_CODE_FLT) + { + char raw_buffer[REGISTER_RAW_SIZE (FP0_REGNUM)]; + REGISTER_CONVERT_TO_RAW (type, FP0_REGNUM, valbuf, raw_buffer); + deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), + raw_buffer, TYPE_LENGTH (type)); + } + else + { + if (TYPE_CODE (type) == TYPE_CODE_PTR) + deprecated_write_register_bytes (REGISTER_BYTE (M68K_A0_REGNUM), + valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (0, valbuf, TYPE_LENGTH (type)); + } +} + +CORE_ADDR +m68k_linux_extract_struct_value_address (char *regbuf) +{ + return *(CORE_ADDR *) (regbuf + REGISTER_BYTE (M68K_A0_REGNUM)); } |