From 6420594bbf94e458e25624287aeabe3418946878 Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Thu, 17 Oct 1996 02:12:24 +0000 Subject: [PATCH] * testsuite/gdb.base/break.exp: Make backtrace from factorial errors unique. * testsuite/gdb.base/nodebug.exp: Whack out all -g options explicitly. * v850-tdep.c (v850_init_extra_frame_info v850_frame_chain): Fix sign bugs with scanning prologues. Get a little smarter about calculating the length of uninteresting instructions. --- gdb/ChangeLog | 13 ++++++++++++ gdb/testsuite/gdb.base/nodebug.exp | 18 ++++++++++++---- gdb/v850-tdep.c | 34 ++++++++++++------------------ 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a62393756e..e221d1556b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +Wed Oct 16 19:03:54 1996 Stu Grossman (grossman@critters.cygnus.com) + + * testsuite/gdb.base/break.exp: Make backtrace from factorial + errors unique. + * testsuite/gdb.base/nodebug.exp: Whack out all -g options + explicitly. + +start-sanitize-v850 + * v850-tdep.c (v850_init_extra_frame_info v850_frame_chain): Fix + sign bugs with scanning prologues. Get a little smarter about + calculating the length of uninteresting instructions. + +end-sanitize-v850 Wed Oct 16 17:46:03 1996 Stan Shebs * breakpoint.c (must_shift_inst_regs): New global. diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp index 4ad7f89b14..1d95c88e24 100644 --- a/gdb/testsuite/gdb.base/nodebug.exp +++ b/gdb/testsuite/gdb.base/nodebug.exp @@ -8,21 +8,28 @@ set prms_id 0 set bug_id 0 set testfile nodebug -set srcfile ${srcdir}/$subdir/${testfile}.c +set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -if { [compile "${srcfile} -o ${binfile}"] != "" } { + +# Get rid of any -g options (including -gstabs, -gdwarf, etc... +regsub -all -- {[ ]-g[^ ]*} $target_info(target,cflags) { } target_info(target,cflags) + +if { [compile "${srcdir}/${subdir}/${srcfile} -o ${binfile}"] != "" } { perror "Couldn't compile ${srcfile}" return -1 } +# Create and source the file that provides information about the compiler +# used to compile the test case. execute_anywhere "rm -f ${binfile}.ci" if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } { - perror "Couldn't make ${testfile}.ci file" + perror "Couldn't make ${binfile}.ci file" return -1 } +source ${binfile}.ci + gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile -source ${binfile}.ci if [runto inner] then { @@ -110,11 +117,14 @@ if [runto inner] then { # This test is not as obscure as it might look. `p getenv ("TERM")' # is a real-world example, at least on many systems. + setup_xfail "h8300*-*-*" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test {p/c array_index("abcdef",2)} " = 99 'c'" # Now, try that we can give names of file-local symbols which happen # to be unique, and have it still work if [runto middle] then { + setup_xfail "h8300*-*-*" gdb_test "backtrace" "#0.*middle.*#1.*top.*#2.*main.*" \ "backtrace from middle in nodebug.exp" } diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 1b1f5c8104..25e607dd1c 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -86,36 +86,33 @@ v850_init_extra_frame_info (fi) { int insn; - insn = read_memory_integer (current_pc, 2); + insn = read_memory_unsigned_integer (current_pc, 2); if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add ,sp */ - frameoffset = (insn & 0x1f) | ~0x1f; + frameoffset = ((insn & 0x1f) ^ 0x10) - 0x10; else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi ,sp,sp */ - { - current_pc += 2; - - frameoffset = read_memory_integer (current_pc, 2); - } + frameoffset = read_memory_integer (current_pc + 2, 2); else if (insn == ((FP_REGNUM << 11) | 0x0000 | 12)) /* mov r12,r2 */ framereg = FP_REGNUM; /* Setting up fp */ else if ((insn & 0x07ff) == (0x0760 | SP_REGNUM)) /* st.w ,[sp] */ { reg = (insn >> 11) & 0x1f; /* Extract */ - current_pc += 2; - insn = read_memory_integer (current_pc, 2) & ~1; + insn = read_memory_integer (current_pc + 2, 2) & ~1; fi->fsr.regs[reg] = insn + frameoffset; } else if ((insn & 0x07ff) == (0x0760 | FP_REGNUM)) /* st.w ,[fp] */ { reg = (insn >> 11) & 0x1f; /* Extract */ - current_pc += 2; - insn = read_memory_integer (current_pc, 2) & ~1; + insn = read_memory_integer (current_pc + 2, 2) & ~1; fi->fsr.regs[reg] = insn; } + + if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */ + current_pc += 2; } if (PC_IN_CALL_DUMMY (fi->pc, NULL, NULL)) @@ -208,21 +205,16 @@ v850_frame_chain (fi) { int insn; - insn = read_memory_integer (current_pc, 2); + insn = read_memory_unsigned_integer (current_pc, 2); if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add ,sp */ - frameoffset = (insn & 0x1f) | ~0x1f; + frameoffset = ((insn & 0x1f) ^ 0x10) - 0x10; else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi ,sp,sp */ - { - current_pc += 2; - - frameoffset = read_memory_integer (current_pc, 2); - } + frameoffset = read_memory_integer (current_pc + 2, 2); else if (insn == ((FP_REGNUM << 11) | 0x0000 | 12)) /* mov r12,r2 */ return v850_find_callers_reg (fi, FP_REGNUM); /* It's using a frame pointer reg */ - else if ((insn & 0x07ff) == (0x0760 | SP_REGNUM)) /* st.w ,[sp] */ - current_pc += 2; - else if ((insn & 0x07ff) == (0x0760 | FP_REGNUM)) /* st.w ,[fp] */ + + if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */ current_pc += 2; }