commit a7e67466d25e5f5172c08d8023290d0bb64fe4ef Author: Pedro Alves Date: Tue Mar 6 14:51:03 2012 +0000 a diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 4647f5a..ed1f8a8 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -1330,8 +1330,9 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr, loffset = (tpaddr + orig_size) - (buildaddr + sizeof (jump_insn)); if (loffset > INT_MAX || loffset < INT_MIN) { - warning ("Cannot handle jump of offset 0x%" PRIx64 " > 4-byte\n", - loffset); + sprintf (err, + "E.Jump back from jump pad too far from tracepoint " + "(offset 0x%" PRIx64 " > int32).", loffset); return 1; } @@ -1347,8 +1348,9 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr, loffset = *jump_entry - (tpaddr + sizeof (jump_insn)); if (loffset > INT_MAX || loffset < INT_MIN) { - warning ("Cannot handle jump of offset 0x%" PRIx64 " > 4-byte\n", - loffset); + sprintf (err, + "E.Jump pad too far from tracepoint " + "(offset 0x%" PRIx64 " > int32).", loffset); return 1; } diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 1f85f9a..3a10daf 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -2304,10 +2304,8 @@ cmd_qtdp (char *own_buf) /* Duplicate tracepoints are never allowed. */ if (tpoint) { - trace_debug ("Tracepoint error: tracepoint %d" - " at 0x%s already exists", + sprintf (own_buf, "E.Tracepoint %d at 0x%s already exists", (int) num, paddress (addr)); - write_enn (own_buf); return; } @@ -2853,10 +2851,7 @@ install_fast_tracepoint (struct tracepoint *tpoint, char *errbuf) errbuf); if (err) - { - xsnprintf (errbuf, 50, "E.Failed to install fast tracepoint jumppad"); - return 1; - } + return 1; /* Wire it in. */ tpoint->handle = set_fast_tracepoint_jump (tpoint->address, fjump, diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp index dc9b8a9..a9bbbbc 100644 --- a/gdb/testsuite/gdb.trace/change-loc.exp +++ b/gdb/testsuite/gdb.trace/change-loc.exp @@ -98,7 +98,21 @@ proc tracepoint_change_loc_1 { trace_type } { with_test_prefix "1 $trace_type" { 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" + set test "set tracepoint on set_tracepoint" + gdb_test_multiple "${trace_type} set_tracepoint" $test { + -re "Target returns error code .* too far .*$gdb_prompt $" { + if [string equal $trace_type "ftrace"] { + # The target was unable to install the fast tracepoint + # (e.g., jump pad too far from tracepoint). + pass "$test (too far)" + } else { + fail $test + } + } + -re "\r\n$gdb_prompt $" { + pass $test + } + } gdb_trace_setactions "set action for tracepoint" "" \ "collect \$$pcreg" "^$" @@ -109,21 +123,22 @@ proc tracepoint_change_loc_1 { trace_type } { with_test_prefix "1 $trace_type" { \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\.*4\.1.* in func4.*4\.2.* in func4.*" \ "tracepoint with two locations" - gdb_test_multiple "continue" "continue to marker 2" { - -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { - pass "continue to marker 2" - } - -re ".*$gdb_prompt $" { - - # It is possible to unable to create a jumppad for a fast tracepoint - # due to the limitation of instructions. We simply return to skip - # the rest of tests. + set test "continue to marker 2" + gdb_test_multiple "continue" $test { + -re "Target returns error code .*Tracepoint 4 at .* already exists.*$gdb_prompt $" { if [string equal $trace_type "ftrace"] { + # Expected if the target was unable to install the + # fast tracepoint (e.g., jump pad too far from + # tracepoint) earlier. + pass "$test (tracepoint already exists)" + # Skip the rest of the tests. return } else { - fail "continue to marker 2" + fail $test } - + } + -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { + pass "continue to marker 2" } } # tracepoint has three locations after shlib change-loc-2 is loaded. @@ -206,21 +221,20 @@ proc tracepoint_change_loc_2 { trace_type } { with_test_prefix "2 $trace_type" { "breakpoint on marker" # tracepoint with two locations will be downloaded and installed. - gdb_test_multiple "tstart" "tstart" { + set test "tstart" + gdb_test_multiple "tstart" $test { -re "^tstart\r\n$gdb_prompt $" { - if ![string match "" "tstart"] then { - pass "tstart" - } + pass $test } - -re ".*$gdb_prompt $" { - # It is possible to unable to create a jumppad for a fast tracepoint - # due to the limitation of instructions. We simply return to skip - # the rest of tests. - + -re "Target returns error code .* too far .*$gdb_prompt $" { if [string equal $trace_type "ftrace"] { + # The target was unable to install the fast tracepoint + # (e.g., jump pad too far from tracepoint). + pass "$test (too far)" + # Skip the rest of the tests. return } else { - fail "tstart" + fail $test } } } diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp index 88b294a..f2147cc 100644 --- a/gdb/testsuite/gdb.trace/pending.exp +++ b/gdb/testsuite/gdb.trace/pending.exp @@ -132,21 +132,20 @@ proc pending_tracepoint_works { trace_type } { with_test_prefix "$trace_type wor gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ "breakpoint on marker" - gdb_test_multiple "tstart" "start trace experiment" { + set test "start trace experiment" + gdb_test_multiple "tstart" $test { -re "^tstart\r\n$gdb_prompt $" { - if ![string match "" "tstart"] then { - pass "start trace experiment" - } + pass $test } - -re ".*$gdb_prompt $" { - # It is possible to unable to create a jumppad for a fast tracepoint - # due to the limitation of instructions. We simply return to skip - # the rest of tests. - + -re "Target returns error code .* too far .*$gdb_prompt $" { if [string equal $trace_type "ftrace"] { + # The target was unable to install the fast tracepoint + # (e.g., jump pad too far from tracepoint). + pass "$test (too far)" + # Skip the rest of the tests. return } else { - fail "start trace experiment" + pass $test } } } @@ -199,21 +198,23 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \ gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \ "continue to marker 1" - gdb_test_multiple "continue" "continue to marker 2" { - -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { - pass "continue to marker 2" - } - -re ".*$gdb_prompt $" { - # It is possible to unable to create a jumppad for a fast tracepoint - # due to the limitation of instructions. We simply return to skip - # the rest of tests. - + set test "continue to marker 2" + gdb_test_multiple "continue" $test { + -re "Target returns error code .*Tracepoint .* at .* already exists.*$gdb_prompt $" { if [string equal $trace_type "ftrace"] { + # Expected if the target was unable to install the + # fast tracepoint (e.g., jump pad too far from + # tracepoint) earlier. + pass "$test (tracepoint already exists)" + # Skip the rest of the tests. return } else { - fail "continue to marker 2" + fail $test } } + -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { + pass $test + } } gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" @@ -270,20 +271,23 @@ proc pending_tracepoint_installed_during_trace { trace_type } \ \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \t\]+keep y.*PENDING.*set_point2.*" \ "single pending tracepoint on set_point2" - gdb_test_multiple "continue" "continue to marker 2" { - -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { - pass "continue to marker 2" - } - -re ".*$gdb_prompt $" { - # It is possible to unable to create a jumppad for a fast tracepoint - # due to the limitation of instructions. We simply return to skip - # the rest of tests. + set test "continue to marker 2" + gdb_test_multiple "continue" $test { + -re "Target returns error code .*Tracepoint .* at .* already exists.*$gdb_prompt $" { if [string equal $trace_type "ftrace"] { + # Expected if the target was unable to install the + # fast tracepoint (e.g., jump pad too far from + # tracepoint) earlier. + pass "$test (tracepoint already exists)" + # Skip the rest of the tests. return } else { - fail "continue to marker 2" + fail $test } } + -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { + pass "continue to marker 2" + } } gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" @@ -446,20 +450,23 @@ proc pending_tracepoint_with_action_resolved { trace_type } \ gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \ "continue to marker 1" - gdb_test_multiple "continue" "continue to marker 2" { - -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { - pass "continue to marker 2" - } - -re ".*$gdb_prompt $" { - # It is possible to unable to create a jumppad for a fast tracepoint - # due to the limitation of instructions. We simply return to skip - # the rest of tests. + set test "continue to marker 2" + gdb_test_multiple "continue" $test { + -re "Target returns error code .*Tracepoint .* at .* already exists.*$gdb_prompt $" { if [string equal $trace_type "ftrace"] { + # Expected if the target was unable to install the + # fast tracepoint (e.g., jump pad too far from + # tracepoint) earlier. + pass "$test (tracepoint already exists)" + # Skip the rest of the tests. return } else { - fail "continue to marker 2" + fail $test } } + -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { + pass $test + } } gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"