This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] Add tests to callfuncs.exp for nested call dummies
- To: gdb-patches at sources dot redhat dot com
- Subject: [RFA] Add tests to callfuncs.exp for nested call dummies
- From: Michael Snyder <msnyder at cygnus dot com>
- Date: Thu, 8 Nov 2001 19:18:08 -0800
- Cc: fnasser at redhat dot com
Filling a hole in the testsuite coverage, this tests for
the ability to debug nested target function calls (ie, if
you're stopped in a call dummy frame and you call another
target function).
2001-11-08 Michael Snyder <msnyder@redhat.com>
* gdb.base/callfuncs.exp: Add tests for nested call dummies.
Add pass/fail message for stop at breakpoint in call dummy function.
Index: callfuncs.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/callfuncs.exp,v
retrieving revision 1.45
diff -p -r1.45 callfuncs.exp
*** callfuncs.exp 2001/06/14 21:03:31 1.45
--- callfuncs.exp 2001/11/09 03:15:48
*************** gdb_breakpoint add
*** 319,325 ****
# Call function (causing a breakpoint hit in the call dummy) and do a continue,
# make sure we are back at main and still have the same register contents.
! gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
gdb_test "continue" "Continuing.*" "continue from call dummy breakpoint"
if ![gdb_test "bt 2" \
"#0 main.*" \
--- 319,327 ----
# Call function (causing a breakpoint hit in the call dummy) and do a continue,
# make sure we are back at main and still have the same register contents.
! gdb_test "print add(4,5)" \
! "The program being debugged stopped while.*" \
! "stop at breakpoint in call dummy function"
gdb_test "continue" "Continuing.*" "continue from call dummy breakpoint"
if ![gdb_test "bt 2" \
"#0 main.*" \
*************** if ![gdb_test "return 7" \
*** 368,371 ****
--- 370,430 ----
}
}
+ # Call function (causing a breakpoint hit in the call dummy), and
+ # call another function from the call dummy frame (thereby setting up
+ # several nested call dummy frames). Test that backtrace and finish
+ # work when several call dummies are nested.
+ gdb_breakpoint sum10
+ gdb_breakpoint t_small_values
+ gdb_test "print add(2,3)" "The program being debugged stopped while.*" \
+ "stop at nested call level 1"
+ gdb_test "backtrace" \
+ "\#0 add \\(a=2, b=3\\).*\#1 <function called from gdb>.*\#2 main.*" \
+ "backtrace at nested call level 1"
+ gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
+ "stop at nested call level 2"
+ gdb_test "backtrace" \
+ "\#0 add \\(a=4, b=5\\).*\#1 <function called from gdb>.*\#2 add \\(a=2, b=3\\).*\#3 <function called from gdb>.*\#4 main.*" \
+ "backtrace at nested call level 2"
+ gdb_test "print sum10(2,4,6,8,10,12,14,16,18,20)" \
+ "The program being debugged stopped while.*" \
+ "stop at nested call level 3"
+ gdb_test "backtrace" \
+ "\#0 sum10 \\(i0=2, i1=4, i2=6, i3=8, i4=10, i5=12, i6=14, i7=16, i8=18, i9=20\\).*\#1 <function called from gdb>.*\#2 add \\(a=4, b=5\\).*\#3 <function called from gdb>.*\#4 add \\(a=2, b=3\\).*\#5 <function called from gdb>.*\#6 main.*" \
+ "backtrace at nested call level 3"
+ gdb_test "print t_small_values(1,3,5,7,9,11,13,15,17,19)" \
+ "The program being debugged stopped while.*" \
+ "stop at nested call level 4"
+ gdb_test "backtrace" \
+ "\#0 t_small_values \\(arg1=1 '.001', arg2=3, arg3=5, arg4=7 '.a', arg5=9, arg6=11 '.013', arg7=13, arg8=15, arg9=17, arg10=19\\).*\#2 sum10 \\(i0=2, i1=4, i2=6, i3=8, i4=10, i5=12, i6=14, i7=16, i8=18, i9=20\\).*\#3 <function called from gdb>.*\#4 add \\(a=4, b=5\\).*\#5 <function called from gdb>.*\#6 add \\(a=2, b=3\\).*\#7 <function called from gdb>.*\#8 main.*" \
+ "backtrace at nested call level 4"
+ gdb_test "finish" "Value returned is .* = 100" \
+ "Finish from nested call level 4"
+ gdb_test "backtrace" \
+ "\#0 sum10 \\(i0=2, i1=4, i2=6, i3=8, i4=10, i5=12, i6=14, i7=16, i8=18, i9=20\\).*\#1 <function called from gdb>.*\#2 add \\(a=4, b=5\\).*\#3 <function called from gdb>.*\#4 add \\(a=2, b=3\\).*\#5 <function called from gdb>.*\#6 main.*" \
+ "backtrace after finish from nested call level 4"
+ gdb_test "finish" "Value returned is .* = 110" \
+ "Finish from nested call level 3"
+ gdb_test "backtrace" \
+ "\#0 add \\(a=4, b=5\\).*\#1 <function called from gdb>.*\#2 add \\(a=2, b=3\\).*\#3 <function called from gdb>.*\#4 main.*" \
+ "backtrace after finish from nested call level 3"
+ gdb_test "finish" "Value returned is .* = 9" \
+ "Finish from nested call level 2"
+ gdb_test "backtrace" \
+ "\#0 add \\(a=2, b=3\\).*\#1 <function called from gdb>.*\#2 main.*" \
+ "backtrace after finish from nested call level 2"
+ gdb_test "finish" "Value returned is .* = 5" \
+ "Finish from nested call level 1"
+ gdb_test "backtrace" "\#0 main .*" \
+ "backtrace after finish from nested call level 1"
+
+ do_get_all_registers
+ set new_reg_content $all_registers_content
+ if ![string compare $old_reg_content $new_reg_content] then {
+ pass "nested call dummies preserve register contents"
+ } else {
+ fail "nested call dummies preserve register contents"
+ }
+
return 0
+