--- a/gdb/testsuite/gdb.trace/Makefile.in +++ b/gdb/testsuite/gdb.trace/Makefile.in @@ -3,9 +3,9 @@ srcdir = @srcdir@ .PHONY: all clean mostlyclean distclean realclean -PROGS = ax backtrace deltrace disconnected-tracing infotrace packetlen \ - passc-dyn passcount report save-trace tfile tfind tracecmd tsv \ - unavailable while-dyn while-stepping +PROGS = actions-changed ax backtrace deltrace disconnected-tracing \ + infotrace packetlen passc-dyn passcount report save-trace tfile \ + tfind tracecmd tsv unavailable while-dyn while-stepping all info install-info dvi install uninstall installcheck check: @echo "Nothing to be done for $@..." --- /dev/null +++ b/gdb/testsuite/gdb.trace/actions-changed.c @@ -0,0 +1,65 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int +begin () +{ +} + +int +middle () +{ +} + +int +later () +{ +} + +int +endish () +{ +} + +int +end () +{ +} + +int +subr (int parm) +{ + int keeping, busy; + + keeping = parm + parm; + busy = keeping * keeping; + + return busy; +} + +main() +{ + begin (); + subr (1); + middle (); + subr (2); + later (); + subr (3); + endish (); + subr (4); + end (); +} --- /dev/null +++ b/gdb/testsuite/gdb.trace/actions-changed.exp @@ -0,0 +1,121 @@ +# Copyright 2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib trace-support.exp + +standard_testfile actions-changed.c +if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ + executable {debug nowarnings}] != "" } { + untested actions-changed.exp + return -1 +} + +proc test_actions_changed { } \ +{ + gdb_breakpoint "begin" + gdb_breakpoint "middle" + gdb_breakpoint "later" + gdb_breakpoint "endish" + gdb_breakpoint "end" + + gdb_test "continue" ".*Breakpoint \[0-9\]+, begin .*" \ + "advance to tracing" + + gdb_test "trace subr" "Tracepoint .*" \ + "tracepoint at subr" + + # First pass, define simple action + + gdb_trace_setactions "define simple action" \ + "" \ + "collect parm" "^$" + + gdb_test_no_output "tstart" + + gdb_test "continue" ".*Breakpoint \[0-9\]+, middle .*" \ + "advance through tracing, 1st" + + gdb_test "tstatus" ".*Collected 1 trace frame.*" \ + "check on first trace status" + + gdb_test_no_output "tstop" + + # Redefine action, run second trace + + gdb_trace_setactions "redefine simple action" \ + "" \ + "collect keeping, busy" "^$" + + gdb_test_no_output "tstart" + + gdb_test "continue" ".*Breakpoint \[0-9\]+, later .*" \ + "advance through tracing, 2nd" + + gdb_test "tstatus" ".*Collected 1 trace frame.*" \ + "check on redefined trace status" + + gdb_test_no_output "tstop" + + # Redefine to stepping action, run third trace + + gdb_trace_setactions "redefine to stepping action" \ + "" \ + "collect parm" "^$" \ + "while-stepping 5" "^$" \ + "collect parm" "^$" \ + "end" "^$" + + gdb_test_no_output "tstart" + + gdb_test "continue" ".*Breakpoint \[0-9\]+, endish .*" \ + "advance through tracing, 3rd" + + gdb_test "tstatus" ".*Collected 6 trace frame.*" \ + "check on stepping trace status" + + gdb_test_no_output "tstop" + + # Redefine to non-stepping, run fourth trace. + + gdb_trace_setactions "redefine to non-stepping action" \ + "" \ + "collect parm" "^$" + + gdb_test_no_output "tstart" + + gdb_test "continue" ".*Breakpoint \[0-9\]+, end .*" \ + "advance to tracing, 4th" + + gdb_test "tstatus" ".*Collected 1 trace frame.*" \ + "check on redefined non-stepping trace status" +} + +# Test if target supports tracepoints or not. + +clean_restart $testfile + +if ![runto_main] { + fail "Can't run to main to check for trace support" + return -1 +} + +if ![gdb_target_supports_trace] { + unsupported "Current target does not support trace" + return -1; +} + +test_actions_changed + +return 0