This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Disclaimer OK, files are all target-dependent, I'll check this in to devo & the branch unless someone says otherwise. J -----Forwarded message from Ian Dall <Ian.Dall@dsto.defence.gov.au>----- Date: Tue, 10 Feb 1998 22:10:24 +1030 (CST) Message-Id: <199802101140.WAA04680@sibyl.chez-dall.org.au> From: Ian Dall <Ian.Dall@dsto.defence.gov.au> To: jsm@cygnus.com Subject: Preparing for a GDB 4.17 release > Hi, I'm going to make a GDB 4.17 release soon. I will make a branch for > the release in about a week; we'll shoot for releasing it to the world > two weeks after that. I hope this is not too late. Here are some patches for the ns32k platform on netbsd. The effect of these patches is: 1. Fix up register numbering. For as long as I can remember, gdb has not printed out the correct values of registers in variables. The problem is two fold. Gcc has a wacky idea of register numbering for this arch. It may have been compatable with some long forgotten prorietry compiler, but it is certainly incompatible with gdb. I have seperate patches to fix gcc. Secondly, gdb only dealt with the 32081 fpu which has 8 single precision registers aliased with 4 double precision registers. The 32281 has an extra 4 double precision registers. 2. Fix a bug in ns32k-dis.c which can cause a core dump when printing disassembled code. 3. Change calls to "message" to calls to "warning" in gdb/ns32km3-nat.c. I believe this is correct. I think I was the last person running mach on the ns32k and I don't any more, so I guess support could be dropped. On the other hand, the configuration is there it might as well be correct. I believe the FSF should already have the paper work from previous contributions I have made. Ian diff -ru ../../src/gnu/dist/gdb/config/ns32k/tm-nbsd.h dist/gdb/config/ns32k/tm-nbsd.h --- ../../src/gnu/dist/gdb/config/ns32k/tm-nbsd.h Fri Nov 28 22:55:27 1997 +++ dist/gdb/config/ns32k/tm-nbsd.h Fri Dec 5 09:02:05 1997 @@ -31,6 +31,9 @@ /* Saved Pc. Get it from sigcontext if within sigtramp. */ +/* We define our own fetch and store methods. */ +#define FETCH_INFERIOR_REGISTERS + /* Offset to saved PC in sigcontext, from <machine/signal.h>. */ #define SIGCONTEXT_PC_OFFSET 20 @@ -40,6 +43,55 @@ ? sigtramp_saved_pc (FRAME) \ : read_memory_integer ((FRAME)->frame + 4, 4)) \ ) + +#undef FRAME_NUM_ARGS +#define FRAME_NUM_ARGS(numargs, fi) numargs = frame_num_args(fi) + +#undef FRAME_CHAIN +#define FRAME_CHAIN(thisframe) \ + (read_memory_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \ + read_memory_integer ((thisframe)->frame, 4) : 0) + +#define FRAME_CHAIN_VALID(chain, thisframe)\ + ((chain) != 0\ + && !inside_main_func ((thisframe) -> pc)) + +/* tm-umax.h assumes a 32082 fpu. We have a 32382 fpu. */ +#undef REGISTER_NAMES +#undef NUM_REGS +#undef REGISTER_BYTES +#undef REGISTER_BYTE +/* Initializer for an array of names of registers. + There should be NUM_REGS strings in this initializer. */ + +#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "sp", "fp", "pc", "ps", \ + "fsr", \ + "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", \ + } + +#define NUM_REGS 29 + +/* Total amount of space needed to store our copies of the machine's + register state, the array `registers'. */ +#define REGISTER_BYTES \ + ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \ + + 8 * REGISTER_RAW_SIZE(LP0_REGNUM)) + +/* Index within `registers' of the first byte of the space for + register N. */ + +/* This is a bit yuck. The even numbered double precision floating + point long registers occupy the same space as the even:odd numbered + single precision floating point registers, but the extra 32381 fpu + registers are at the end. Doing it this way is compatable for both + 32081 and 32381 equiped machines. */ + +#define REGISTER_BYTE(N) (((N) < LP0_REGNUM? (N)\ + : ((N) - LP0_REGNUM) & 1? (N) - 1 \ + : ((N) - LP0_REGNUM + FP0_REGNUM)) * 4) + #undef FRAME_NUM_ARGS #define FRAME_NUM_ARGS(numargs, fi) numargs = frame_num_args(fi) diff -ru ../../src/gnu/dist/gdb/config/ns32k/tm-ns32km3.h dist/gdb/config/ns32k/tm-ns32km3.h --- ../../src/gnu/dist/gdb/config/ns32k/tm-ns32km3.h Thu Sep 25 20:43:43 1997 +++ dist/gdb/config/ns32k/tm-ns32km3.h Fri Dec 5 09:02:06 1997 @@ -49,3 +49,25 @@ #define STACK_END_ADDR USRSTACK #include "ns32k/tm-umax.h" + +/* tm-umax.h assumes a 32082 fpu. We have a 32382 fpu. */ +#undef REGISTER_NAMES +#undef NUM_REGS +#undef REGISTER_BYTES +/* Initializer for an array of names of registers. + There should be NUM_REGS strings in this initializer. */ + +#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "sp", "fp", "pc", "ps", \ + "fsr", \ + "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", \ + } + +#define NUM_REGS 29 + +/* Total amount of space needed to store our copies of the machine's + register state, the array `registers'. */ +#define REGISTER_BYTES \ + ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \ + + 8 * REGISTER_RAW_SIZE(LP0_REGNUM)) diff -ru ../../src/gnu/dist/gdb/ns32km3-nat.c dist/gdb/ns32km3-nat.c --- ../../src/gnu/dist/gdb/ns32km3-nat.c Thu Sep 25 20:43:02 1997 +++ dist/gdb/ns32km3-nat.c Fri Dec 5 09:04:58 1997 @@ -46,14 +46,16 @@ { REG_N_OFFSET(r0), REG_N_OFFSET(r1), REG_N_OFFSET(r2), REG_N_OFFSET(r3), REG_N_OFFSET(r4), REG_N_OFFSET(r5), REG_N_OFFSET(r6), REG_N_OFFSET(r7), - REG_F_OFFSET(l0a), REG_F_OFFSET(l1a),REG_F_OFFSET(l2a),REG_F_OFFSET(l3a), - REG_F_OFFSET(l4a), REG_F_OFFSET(l5a),REG_F_OFFSET(l6a),REG_F_OFFSET(l7a), + REG_F_OFFSET(l0a), REG_F_OFFSET(l0b),REG_F_OFFSET(l2a),REG_F_OFFSET(l2b), + REG_F_OFFSET(l4a), REG_F_OFFSET(l4b),REG_F_OFFSET(l6a),REG_F_OFFSET(l6b), REG_N_OFFSET(sp), REG_N_OFFSET(fp), REG_N_OFFSET(pc), REG_N_OFFSET(psr), REG_F_OFFSET(fsr), - REG_F_OFFSET(l0a), REG_F_OFFSET(l2a),REG_F_OFFSET(l4a),REG_F_OFFSET(l6a) - /* @@@ 532 has more double length floating point regs, not accessed currently */ + REG_F_OFFSET(l0a), REG_F_OFFSET(l1a),REG_F_OFFSET(l2a),REG_F_OFFSET(l3a), + REG_F_OFFSET(l4a), REG_F_OFFSET(l5a),REG_F_OFFSET(l6a),REG_F_OFFSET(l7a), }; +#define REG_ADDRESS(state,regnum) ((char *)(state)+reg_offset[regnum]) + /* Fetch COUNT contiguous registers from thread STATE starting from REGNUM * Caller knows that the regs handled in one transaction are of same size. */ @@ -94,7 +96,7 @@ &stateCnt); if (ret != KERN_SUCCESS) - message ("fetch_inferior_registers: %s ", + warning ("fetch_inferior_registers: %s ", mach_error_string (ret)); #if 0 /* It may be more effective to store validate all of them, @@ -142,7 +144,7 @@ if (ret != KERN_SUCCESS) { - message ("store_inferior_registers (get): %s", + warning ("store_inferior_registers (get): %s", mach_error_string (ret)); if (must_suspend_thread) setup_thread (current_thread, 0); @@ -173,7 +175,7 @@ NS532_COMBINED_STATE_COUNT); if (ret != KERN_SUCCESS) - message ("store_inferior_registers (set): %s", + warning ("store_inferior_registers (set): %s", mach_error_string (ret)); if (must_suspend_thread) diff -ru ../../src/gnu/dist/gdb/ns32knbsd-nat.c dist/gdb/ns32knbsd-nat.c --- ../../src/gnu/dist/gdb/ns32knbsd-nat.c Fri Nov 28 22:55:03 1997 +++ dist/gdb/ns32knbsd-nat.c Tue Dec 9 22:25:50 1997 @@ -65,7 +65,11 @@ RF(FP0_REGNUM +2, inferior_fpregisters.r_freg[2]); RF(FP0_REGNUM +4, inferior_fpregisters.r_freg[4]); RF(FP0_REGNUM +6, inferior_fpregisters.r_freg[6]); - registers_fetched (); + RF(LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]); + RF(LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]); + RF(LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]); + RF(LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]); + registers_fetched (); } void @@ -94,6 +98,10 @@ RS(FP0_REGNUM +2, inferior_fpregisters.r_freg[2]); RS(FP0_REGNUM +4, inferior_fpregisters.r_freg[4]); RS(FP0_REGNUM +6, inferior_fpregisters.r_freg[6]); + RS(LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]); + RS(LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]); + RS(LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]); + RS(LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]); ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0); @@ -152,6 +160,10 @@ RF(FP0_REGNUM +2, core_reg->freg.r_freg[2]); RF(FP0_REGNUM +4, core_reg->freg.r_freg[4]); RF(FP0_REGNUM +6, core_reg->freg.r_freg[6]); + RF(LP0_REGNUM + 1, core_reg->freg.r_freg[1]); + RF(LP0_REGNUM + 3, core_reg->freg.r_freg[3]); + RF(LP0_REGNUM + 5, core_reg->freg.r_freg[5]); + RF(LP0_REGNUM + 7, core_reg->freg.r_freg[7]); registers_fetched (); } @@ -220,6 +232,10 @@ RF(FP0_REGNUM +2, pcb->pcb_freg[2]); RF(FP0_REGNUM +4, pcb->pcb_freg[4]); RF(FP0_REGNUM +6, pcb->pcb_freg[6]); + RF(LP0_REGNUM + 1, pcb->pcb_freg[1]); + RF(LP0_REGNUM + 3, pcb->pcb_freg[3]); + RF(LP0_REGNUM + 5, pcb->pcb_freg[5]); + RF(LP0_REGNUM + 7, pcb->pcb_freg[7]); registers_fetched (); } #endif /* FETCH_KCORE_REGISTERS */ @@ -251,6 +267,10 @@ RF(FP0_REGNUM +2, zero); RF(FP0_REGNUM +4, zero); RF(FP0_REGNUM +6, zero); + RF(LP0_REGNUM + 0, zero); + RF(LP0_REGNUM + 1, zero); + RF(LP0_REGNUM + 2, zero); + RF(LP0_REGNUM + 3, zero); return; } diff -ru ../../src/gnu/dist/opcodes/ns32k-dis.c dist/opcodes/ns32k-dis.c --- ../../src/gnu/dist/opcodes/ns32k-dis.c Thu Sep 25 20:45:32 1997 +++ dist/opcodes/ns32k-dis.c Mon Dec 8 23:28:54 1997 @@ -292,6 +292,37 @@ return result; } +/* Like bit extract but the buffer is valid and doen't need to be + * fetched + */ +static int +bit_extract_simple (buffer, offset, count) + bfd_byte *buffer; + int offset; + int count; +{ + int result; + int mask; + int bit; + + buffer += offset >> 3; + offset &= 7; + bit = 1; + result = 0; + while (count--) + { + if ((*buffer & (1 << offset))) + result |= bit; + if (++offset == 8) + { + offset = 0; + buffer++; + } + bit <<= 1; + } + return result; +} + static void bit_copy (buffer, offset, count, to) char *buffer; @@ -807,14 +838,14 @@ register val; if ( len == 4 ) - val = (bit_extract(p, 23, 8)/*exponent*/ == 0xff - || (bit_extract(p, 23, 8)/*exponent*/ == 0 && - bit_extract(p, 0, 23)/*mantisa*/ != 0)); + val = (bit_extract_simple(p, 23, 8)/*exponent*/ == 0xff + || (bit_extract_simple(p, 23, 8)/*exponent*/ == 0 && + bit_extract_simple(p, 0, 23)/*mantisa*/ != 0)); else if ( len == 8 ) - val = (bit_extract(p, 52, 11)/*exponent*/ == 0x7ff - || (bit_extract(p, 52, 11)/*exponent*/ == 0 - && (bit_extract(p, 0, 32)/*low mantisa*/ != 0 - || bit_extract(p, 32, 20)/*high mantisa*/ != 0))); + val = (bit_extract_simple(p, 52, 11)/*exponent*/ == 0x7ff + || (bit_extract_simple(p, 52, 11)/*exponent*/ == 0 + && (bit_extract_simple(p, 0, 32)/*low mantisa*/ != 0 + || bit_extract_simple(p, 32, 20)/*high mantisa*/ != 0))); else val = 1; return (val); -----End of forwarded message-----