+Tue Jan 24 07:58:44 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * lib/gdb.exp (gdb_test): Remove catch from around the send. The
+ code following the catch silently ignored some errors; without the
+ catch they should be thrown like any other tcl error. Also, the
+ catch used "" instead of {} which meant all the callers who wanted
+ to include one of the characters "[]$ had to quote it an extra time.
+ * gdb.base/{callfuncs.exp,commands.exp,gdbvars.exp,printcmds.exp,
+ ptype.exp,signals.exp,watchpoint.exp}, gdb.c++/{cplusfuncs.exp,
+ demangle.exp}, gdb.chill/chexp.exp, gdb.fortran/exprs.exp:
+ Remove extra quoting.
+
Mon Jan 23 21:57:54 1995 Jeff Law (law@snake.cs.utah.edu)
* gdb.base/commands.exp: Make test names unique; every test either
return 0
}
-{
- gdb_load $binfile
- signal_tests_1
-
- # Force a resync, so we're looking at the right prompt. On SCO we
- # were getting out of sync (I don't understand why).
- send "p 1+1\n"
- expect {
- -re "= 2.*$prompt $" {}
- -re ".*$prompt $" { perror "sync trouble in signals.exp" }
- default { perror "sync trouble in signals.exp" }
- }
+gdb_exit
+gdb_start
+gdb_load $binfile
+signal_tests_1
+
+# Force a resync, so we're looking at the right prompt. On SCO we
+# were getting out of sync (I don't understand why).
+send "p 1+1\n"
+expect {
+ -re "= 2.*$prompt $" {}
+ -re ".*$prompt $" { perror "sync trouble in signals.exp" }
+ default { perror "sync trouble in signals.exp" }
+}
- if [runto main] then {
- gdb_test "break handler if 0" "Breakpoint \[0-9\]*"
- gdb_test "set \\\$handler_breakpoint_number = \\\$bpnum" ""
-
- # Get to the point where a signal is waiting to be delivered
- gdb_test "next" "signal \[(\]+SIGUSR1"
- gdb_test "next" "alarm \[(\]+"
- gdb_test "next" "\[+\]+count"
- # Give the signal time to get delivered
- exec sleep 2
+if [runto main] then {
+ gdb_test "break handler if 0" "Breakpoint \[0-9\]*"
+ gdb_test "set \$handler_breakpoint_number = \$bpnum" ""
- # Now call a function. When GDB tries to run the stack dummy,
- # it will hit the breakpoint at handler. Provided it doesn't
- # lose its cool, this is not a problem, it just has to note
- # that the breakpoint condition is false and keep going.
+ # Get to the point where a signal is waiting to be delivered
+ gdb_test "next" "signal \[(\]+SIGUSR1"
+ gdb_test "next" "alarm \[(\]+"
+ gdb_test "next" "\[+\]+count"
+ # Give the signal time to get delivered
+ exec sleep 2
- gdb_test "p func1 ()" "^p func1 \[)(\]+\r\n.\[0-9\]* = void"
+ # Now call a function. When GDB tries to run the stack dummy,
+ # it will hit the breakpoint at handler. Provided it doesn't
+ # lose its cool, this is not a problem, it just has to note
+ # that the breakpoint condition is false and keep going.
- # Make sure the count got incremented.
+ gdb_test "p func1 ()" "^p func1 \[)(\]+\r\n.\[0-9\]* = void"
- # Haven't investigated this xfail
- setup_xfail "rs6000-*-*"
- gdb_test "p count" "= 2"
- if [istarget "rs6000-*-*"] { return 0 }
+ # Make sure the count got incremented.
- gdb_test "condition \\\$handler_breakpoint_number" "now unconditional"
- gdb_test "next" "alarm \[(\]+"
- gdb_test "next" "\[+\]+count"
- exec sleep 2
+ # Haven't investigated this xfail
+ setup_xfail "rs6000-*-*"
+ gdb_test "p count" "= 2"
+ if [istarget "rs6000-*-*"] { return 0 }
+
+ gdb_test "condition \$handler_breakpoint_number" "now unconditional"
+ gdb_test "next" "alarm \[(\]+"
+ gdb_test "next" "\[+\]+count"
+ exec sleep 2
- # This time we stop when GDB tries to run the stack dummy.
- # So it is OK that we do not print the return value from the function.
- gdb_test "p func1 ()" \
+ # This time we stop when GDB tries to run the stack dummy.
+ # So it is OK that we do not print the return value from the function.
+ gdb_test "p func1 ()" \
"Breakpoint \[0-9\]*, handler.*
The program being debugged stopped while in a function called from GDB"
- # But we should be able to backtrace...
- gdb_test "bt" "#0.*handler.*#1.*#2.*main"
- # ...and continue...
- gdb_test "continue" "Continuing"
- # ...and then count should have been incremented
- gdb_test "p count" "= 5"
- }
+ # But we should be able to backtrace...
+ gdb_test "bt" "#0.*handler.*#1.*#2.*main"
+ # ...and continue...
+ gdb_test "continue" "Continuing"
+ # ...and then count should have been incremented
+ gdb_test "p count" "= 5"
}
+
return 0
proc test_convenience_variables {} {
global prompt
- gdb_test "set \\\$foo := 101" " := 101" \
+ gdb_test "set \$foo := 101" " := 101" \
"Set a new convenience variable"
- gdb_test "print \\\$foo" " = 101" \
+ gdb_test "print \$foo" " = 101" \
"Print contents of new convenience variable"
- gdb_test "set \\\$foo := 301" " := 301" \
+ gdb_test "set \$foo := 301" " := 301" \
"Set convenience variable to a new value"
- gdb_test "print \\\$foo" " = 301" \
+ gdb_test "print \$foo" " = 301" \
"Print new contents of convenience variable"
- gdb_test "set \\\$_ := 11" " := 11" \
+ gdb_test "set \$_ := 11" " := 11" \
"Set convenience variable \$_"
- gdb_test "print \\\$_" " = 11" \
+ gdb_test "print \$_" " = 11" \
"Print contents of convenience variable \$_"
- gdb_test "print \\\$foo + 10" " = 311" \
+ gdb_test "print \$foo + 10" " = 311" \
"Use convenience variable in arithmetic expression"
- gdb_test "print (\\\$foo := 32) + 4" " = 36" \
+ gdb_test "print (\$foo := 32) + 4" " = 36" \
"Use convenience variable assignment in arithmetic expression"
- gdb_test "print \\\$bar" " = void" \
+ gdb_test "print \$bar" " = void" \
"Print contents of uninitialized convenience variable"
}
gdb_test "print 103" "\\\$3 = 103" \
"Set value-history\[3\] using \$3"
- gdb_test "print \\\$\\\$" "\\\$4 = 102" \
+ gdb_test "print \$\$" "\\\$4 = 102" \
"Print value-history\[MAX-1\] using inplicit index \$\$"
- gdb_test "print \\\$\\\$" "\\\$5 = 103" \
+ gdb_test "print \$\$" "\\\$5 = 103" \
"Print value-history\[MAX-1\] again using implicit index \$\$"
- gdb_test "print \\\$" "\\\$6 = 103" \
+ gdb_test "print \$" "\\\$6 = 103" \
"Print value-history\[MAX\] using implicit index \$"
- gdb_test "print \\\$\\\$2" "\\\$7 = 102" \
+ gdb_test "print \$\$2" "\\\$7 = 102" \
"Print value-history\[MAX-2\] using explicit index \$\$2"
- gdb_test "print \\\$0" "\\\$8 = 102" \
+ gdb_test "print \$0" "\\\$8 = 102" \
"Print value-history\[MAX\] using explicit index \$0"
gdb_test "print 108" "\\\$9 = 108" ""
- gdb_test "print \\\$\\\$0" "\\\$10 = 108" \
+ gdb_test "print \$\$0" "\\\$10 = 108" \
"Print value-history\[MAX\] using explicit index \$\$0"
- gdb_test "print \\\$1" "\\\$11 = 101" \
+ gdb_test "print \$1" "\\\$11 = 101" \
"Print value-history\[1\] using explicit index \$1"
- gdb_test "print \\\$2" "\\\$12 = 102" \
+ gdb_test "print \$2" "\\\$12 = 102" \
"Print value-history\[2\] using explicit index \$2"
- gdb_test "print \\\$3" "\\\$13 = 103" \
+ gdb_test "print \$3" "\\\$13 = 103" \
"Print value-history\[3\] using explicit index \$3"
- gdb_test "print \\\$-3" "\\\$14 = 100" \
+ gdb_test "print \$-3" "\\\$14 = 100" \
"Print (value-history\[MAX\] - 3) using implicit index \$"
- gdb_test "print \\\$1 + 3" "\\\$15 = 104" \
+ gdb_test "print \$1 + 3" "\\\$15 = 104" \
"Use value-history element in arithmetic expression"
}