From 27001c664dddac8910b0a9ed55a94d6307e8a9e9 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Tue, 15 Sep 1998 22:25:01 +0000 Subject: Mon Sep 14 20:00:04 1998 Michael Snyder * lib/ command rejects invalid frame number" + +gdb_test "printf \"x \%d x\\n\", \$trace_frame == 32767" \ + "x 0 x" \ + "8.28: tfind rejected bad input (32767)" + +# 8.31 tfind negative n +## check error +gdb_test "tfind -3" "invalid input.*" "8.31: tfind rejects negative input" +## check $trace_frame != -n +gdb_test "printf \"x \%d x\\n\", \$trace_frame == -3" "x 0 x" \ + "8.31: tfind rejected negative input (-3)" + +# 8.10 tfind +## check $trace_frame += 1 + +gdb_tfind_test "8.10: tfind start" "start" "0"; +gdb_test "print \$trace_line" "$baseline" \ + "8.10: tfind 0 (correct line $baseline)" +gdb_tfind_test "8.10: tfind noargument 1" "" "1"; +gdb_test "print \$trace_line" "$testline2" \ + "8.10: tfind 1 (correct line $testline2)" +gdb_tfind_test "8.10: tfind noargument 2" "" "2"; +gdb_test "print \$trace_line" "$testline3" \ + "8.10: tfind 2 (correct line $testline3)" +gdb_tfind_test "8.10: tfind noargument 3" "" "3"; +gdb_test "print \$trace_line" "$testline4" \ + "8.10: tfind 3 (correct line $testline4)" + +gdb_tfind_test "8.11: tfind 3" "3" "3"; +gdb_test "print \$trace_line" "$testline4" \ + "8.11: tfind 3 (correct line $testline4)" +gdb_tfind_test "8.11: tfind backward 2" "-" "2"; +gdb_test "print \$trace_line" "$testline3" \ + "8.11: tfind 2 (correct line $testline3)" +gdb_tfind_test "8.11: tfind backward 1" "-" "1"; +gdb_test "print \$trace_line" "$testline2" \ + "8.11: tfind 1 (correct line $testline2)" +gdb_tfind_test "8.11: tfind backward 0" "-" "0"; +gdb_test "print \$trace_line" "$baseline" \ + "8.11: tfind 0 (correct line $baseline)" + +gdb_tfind_test "8.12: tfind none" "none" "-1"; +gdb_tfind_test "8.12: tfind tracepoint " "tracepoint $tdp2" \ + "\$tracepoint" "$tdp2"; +gdb_test "print \$trace_line" "$testline2" \ + "8.12: tfind tracepoint (line $testline2)" + +gdb_tfind_test "8.25: tfind none" "none" "-1"; +gdb_test "tfind tracepoint 0" "failed to find.*" \ + "8.25: tfind tracepoint rejects zero" +gdb_test "tfind tracepoint 32767" "failed to find.*" \ + "8.25: tfind tracepoint rejects nonexistant tracepoint (32767)" +gdb_test "tfind tracepoint -1" "failed to find.*" \ + "8.25: tfind tracepoint rejects nonexistant tracepoint (-1)" + +# 8.37 tfind tracepoint n where n no longer exists (but used to) +gdb_test "delete trace $tdp2" "" "" +gdb_tfind_test "8.37: tfind none" "none" "-1"; +gdb_tfind_test "8.37: tfind deleted tracepoint" \ + "tracepoint $tdp2" \ + "\$tracepoint" "$tdp2"; +gdb_test "print \$trace_line" "$testline2" \ + "8.37: tfind deleted tracepoint (line $testline2)" + +# 8.13 tfind tracepoint +## check $tracepoint same before and after, $trace_frame changed + +gdb_tfind_test "8.13: tfind none" "none" "-1"; +gdb_tfind_test "8.13: tracepoint $tdp1" "tracepoint $tdp1" \ + "\$tracepoint" "$tdp1"; +gdb_test "print \$trace_line" "$baseline" \ + "8.13: tfind tracepoint $tdp1 (line $baseline)" +gdb_test "set \$save_frame = \$trace_frame" "" "" +gdb_tfind_test "8.13: tracepoint " "tracepoint" \ + "\$tracepoint" "$tdp1"; +gdb_test "printf \"x \%d x\\n\", \$trace_frame == \$save_frame" \ + "x 0 x" \ + "8.13: tracepoint , tracepoint number unchanged"] + +# 1.12 set tracepoint in prologue +# +# tdp1 was set at *gdb_recursion_test (ie. the hard address of the +# function, before the prologue). Test to see that it succeeded. +# Current pc should be equal to the address of the function. + +gdb_test "printf \"x \%d x\\n\", \$pc == gdb_recursion_test" \ + "x 1 x" \ + "1.12: set tracepoint in prologue" + +# 8.14 tfind pc x +## check pc == x, $trace_frame != -1 +gdb_tfind_test "8.14: tfind 3" "3" "3" +gdb_test "print \$trace_line" "$testline4" \ + "8.14: tfind 3 (line $testline4)" + +gdb_test "set \$test_pc = \$pc" "" "" +gdb_tfind_test "8.14: tfind none" "none" "-1" +gdb_tfind_test "8.14: tfind pc" "pc \$test_pc" "\$trace_frame != -1" "1"; +gdb_test "print \$trace_line" "$testline4" \ + "8.14: tfind pc x (line $testline4)" +gdb_test "printf \"x \%d x\\n\", \$pc == \$test_pc" \ + "x 1 x" \ + "8.14: tfind pc x" + +# 8.15 tfind pc +## check pc same before and after, $trace_frame changed +gdb_tfind_test "8.15: tfind 3" "3" "3" +gdb_test "print \$trace_line" "$testline4" \ + "8.15: tfind 3 (line $testline4)" +gdb_test "set \$test_pc = \$pc" "" "" +gdb_tfind_test "8.15: tfind pc" "pc" "\$pc == \$test_pc" "1" +gdb_test "print \$trace_line" "$testline4" \ + "8.15: tfind pc (line $testline4)" +gdb_test "printf \"x \%d x\\n\", \$trace_frame != 3" "x 1 x" \ + "8.15: trace frame didn't change" + +# 8.26 tfind pc invalid x +## check error, pc != x (trace_frame unchanged?) +gdb_tfind_test "8.26: tfind start" "start" "0" +gdb_test "tfind pc 0" "failed to find.*" "8.26: tfind pc zero" +gdb_test "tfind pc -1" "failed to find.*" "8.26: tfind pc -1" + +# 8.16 tfind line n +## check #trace_frame != -1, $trace_line == n +gdb_tfind_test "8.16: tfind none" "none" "-1" +gdb_tfind_test "8.16: tfind line $testline3" \ + "line $testline3" \ + "\$trace_line == $testline3" "1" + +# 8.17 tfind line (# 8.19, 8.20) +## check $trace_line changed, no error, pc changed, frame changed, tdp changed +gdb_tfind_test "8.17: tfind none" "none" "-1" +gdb_tfind_test "8.17: tfind line $testline3" "line $testline3" "\$trace_line == $testline3" "1" +gdb_tfind_test "8.17: tfind line " "line" "\$trace_line != $testline3" "1" + +# 8.36 tfind and disassembly +gdb_tfind_test "8.36: tfind start" "start" "0" +set timeout 60 +send_gdb "disassemble gdb_c_test\n" +# look for disassembly of function label +gdb_expect { + -re ":.*$gdb_prompt $" { pass "8.36: trace disassembly" } + -re ".*$gdb_prompt $" { fail "8.36: trace disassembly" } + timeout { fail "8.36: trace disassembly (timeout)" } +} + +gdb_test "tfind line 0" \ + "out of range.*|failed to find.*" \ + "8.18: tfind line 0"; +gdb_test "tfind line 32767" \ + "out of range.*|failed to find.*" \ + "8.27: tfind line 32767"; +gdb_test "tfind line NoSuChFiLe.c:$baseline" \ + "No source file named.*" \ + "8.27: tfind line in bad source file"; + +# 8.32 tfind invalid subcommand (tfind foo) +## check error +gdb_test "tfind NoSuChOpTiOn 21" \ + "No symbol.*|\[Ww\]arning.*|\[Ee\]rror.*" \ + "8.32: tfind with bad subcommand" + +# 8.38 test help tfind +gdb_test "help tfind" "Select a trace frame.*" \ + "8.38: help tfind" +gdb_test "help tfind pc" "Select a trace frame by PC.*" \ + "8.38: help tfind PC" +gdb_test "help tfind end" "Synonym for 'none'.*" \ + "8.38: help tfind end" +gdb_test "help tfind none" "De-select any trace frame.*" \ + "8.38: help tfind none" +gdb_test "help tfind line" "Select a trace frame by source line.*" \ + "8.38: help tfind line" +gdb_test "help tfind start" "Select the first trace frame.*" \ + "8.38: help tfind start" +gdb_test "help tfind range" "Select a trace frame whose PC is in.*" \ + "8.38: help tfind range" +gdb_test "help tfind trace" "Select a trace frame by tracepoint number.*" \ + "8.38: help tfind tracepoint" + +# Finished! +gdb_tfind_test "8.17: tfind none" "none" "-1" -- cgit v1.1