diff options
author | Yao Qi <yao@codesourcery.com> | 2011-12-15 12:43:03 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2011-12-15 12:43:03 +0000 |
commit | 1576bd00ee92a0d0ebd9191ac84a12fd9dde757d (patch) | |
tree | 3fc3e1e958732511769aed43053ef942571950f4 | |
parent | 82067193611db4c4e4cc8fcd8a243e787c0fc2e3 (diff) | |
download | gdb-1576bd00ee92a0d0ebd9191ac84a12fd9dde757d.zip gdb-1576bd00ee92a0d0ebd9191ac84a12fd9dde757d.tar.gz gdb-1576bd00ee92a0d0ebd9191ac84a12fd9dde757d.tar.bz2 |
gdb/testsuite/
* gdb.trace/strace.c: New
* gdb.trace/strace.exp: New.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/strace.c | 32 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/strace.exp | 118 |
3 files changed, 155 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4db009e..c432e2b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-15 Yao Qi <yao@codesourcery.com> + + * gdb.trace/strace.c: New + * gdb.trace/strace.exp: New. + 2011-12-14 Tom Tromey <tromey@redhat.com> * gdb.dwarf2/dw2-inline-param.exp: Log the objcopy command. diff --git a/gdb/testsuite/gdb.trace/strace.c b/gdb/testsuite/gdb.trace/strace.c new file mode 100644 index 0000000..cec4c14 --- /dev/null +++ b/gdb/testsuite/gdb.trace/strace.c @@ -0,0 +1,32 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 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 <http://www.gnu.org/licenses/>. */ + +#include <ust/marker.h> + +static void +end (void) +{} + +int +main (void) +{ + trace_mark(ust, bar, "str %s", "FOOBAZ"); + trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800); + + end (); + return 0; +} diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp new file mode 100644 index 0000000..51a9f56 --- /dev/null +++ b/gdb/testsuite/gdb.trace/strace.exp @@ -0,0 +1,118 @@ +# Copyright 2011 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 <http://www.gnu.org/licenses/>. + +load_lib "trace-support.exp"; + +if $tracelevel then { + strace $tracelevel +} + +if {[skip_shlib_tests]} { + return 0 +} + +set testfile "strace" +set srcfile $testfile.c +set binfile $objdir/$subdir/$testfile +set executable $testfile + +set libipa $objdir/../gdbserver/libinproctrace.so + +set lib_opts debug + +if [get_compiler_info ${binfile}] { + return -1 +} + +set additional_flags [list debug shlib=$libipa shlib_load "additional_flags=-lust -lurcu-bp" ] + +if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $additional_flags] != ""} { + untested "UST library or headers are not installed" + return -1 +} + +clean_restart $executable + +if ![runto_main] { + fail "Can't run to main to check for trace support" + return -1 +} + +if { ![gdb_target_supports_trace] } then { + unsupported "Current target does not support trace" + return -1; +} + +gdb_load_shlibs $libipa + +proc strace_info_marker { } { + global executable + global pf_prefix + + set old_pf_prefix $pf_prefix + lappend pf_prefix "info_marker" + + # Restart with a fresh gdb. + clean_restart $executable + if ![runto_main] { + fail "Can't run to main" + set pf_prefix $old_pf_prefix + return -1 + } + + # List the markers in program. They should be disabled. + gdb_test "info static-tracepoint-markers" \ + ".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*" + + set pf_prefix $old_pf_prefix +} + +proc strace_probe_marker { } { + global executable + global pf_prefix + global expect_out + global gdb_prompt + global hex + + set old_pf_prefix $pf_prefix + lappend pf_prefix "probe_marker" + + # Restart with a fresh gdb. + clean_restart $executable + if ![runto_main] { + fail "Can't run to main" + set pf_prefix $old_pf_prefix + return -1 + } + + gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*" + gdb_test "strace -m ust/bar2" "Static tracepoint \[0-9\]+ at ${hex}: file.*" + # Two trace markers should be enabled. + gdb_test "info static-tracepoint-markers" "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*" + + gdb_test "break end" "Breakpoint \[0-9\]+ at.*" + + gdb_test_no_output "tstart" + gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" + gdb_test_no_output "tstop" + + gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0" + gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1" + gdb_test "tfind" "Target failed to find requested trace frame\\..*" + + set pf_prefix $old_pf_prefix +} + +strace_info_marker +strace_probe_marker |