From 5f2f280941c6223d0f53a68afe1bdc10751bc3cf Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Thu, 24 Nov 1994 05:59:34 +0000 Subject: [PATCH] * remote-e7000.c (HARD_BREAKPOINTS): Reenable. (BC_BREAKPOINTS): Disable. * sh-tdep.c (print_insn): Cope with big and little endian machines. * sh/sh.mt: Use libsim.a * sh/tm-sh.h (TARGET_BYTE_ORDER_SELECTABLE): New (BREAKPOINT): Changed to be byteorder independent. --- gdb/ChangeLog | 9 ++++ gdb/config/sh/sh.mt | 8 +--- gdb/config/sh/tm-sh.h | 7 ++- gdb/sh-tdep.c | 103 ++++++++++++++++++++++-------------------- 4 files changed, 67 insertions(+), 60 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0b32c946858..bf1d6984602 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +Wed Nov 23 21:43:03 1994 Steve Chamberlain (sac@jonny.cygnus.com) + + * remote-e7000.c (HARD_BREAKPOINTS): Reenable. + (BC_BREAKPOINTS): Disable. + * sh-tdep.c (print_insn): Cope with big and little endian machines. + * sh/sh.mt: Use libsim.a + * sh/tm-sh.h (TARGET_BYTE_ORDER_SELECTABLE): New + (BREAKPOINT): Changed to be byteorder independent. + Tue Nov 22 19:13:39 1994 Stan Shebs (shebs@andros.cygnus.com) Maintenance commands to report time and space usage. diff --git a/gdb/config/sh/sh.mt b/gdb/config/sh/sh.mt index cc1312120eb..058124483d7 100644 --- a/gdb/config/sh/sh.mt +++ b/gdb/config/sh/sh.mt @@ -1,11 +1,5 @@ # Target: Hitachi Super-H ICE and simulator -TDEPFILES= sh-tdep.o remote-sim.o interp.o table.o remote-e7000.o ser-e7kpc.o - +TDEPFILES= sh-tdep.o remote-sim.o ../sim/sh/libsim.a remote-e7000.o ser-e7kpc.o over: all -interp.o: - cp ../sim/sh/interp.o . - -table.o: - cp ../sim/sh/table.o . TM_FILE= tm-sh.h diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 83152eb8f87..44310da8975 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -25,7 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Define the bit, byte, and word ordering of the machine. */ -#define TARGET_BYTE_ORDER BIG_ENDIAN +#define TARGET_BYTE_ORDER_SELECTABLE /* Offset from address of function to start of its code. @@ -58,9 +58,8 @@ extern CORE_ADDR sh_skip_prologue (); /* Illegal instruction - used by the simulator for breakpoint detection */ -#define BREAKPOINT {0xc3, 0xff} /* 0xc3ff is trapa #ff */ -#undef BREAKPOINT -#define BREAKPOINT {0x00, 0x1b} /* SLEEP */ +#define BREAKPOINT {0xc3, 0xc3} /* 0xc3c3 is trapa #c3, and it works in big + and little endian modes */ #define REMOTE_BREAKPOINT { 0xc3, 0x20} /* If your kernel resets the pc after the trap happens you may need to diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 476246e3cfe..389b153273b 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -32,6 +32,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "dis-asm.h" #include "../opcodes/sh-opc.h" + + /* Prologue looks like [mov.l ,@-r15]... [sts.l pr,@-r15] @@ -60,10 +62,10 @@ sh_skip_prologue (start_pc) while (IS_STS (w) || IS_PUSH (w) || IS_MOV_SP_FP (w) - || IS_MOV_R3(w) - || IS_ADD_R3SP(w) - || IS_ADD_SP(w) - || IS_SHLL_R3(w)) + || IS_MOV_R3 (w) + || IS_ADD_R3SP (w) + || IS_ADD_SP (w) + || IS_SHLL_R3 (w)) { start_pc += 2; w = read_memory_integer (start_pc, 2); @@ -83,9 +85,11 @@ print_insn (memaddr, stream) GDB_INIT_DISASSEMBLE_INFO (info, stream); - return print_insn_sh (memaddr, &info); + if (TARGET_BYTE_ORDER == BIG_ENDIAN) + return print_insn_sh (memaddr, &info); + else + return print_insn_shl (memaddr, &info); } - /* Given a GDB frame, determine the address of the calling function's frame. This will be used to create a new GDB frame struct, and then INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. @@ -161,20 +165,20 @@ frame_find_saved_regs (fi, fsr) } else if (IS_MOV_R3 (insn)) { - r3_val = (char)(insn & 0xff); - pc+=2; + r3_val = (char) (insn & 0xff); + pc += 2; insn = read_memory_integer (pc, 2); } else if (IS_SHLL_R3 (insn)) { - r3_val <<=1; - pc+=2; + r3_val <<= 1; + pc += 2; insn = read_memory_integer (pc, 2); } else if (IS_ADD_R3SP (insn)) { depth += -r3_val; - pc+=2; + pc += 2; insn = read_memory_integer (pc, 2); } else if (IS_ADD_SP (insn)) @@ -221,17 +225,18 @@ frame_find_saved_regs (fi, fsr) { fi->return_pc = read_register (PR_REGNUM) + 4; } - else { - - if (fsr->regs[PR_REGNUM]) - { - fi->return_pc = read_memory_integer (fsr->regs[PR_REGNUM], 4) + 4; - } - else - { - fi->return_pc = read_register (PR_REGNUM) + 4; - } - } + else + { + + if (fsr->regs[PR_REGNUM]) + { + fi->return_pc = read_memory_integer (fsr->regs[PR_REGNUM], 4) + 4; + } + else + { + fi->return_pc = read_register (PR_REGNUM) + 4; + } + } } /* initialize the extra info saved in a FRAME */ @@ -269,7 +274,7 @@ pop_frame () } } - write_register (PC_REGNUM, fi->return_pc); + write_register (PC_REGNUM, frame->return_pc); write_register (SP_REGNUM, fp + 4); flush_cached_frames (); } @@ -281,31 +286,31 @@ show_regs (args, from_tty) char *args; int from_tty; { - printf_filtered("PC=%08x SR=%08x PR=%08x MACH=%08x MACHL=%08x\n", - read_register(PC_REGNUM), - read_register(SR_REGNUM), - read_register(PR_REGNUM), - read_register(MACH_REGNUM), - read_register(MACL_REGNUM)); - - printf_filtered("R0-R7 %08x %08x %08x %08x %08x %08x %08x %08x\n", - read_register(0), - read_register(1), - read_register(2), - read_register(3), - read_register(4), - read_register(5), - read_register(6), - read_register(7)); - printf_filtered("R8-R15 %08x %08x %08x %08x %08x %08x %08x %08x\n", - read_register(8), - read_register(9), - read_register(10), - read_register(11), - read_register(12), - read_register(13), - read_register(14), - read_register(15)); + printf_filtered ("PC=%08x SR=%08x PR=%08x MACH=%08x MACHL=%08x\n", + read_register (PC_REGNUM), + read_register (SR_REGNUM), + read_register (PR_REGNUM), + read_register (MACH_REGNUM), + read_register (MACL_REGNUM)); + + printf_filtered ("R0-R7 %08x %08x %08x %08x %08x %08x %08x %08x\n", + read_register (0), + read_register (1), + read_register (2), + read_register (3), + read_register (4), + read_register (5), + read_register (6), + read_register (7)); + printf_filtered ("R8-R15 %08x %08x %08x %08x %08x %08x %08x %08x\n", + read_register (8), + read_register (9), + read_register (10), + read_register (11), + read_register (12), + read_register (13), + read_register (14), + read_register (15)); } @@ -320,5 +325,5 @@ _initialize_sh_tdep () "Set simulated memory size of simulator target.", &setlist), &showlist); - add_com("regs", class_vars, show_regs, "Print all registers"); + add_com ("regs", class_vars, show_regs, "Print all registers"); } -- 2.30.2