diff options
author | Jason Thorpe <thorpej@netbsd.org> | 2002-05-26 22:27:01 +0000 |
---|---|---|
committer | Jason Thorpe <thorpej@netbsd.org> | 2002-05-26 22:27:01 +0000 |
commit | 7bcc927b94b3131adaa192e6d4cfe4d49ae78bf8 (patch) | |
tree | 317ae3f4ce731c1fbda38bd0f2a6d051352307b3 | |
parent | 78f9d7654ada5b567f031f3f3463fac834b9259f (diff) | |
download | gdb-7bcc927b94b3131adaa192e6d4cfe4d49ae78bf8.zip gdb-7bcc927b94b3131adaa192e6d4cfe4d49ae78bf8.tar.gz gdb-7bcc927b94b3131adaa192e6d4cfe4d49ae78bf8.tar.bz2 |
* ns32k-tdep.c (ns32k_call_dummy_words, sizeof_ns32k_call_dummy_words,
ns32k_fix_call_dummy): New.
* config/ns32k/tm-umax.h (CALL_DUMMY_WORDS): Define as
ns32k_call_dummy_words.
(SIZEOF_CALL_DUMMY_WORDS): Define as sizeof_ns32k_call_dummy_words.
(CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_ADDR,
CALL_DUMMY_NARGS): Remove.
(FIX_CALL_DUMMY): Define as ns32k_fix_call_dummy.
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/config/ns32k/tm-umax.h | 39 | ||||
-rw-r--r-- | gdb/ns32k-tdep.c | 39 |
3 files changed, 60 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dba149f..6bff1d7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2002-05-26 Jason Thorpe <thorpej@wasabisystems.com> + * ns32k-tdep.c (ns32k_call_dummy_words, sizeof_ns32k_call_dummy_words, + ns32k_fix_call_dummy): New. + * config/ns32k/tm-umax.h (CALL_DUMMY_WORDS): Define as + ns32k_call_dummy_words. + (SIZEOF_CALL_DUMMY_WORDS): Define as sizeof_ns32k_call_dummy_words. + (CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_ADDR, + CALL_DUMMY_NARGS): Remove. + (FIX_CALL_DUMMY): Define as ns32k_fix_call_dummy. + +2002-05-26 Jason Thorpe <thorpej@wasabisystems.com> + * ns32k-tdep.c (ns32k_breakpoint_from_pc, ns32k_frame_chain, ns32k_frame_saved_pc, ns32k_frame_args_address, ns32k_frame_locals_address, ns32k_frame_init_saved_regs, diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h index 8496307..636e9d7 100644 --- a/gdb/config/ns32k/tm-umax.h +++ b/gdb/config/ns32k/tm-umax.h @@ -187,37 +187,20 @@ void ns32k_frame_init_saved_regs (struct frame_info *); extern void ns32k_push_dummy_frame (void); #define PUSH_DUMMY_FRAME ns32k_push_dummy_frame () -/* Discard from the stack the innermost frame, restoring all registers. */ - extern void ns32k_pop_frame (void); #define POP_FRAME ns32k_pop_frame () -/* This sequence of words is the instructions - enter 0xff,0 82 ff 00 - jsr @0x00010203 7f ae c0 01 02 03 - adjspd 0x69696969 7f a5 01 02 03 04 - bpt f2 - Note this is 16 bytes. */ +extern LONGEST ns32k_call_dummy_words[]; +#define CALL_DUMMY_WORDS ns32k_call_dummy_words -#define CALL_DUMMY { 0x7f00ff82, 0x0201c0ae, 0x01a57f03, 0xf2040302 } +extern int sizeof_ns32k_call_dummy_words; +#define SIZEOF_CALL_DUMMY_WORDS sizeof_ns32k_call_dummy_words #define CALL_DUMMY_START_OFFSET 3 -#define CALL_DUMMY_LENGTH 16 -#define CALL_DUMMY_ADDR 5 -#define CALL_DUMMY_NARGS 11 - -/* Insert the specified number of args and function address - into a call sequence of the above form stored at DUMMYNAME. */ - -void flip_bytes (void *ptr, int count); - -#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ -{ \ - int flipped; \ - flipped = fun | 0xc0000000; \ - flip_bytes (&flipped, 4); \ - *((int *) (((char *) dummyname)+CALL_DUMMY_ADDR)) = flipped; \ - flipped = - nargs * 4; \ - flip_bytes (&flipped, 4); \ - *((int *) (((char *) dummyname)+CALL_DUMMY_NARGS)) = flipped; \ -} + +struct value; +struct type; +extern void ns32k_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int, + struct value **, struct type *, int); +#define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) \ + ns32k_fix_call_dummy ((dummy), (pc), (fun), (nargs), (args), (type), (gcc_p)) diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 42c6456..66bce73 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -26,6 +26,7 @@ static int sign_extend (int value, int bits); static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR); static int ns32k_localcount (CORE_ADDR enter_pc); +static void flip_bytes (void *, int); char * ns32k_register_name_32082 (int regno) @@ -203,7 +204,7 @@ sign_extend (int value, int bits) : value); } -void +static void flip_bytes (void *p, int count) { char tmp; @@ -395,8 +396,44 @@ ns32k_pop_frame (void) write_register (SP_REGNUM, fp + 8); flush_cached_frames (); } + +/* The NS32000 call dummy sequence: + + enter 0xff,0 82 ff 00 + jsr @0x00010203 7f ae c0 01 02 03 + adjspd 0x69696969 7f a5 01 02 03 04 + bpt f2 + + It is 16 bytes long. */ + +LONGEST ns32k_call_dummy_words[] = +{ + 0x7f00ff82, + 0x0201c0ae, + 0x01a57f03, + 0xf2040302 +}; +int sizeof_ns32k_call_dummy_words = sizeof (ns32k_call_dummy_words); + +#define NS32K_CALL_DUMMY_ADDR 5 +#define NS32K_CALL_DUMMY_NARGS 11 void +ns32k_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, + struct value **args, struct type *type, int gcc_p) +{ + int flipped; + + flipped = fun | 0xc0000000; + flip_bytes (&flipped, 4); + store_unsigned_integer (dummy + NS32K_CALL_DUMMY_ADDR, 4, flipped); + + flipped = - nargs * 4; + flip_bytes (&flipped, 4); + store_unsigned_integer (dummy + NS32K_CALL_DUMMY_NARGS, 4, flipped); +} + +void _initialize_ns32k_tdep (void) { tm_print_insn = print_insn_ns32k; |