Index: testsuite/gdb.base/break.exp =================================================================== RCS file: /cvs/Darwin/src/live/cygnus/src/gdb/testsuite/gdb.base/break.exp,v retrieving revision 1.3 diff -u -r1.3 break.exp --- break.exp 2002/08/13 20:06:14 1.3 +++ break.exp 2002/10/30 09:01:25 @@ -440,7 +440,9 @@ } # Verify that a "silent" breakpoint can be set, and that GDB is indeed -# "silent" about its triggering. +# "silent" about its triggering. Include multiple nested calls to the +# inferior in the user-commands for the breakpoint, to verify that the +# cleanup code isn't trashing stop_bpstat. # if ![runto_main] then { fail "break tests suppressed" } @@ -455,6 +457,7 @@ send_gdb "commands $expect_out(1,string)\n" send_gdb "silent\n" +send_gdb "call (int) printf (\"PREFIXbobo\\n\" + (int) strlen (\"PREFIXbobo\\n\") - 5)\n" send_gdb "end\n" gdb_expect { -re ".*$gdb_prompt $"\ @@ -472,7 +475,7 @@ } send_gdb "continue\n" gdb_expect { - -re "Continuing.\r\n$gdb_prompt $"\ + -re "Continuing.\r\nbobo\r\n\\\$\[0-9\]* = 5\r\n$gdb_prompt $"\ {pass "hit silent break 79"} -re "$gdb_prompt $"\ {fail "hit silent break 79"} @@ -602,6 +605,13 @@ {fail "set breakpoint on to-be-called function"} timeout {fail "(timeout) set breakpoint on to-be-called function"} } + +# save the breakpoint identifier for future use +# +set marker2_bpnum $expect_out(1,string) + +# Call the function. +# send_gdb "print marker2(99)\n" gdb_expect { -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2$proto. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\ @@ -626,6 +636,46 @@ -re "$gdb_prompt $"\ {fail "backtrace while in called function"} timeout {fail "(timeout) backtrace while in called function"} +} + +# Return from the called function. For remote targets, it's important to do +# this before runto_main, which otherwise may silently stop on the dummy +# breakpoint inserted by GDB at the program's entry point. +# +send_gdb "finish\n" +gdb_expect { + -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.* in _sr4export.*$gdb_prompt $"\ + {pass "finish from called function"} + -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*function called from gdb.*$gdb_prompt $"\ + {pass "finish from called function"} + -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*Value returned.*$gdb_prompt $"\ + {pass "finish from called function"} + -re "$gdb_prompt $"\ + {fail "finish from called function"} + timeout {fail "(timeout) finish from called function"} +} + +# Add a user-command that calls the inferior to the breakpoint for marker2. +# +send_gdb "commands $marker2_bpnum\n" +send_gdb "silent\n" +send_gdb "call (int) printf (\"PREFIXbobo\\n\" + (int) strlen (\"PREFIXbobo\\n\") - 5)\n" +send_gdb "end\n" +gdb_expect { + -re ".*$gdb_prompt $"\ + {pass "set printf break marker2"} + timeout {fail "(timeout) set printf break marker2"} +} + +# Call the function again. +# +send_gdb "print marker2(99)\n" +gdb_expect { + -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2$proto. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*bobo.*$gdb_prompt $"\ + {pass "called user-defined function on breakpoint in called function"} + -re "$gdb_prompt $"\ + {fail "called user-defined function on breakpoint in called function"} + timeout {fail "called user-defined function on breakpoint in called function"} } # Return from the called function. For remote targets, it's important to do