gdb/testsuite/
* gdb.trace/strace.c: New * gdb.trace/strace.exp: New.
This commit is contained in:
parent
8206719361
commit
1576bd00ee
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
Loading…
Reference in New Issue