2016-01-01 04:33:14 +00:00
|
|
|
# Copyright 1998-2016 Free Software Foundation, Inc.
|
1999-04-16 01:35:26 +00:00
|
|
|
#
|
|
|
|
# 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
|
2007-08-23 18:14:19 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-16 01:35:26 +00:00
|
|
|
# (at your option) any later version.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
1999-04-16 01:35:26 +00:00
|
|
|
# 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.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
1999-04-16 01:35:26 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 18:14:19 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# This file was written by Michael Snyder (msnyder@cygnus.com)
|
|
|
|
|
2013-06-07 17:31:09 +00:00
|
|
|
load_lib "trace-support.exp"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
gdb_exit
|
|
|
|
gdb_start
|
|
|
|
|
2012-06-26 18:25:19 +00:00
|
|
|
standard_testfile actions.c
|
* config/m68k-emc.exp, lib/emc-support.exp,
gdb.trace/gdb_c_test.c: Delete.
* gdb.trace/actions.exp, gdb.trace/backtrace.exp, gdb.trace/circ.exp,
gdb.trace/collection.exp, gdb.trace/deltrace.exp,
gdb.trace/infotrace.exp, gdb.trace/limits.exp, gdb.trace/packetlen.exp,
gdb.trace/passc-dyn.exp, gdb.trace/passcount.exp, gdb.trace/report.exp,
gdb.trace/save-trace.exp, gdb.trace/tfind.exp, gdb.trace/tracecmd.exp,
gdb.trace/while-dyn.exp, gdb.trace/while-stepping.exp: Remove special
casing for m68k-*-elf.
2009-11-05 20:06:03 +00:00
|
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
|
|
|
|
executable {debug nowarnings}] != "" } {
|
|
|
|
untested save-trace.exp
|
|
|
|
return -1
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
|
|
|
|
# If testing on a remote host, download the source file.
|
|
|
|
# remote_download host $srcdir/$subdir/$srcfile
|
|
|
|
|
|
|
|
gdb_file_cmd $binfile
|
|
|
|
|
|
|
|
# define relative source line numbers:
|
|
|
|
# all subsequent line numbers are relative to this first one (baseline)
|
2013-06-07 17:31:09 +00:00
|
|
|
set baseline [gdb_find_recursion_test_baseline $srcfile]
|
1999-04-16 01:35:26 +00:00
|
|
|
if { $baseline == -1 } then {
|
|
|
|
fail "Could not find gdb_recursion_test function"
|
2013-06-07 17:31:09 +00:00
|
|
|
return
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set testline1 [expr $baseline + 4]
|
|
|
|
set testline2 [expr $baseline + 5]
|
|
|
|
set testline3 [expr $baseline + 6]
|
|
|
|
set testline4 [expr $baseline + 7]
|
|
|
|
set testline5 [expr $baseline + 8]
|
|
|
|
set testline6 [expr $baseline + 9]
|
|
|
|
|
|
|
|
#
|
|
|
|
# test save-trace command
|
|
|
|
#
|
|
|
|
|
|
|
|
# setup a set of tracepoints to save
|
|
|
|
|
|
|
|
gdb_delete_tracepoints
|
|
|
|
|
|
|
|
foreach x { 1 2 3 4 5 6 } {
|
2013-06-07 17:31:09 +00:00
|
|
|
set testline [expr \$testline$x]
|
|
|
|
set trcpt [gdb_gettpnum $testline]
|
|
|
|
set trcpt$x $trcpt
|
1999-04-16 01:35:26 +00:00
|
|
|
gdb_test "passcount $x" \
|
|
|
|
"Setting tracepoint $trcpt.* to $x" \
|
2015-11-23 23:47:08 +00:00
|
|
|
"set passcount for tracepoint $trcpt"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2010-06-02 21:55:28 +00:00
|
|
|
gdb_test_no_output "condition $trcpt $x - 1 == $x / 2" \
|
2015-11-23 23:47:08 +00:00
|
|
|
"set condition for tracepoint $trcpt"
|
2010-03-31 17:59:49 +00:00
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
gdb_trace_setactions "set actions for tracepoint $x" \
|
1999-04-16 01:35:26 +00:00
|
|
|
"" \
|
|
|
|
"collect q$x" "^$" \
|
|
|
|
"while-stepping $x" "^$" \
|
|
|
|
"collect q$x" "^$" \
|
|
|
|
"end" "^$"
|
|
|
|
}
|
|
|
|
|
2015-11-23 23:47:09 +00:00
|
|
|
gdb_test "ftrace fast_tracepoint_loc" \
|
|
|
|
"Fast tracepoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
|
|
|
|
"set a fast tracepoint"
|
|
|
|
|
2010-06-02 21:55:28 +00:00
|
|
|
gdb_test_no_output "set default-collect gdb_char_test, gdb_long_test - 100" \
|
2015-11-23 23:47:08 +00:00
|
|
|
"set default-collect"
|
|
|
|
|
|
|
|
# Save tracepoint definitions to a file, at path SAVE_PATH.
|
|
|
|
proc gdb_save_tracepoints { save_path } {
|
|
|
|
set save_path_regexp [string_to_regexp $save_path]
|
|
|
|
remote_file host delete $save_path
|
|
|
|
gdb_test "save tracepoints $save_path" \
|
|
|
|
"Saved to file '$save_path_regexp'." \
|
|
|
|
"save tracepoint definitions"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Load tracepoint definitions from a file, from path SAVE_PATH.
|
|
|
|
proc gdb_load_tracepoints { save_path } {
|
|
|
|
# Cleanup existing tracepoints/collections
|
|
|
|
gdb_delete_tracepoints
|
|
|
|
gdb_test_no_output "set default-collect" "clear default-collect"
|
|
|
|
|
|
|
|
gdb_test "info tracepoints" "No tracepoints." "delete tracepoints"
|
|
|
|
|
|
|
|
gdb_test "source $save_path" "Tracepoint \[0-9\]+ at .*" \
|
|
|
|
"read back saved tracepoints"
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
proc gdb_verify_tracepoints { testname } {
|
2013-06-07 17:31:09 +00:00
|
|
|
global gdb_prompt
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
set ws "\[\t \]+"
|
|
|
|
set nl "\[\r\n\]+"
|
2013-06-07 17:31:09 +00:00
|
|
|
set ourstate 1
|
|
|
|
set result "pass"
|
2010-06-02 19:41:11 +00:00
|
|
|
gdb_test_multiple "info tracepoints" "$testname" {
|
2010-03-31 17:59:49 +00:00
|
|
|
-re "\[0-9\]+\[\t \]+tracepoint\[\t \]+keep y\[\t \]+0x\[0-9a-fA-F\]+ in gdb_recursion_test\[^\r\n\]+\r\n\[ \t]+trace only if \[0-9\] - 1 == \[0-9\] / 2" {
|
2009-03-30 Stan Shebs <stan@codesourcery.com>
Make tracepoints into a type of breakpoint.
* breakpoint.h (enum bptype): Add bp_tracepoint.
(struct breakpoint): Add fields step_count, pass_count, actions.
(get_tracepoint, get_tracepoint_by_number): Declare.
(all_tracepoints): Declare.
* breakpoint.c: Include tracepoint.h, readline.h.
(ALL_TRACEPOINTS): Move here from tracepoint.c.
(tracepoint_count): Ditto.
(should_be_inserted): GDB does not insert tracepoints itself.
(print_it_typical): Add tracepoint case.
(bpstat_what): Ditto.
(print_one_breakpoint_location): Ditto, and add printing for
pass count, step count, and action list.
(user_settable_breakpoint): Add tracepoint case.
(allocate_bp_location): Ditto.
(set_breakpoint_location_function): Ditto.
(disable_breakpoints_in_shlibs): Ditto.
(mention): Ditto.
(break_command_really): Add argument traceflag, use to choose
basic breakpoint type.
(break_command_1): Pass extra argument.
(set_breakpoint, handle_gnu_v3_exceptions): Ditto.
(breakpoint_re_set_one): Add tracepoint case.
(disable_command, enable_command): Ditto.
(set_tracepoint_count): Move here from tracepoint.c.
(trace_command): Move here from tracepoint.c and use
break_command_really.
(tracepoints_info): Move here from tracepoint.c and call
breakpoints_info.
(enable_trace_command): Move here from tracepoint.c and call
enable_command.
(disable_trace_command): Move here from tracepoint.c and call
disable_command.
(delete_trace_command): Move here from tracepoint.c and call
delete_breakpoint.
(trace_pass_command): Move here from tracepoint.c.
(get_tracepoint_by_number): Ditto.
(tracepoint_save_command): Ditto.
(get_tracepoint): New function.
(all_tracepoints): New function.
(_initialize_breakpoint): Move tracepoint init from tracepoint.c,
deprecate "enable trace" and "disable trace" commands.
* tracepoint.h (struct tracepoint): Remove.
(tracepoint_chain): Remove decl.
(deprecated_create_tracepoint_hook): Remove decl.
(deprecated_delete_tracepoint_hook): Remove decl.
(deprecated_modify_tracepoint_hook): Remove decl.
(ALL_TRACEPOINTS, ALL_TRACEPOINTS_SAFE): Remove.
(free_actions): Update signature.
(validate_actionline): Update signature.
(end_actions_pseudocommand): Declare.
(while_stepping_pseudocommand): Declare.
* tracepoint.c: Include breakpoint.h.
(tracepoint_chain, tracepoint_count): Remove.
(free_actions, make_cleanup_free_actions): Update signature.
(trace_command, set_raw_tracepoint): Remove.
(trace_mention): Remove.
(tracepoints_info): Remove.
(tracepoint_operation, map_args_over_tracepoints): Remove.
(get_tracepoint_by_number): Remove.
(enable_trace_command, disable_trace_command): Remove.
(delete_trace_command, trace_pass_command): Remove.
(trace_actions_command, read_actions): Update signature.
(validate_actionline): Update signature, use bp loc.
(encode_actions): Ditto.
(download_tracepoint): New function, body of trace_start_command.
(trace_start_command): Call it, use all_tracepoints.
(tracepoint_save_command): Remove.
(tracepoint_dump_command): Use get_tracepoint.
(end_actions_pseudocommand): Make globally visible.
(while_stepping_pseudocommand): Ditto.
(_initialize_tracepoint): Move command definitions to breakpoint.c.
doc/
* gdb.texinfo (Tracepoints): Describe tracepoints as a
special case of breakpoints.
(Enable and Disable Tracepoints): Mention deprecation.
(Listing Tracepoints): Update description and example.
testsuite/
* gdb.trace/actions.exp: Update to match new info trace format.
* gdb.trace/deltrace.exp: Ditto.
* gdb.trace/infotrace.exp: Ditto.
* gdb.trace/passcount.exp: Ditto.
* gdb.trace/save-trace.exp: Ditto.
* gdb.trace/while-stepping.exp: Ditto.
* gdb.trace/tracecmd.exp: Ditto, plus don't allow pending option.
gdbtk/
* generic/gdbtk-bp.c (gdb_actions_command): Update to handle
tracepoints as breakpoints.
(gdb_get_tracepoint_info): Ditto, plus use get_tracepoint and
breakpoint locations.
(tracepoint_exists): Ditto, plus use all_tracepoints.
2009-03-31 05:08:37 +00:00
|
|
|
# if { $expect_out(1,string) != $ourstate } {
|
2013-06-07 17:31:09 +00:00
|
|
|
# set result "fail"
|
2009-03-30 Stan Shebs <stan@codesourcery.com>
Make tracepoints into a type of breakpoint.
* breakpoint.h (enum bptype): Add bp_tracepoint.
(struct breakpoint): Add fields step_count, pass_count, actions.
(get_tracepoint, get_tracepoint_by_number): Declare.
(all_tracepoints): Declare.
* breakpoint.c: Include tracepoint.h, readline.h.
(ALL_TRACEPOINTS): Move here from tracepoint.c.
(tracepoint_count): Ditto.
(should_be_inserted): GDB does not insert tracepoints itself.
(print_it_typical): Add tracepoint case.
(bpstat_what): Ditto.
(print_one_breakpoint_location): Ditto, and add printing for
pass count, step count, and action list.
(user_settable_breakpoint): Add tracepoint case.
(allocate_bp_location): Ditto.
(set_breakpoint_location_function): Ditto.
(disable_breakpoints_in_shlibs): Ditto.
(mention): Ditto.
(break_command_really): Add argument traceflag, use to choose
basic breakpoint type.
(break_command_1): Pass extra argument.
(set_breakpoint, handle_gnu_v3_exceptions): Ditto.
(breakpoint_re_set_one): Add tracepoint case.
(disable_command, enable_command): Ditto.
(set_tracepoint_count): Move here from tracepoint.c.
(trace_command): Move here from tracepoint.c and use
break_command_really.
(tracepoints_info): Move here from tracepoint.c and call
breakpoints_info.
(enable_trace_command): Move here from tracepoint.c and call
enable_command.
(disable_trace_command): Move here from tracepoint.c and call
disable_command.
(delete_trace_command): Move here from tracepoint.c and call
delete_breakpoint.
(trace_pass_command): Move here from tracepoint.c.
(get_tracepoint_by_number): Ditto.
(tracepoint_save_command): Ditto.
(get_tracepoint): New function.
(all_tracepoints): New function.
(_initialize_breakpoint): Move tracepoint init from tracepoint.c,
deprecate "enable trace" and "disable trace" commands.
* tracepoint.h (struct tracepoint): Remove.
(tracepoint_chain): Remove decl.
(deprecated_create_tracepoint_hook): Remove decl.
(deprecated_delete_tracepoint_hook): Remove decl.
(deprecated_modify_tracepoint_hook): Remove decl.
(ALL_TRACEPOINTS, ALL_TRACEPOINTS_SAFE): Remove.
(free_actions): Update signature.
(validate_actionline): Update signature.
(end_actions_pseudocommand): Declare.
(while_stepping_pseudocommand): Declare.
* tracepoint.c: Include breakpoint.h.
(tracepoint_chain, tracepoint_count): Remove.
(free_actions, make_cleanup_free_actions): Update signature.
(trace_command, set_raw_tracepoint): Remove.
(trace_mention): Remove.
(tracepoints_info): Remove.
(tracepoint_operation, map_args_over_tracepoints): Remove.
(get_tracepoint_by_number): Remove.
(enable_trace_command, disable_trace_command): Remove.
(delete_trace_command, trace_pass_command): Remove.
(trace_actions_command, read_actions): Update signature.
(validate_actionline): Update signature, use bp loc.
(encode_actions): Ditto.
(download_tracepoint): New function, body of trace_start_command.
(trace_start_command): Call it, use all_tracepoints.
(tracepoint_save_command): Remove.
(tracepoint_dump_command): Use get_tracepoint.
(end_actions_pseudocommand): Make globally visible.
(while_stepping_pseudocommand): Ditto.
(_initialize_tracepoint): Move command definitions to breakpoint.c.
doc/
* gdb.texinfo (Tracepoints): Describe tracepoints as a
special case of breakpoints.
(Enable and Disable Tracepoints): Mention deprecation.
(Listing Tracepoints): Update description and example.
testsuite/
* gdb.trace/actions.exp: Update to match new info trace format.
* gdb.trace/deltrace.exp: Ditto.
* gdb.trace/infotrace.exp: Ditto.
* gdb.trace/passcount.exp: Ditto.
* gdb.trace/save-trace.exp: Ditto.
* gdb.trace/while-stepping.exp: Ditto.
* gdb.trace/tracecmd.exp: Ditto, plus don't allow pending option.
gdbtk/
* generic/gdbtk-bp.c (gdb_actions_command): Update to handle
tracepoints as breakpoints.
(gdb_get_tracepoint_info): Ditto, plus use get_tracepoint and
breakpoint locations.
(tracepoint_exists): Ditto, plus use all_tracepoints.
2009-03-31 05:08:37 +00:00
|
|
|
# }
|
2013-06-07 17:31:09 +00:00
|
|
|
incr ourstate
|
|
|
|
exp_continue
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
2015-11-23 23:47:09 +00:00
|
|
|
if { $ourstate >= 7 } {
|
2013-06-07 17:31:09 +00:00
|
|
|
set result "pass"
|
1999-04-16 01:35:26 +00:00
|
|
|
} else {
|
2013-06-07 17:31:09 +00:00
|
|
|
set result "fail"
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
default {
|
2013-06-07 17:31:09 +00:00
|
|
|
set result "fail"
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
}
|
2013-06-07 17:31:09 +00:00
|
|
|
$result $testname
|
2010-03-31 17:59:49 +00:00
|
|
|
|
|
|
|
gdb_test "show default-collect" \
|
|
|
|
"The list of expressions to collect by default is \"gdb_char_test, gdb_long_test - 100\"..*" \
|
2015-11-23 23:47:08 +00:00
|
|
|
"verify default-collect"
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
proc do_save_load_test { save_path } {
|
|
|
|
# Save current tracepoint definitions to a file
|
|
|
|
gdb_save_tracepoints $save_path
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
# Clear existing tracepoints and reload from file
|
|
|
|
gdb_load_tracepoints $save_path
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
# Check if they match the expected tracepoints
|
|
|
|
gdb_verify_tracepoints "verify recovered tracepoints"
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
gdb_verify_tracepoints "verify trace setup"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
with_test_prefix "relative" {
|
2016-02-16 14:00:50 +00:00
|
|
|
set filepath [standard_output_file "savetrace-relative.tr"]
|
|
|
|
|
|
|
|
# This only works because the pwd is a prefix of the standard output
|
|
|
|
# directory. If this assumption becomes false, then this test needs to be
|
|
|
|
# changed (the relative path from [pwd] to the standard output directory
|
|
|
|
# will become a bit more complicated to compute).
|
|
|
|
if {[string first [pwd] $filepath] != 0} {
|
|
|
|
error "[pwd] is not a prefix of $filepath."
|
|
|
|
}
|
|
|
|
|
|
|
|
set filepath [string map "[pwd] ." $filepath]
|
|
|
|
do_save_load_test "$filepath"
|
2015-11-23 23:47:08 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
with_test_prefix "absolute" {
|
|
|
|
do_save_load_test [standard_output_file "savetrace-absolute.tr"]
|
|
|
|
}
|
|
|
|
|
|
|
|
# invalid filename
|
1999-04-16 01:35:26 +00:00
|
|
|
# [deferred -- not sure what a good invalid filename would be]
|
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
# save-trace (file already exists)
|
1999-04-16 01:35:26 +00:00
|
|
|
# [expect it to clobber the old one]
|
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
# help save tracepoints
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2015-11-23 23:47:08 +00:00
|
|
|
gdb_test "help save tracepoints" \
|
1999-04-16 01:35:26 +00:00
|
|
|
"Save current tracepoint definitions as a script.*" \
|
2015-11-23 23:47:08 +00:00
|
|
|
"verify help save tracepoints"
|