1e4d17643d
* remote.c (struct remote_state): <install_in_trace> new field. (PACKET_InstallInTrace): New enum value. (remote_install_in_trace_feature): Support InstallInTrace. (remote_supports_install_in_trace): Likewise. (remote_protocol_features): Likewise. (_initialize_remote): Likewise. (remote_can_download_tracepoint): New. * target.h (struct target): New field `to_can_download_tracepoint'. (target_can_download_tracepoint): New macro. * target.c (update_current_target): Update. * breakpoint.h (struct bp_location): Add comment on field `duplicate'. (should_be_inserted): Don't differentiate breakpoint and tracepoint. (remove_breakpoints): Don't remove tracepoints. (tracepoint_locations_match ): New. (breakpoint_locations_match): Call it. (disable_breakpoints_in_unloaded_shlib): Handle tracepoint. (download_tracepoint_locations): New. (update_global_location_list): Call it. * tracepoint.c (find_matching_tracepoint): Delete. (find_matching_tracepoint_location): Renamed from find_matching_tracepoint. Return bp_location rather than tracepoint. (merge_uploaded_tracepoints): Set `inserted' field to 1 if tracepoint is found. gdb/doc/ * gdb.texinfo (Create and Delete Tracepoints): Describe changed behavior of tracepoint. (General Query Packets): New feature InstallInTrace. (Remote Configuration): Document "set remote install-in-trace-packet". gdb/gdbserver/ * server.c (handle_query): Handle InstallInTrace for qSupported. * tracepoint.c (add_tracepoint): Sort list. (install_tracepoint, download_tracepoint): New. (cmd_qtdp): Call them to install and download tracepoints. (sort_tracepoints): Removed. (cmd_qtstart): Update. gdb/testsuite/ * gdb.trace/change-loc-1.c: New. * gdb.trace/change-loc-2.c: New. * gdb.trace/change-loc.c: New. * gdb.trace/change-loc.exp: New. * gdb.trace/change-loc.h: New. * gdb.trace/trace-break.c (marker): Define new symbol. * gdb.trace/trace-break.exp (break_trace_same_addr_5): New. (break_trace_same_addr_6): New.
153 lines
4.4 KiB
Text
153 lines
4.4 KiB
Text
# 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 "change-loc"
|
|
set libfile1 "change-loc-1"
|
|
set libfile2 "change-loc-2"
|
|
set srcfile $testfile.c
|
|
set executable $testfile
|
|
set libsrc1 $srcdir/$subdir/$libfile1.c
|
|
set libsrc2 $srcdir/$subdir/$libfile2.c
|
|
set binfile $objdir/$subdir/$testfile
|
|
set lib_sl1 $objdir/$subdir/$libfile1.sl
|
|
set lib_sl2 $objdir/$subdir/$libfile2.sl
|
|
|
|
set lib_opts debug
|
|
|
|
if [get_compiler_info ${binfile}] {
|
|
return -1
|
|
}
|
|
|
|
# Some targets have leading underscores on assembly symbols.
|
|
set additional_flags [list debug shlib=$lib_sl1 shlib_load [gdb_target_symbol_prefix_flags]]
|
|
|
|
if { [gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != ""
|
|
|| [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != ""
|
|
|| [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $additional_flags] != ""} {
|
|
untested "Could not compile either $libsrc1 or $srcdir/$subdir/$srcfile."
|
|
return -1
|
|
}
|
|
|
|
clean_restart $executable
|
|
|
|
gdb_load_shlibs $lib_sl1
|
|
gdb_load_shlibs $lib_sl2
|
|
|
|
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;
|
|
}
|
|
|
|
if [is_amd64_regs_target] {
|
|
set pcreg "rip"
|
|
} elseif [is_x86_like_target] {
|
|
set pcreg "eip"
|
|
} else {
|
|
set pcreg "pc"
|
|
}
|
|
|
|
|
|
# Set tracepoint during tracing experiment.
|
|
|
|
proc tracepoint_change_loc_1 { trace_type } {
|
|
global testfile
|
|
global srcfile
|
|
global pcreg
|
|
global gdb_prompt
|
|
global pf_prefix
|
|
|
|
set old_pf_prefix $pf_prefix
|
|
set pf_prefix "$pf_prefix 1 $trace_type:"
|
|
|
|
clean_restart ${testfile}
|
|
if ![runto_main] {
|
|
fail "Can't run to main"
|
|
set pf_prefix $old_pf_prefix
|
|
return -1
|
|
}
|
|
gdb_test_no_output "delete break 1"
|
|
|
|
# Set a tracepoint we'll never meet. Just to avoid the complain after
|
|
# type `tstart' later.
|
|
gdb_test "next" ".*"
|
|
gdb_test "trace main" "Tracepoint \[0-9\] at.* file .*$srcfile, line.*" \
|
|
"set tracepoint on main"
|
|
|
|
gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \
|
|
"breakpoint on marker"
|
|
|
|
gdb_test_no_output "tstart"
|
|
|
|
gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
|
|
"continue to marker 1"
|
|
# Set a tracepoint during tracing.
|
|
gdb_test "${trace_type} set_tracepoint" ".*" "set tracepoint on set_tracepoint"
|
|
|
|
gdb_trace_setactions "set action for tracepoint" "" \
|
|
"collect \$$pcreg" "^$"
|
|
|
|
# tracepoint has two locations after shlib change-loc-1 is loaded.
|
|
gdb_test "info trace" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.*4\.2.* in func4.*" \
|
|
"tracepoint with two locations"
|
|
|
|
setup_kfail "gdb/13392" x86_64-*-*
|
|
gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
|
|
"continue to marker 2"
|
|
|
|
# tracepoint has three locations after shlib change-loc-2 is loaded.
|
|
gdb_test "info trace" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.*4\.2.* in func4.*4\.3.* in func4 .*" \
|
|
"tracepoint with three locations"
|
|
|
|
gdb_test_no_output "tstop"
|
|
|
|
setup_kfail "gdb/13392" x86_64-*-*
|
|
gdb_test "tfind" "Found trace frame 0, tracepoint 4.*" "tfind frame 0"
|
|
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
|
|
|
|
set pf_prefix $old_pf_prefix
|
|
}
|
|
|
|
|
|
tracepoint_change_loc_1 "trace"
|
|
|
|
# Re-compile test case with IPA.
|
|
set libipa $objdir/../gdbserver/libinproctrace.so
|
|
gdb_load_shlibs $libipa
|
|
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable \
|
|
[list debug nowarnings shlib=$libipa shlib=$lib_sl1 shlib_load] ] != "" } {
|
|
untested change-loc.exp
|
|
return -1
|
|
}
|
|
|
|
tracepoint_change_loc_1 "ftrace"
|