binutils-gdb/gdb/testsuite/gdb.base/cond-eval-mode.exp

167 lines
4.1 KiB
Plaintext
Raw Normal View History

# Copyright 2012-2017 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/>.
# Test 'set breakpoint condition-evaluation' settings
Conditional Z1 breakpoint hangs GDBserver. While trying to fix hbreak2.exp against GDBserver I noticed this... (gdb) hbreak main if 1 Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000 Sending packet: $m40058f,1#31...Packet received: c7 Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46. Sending packet: $Z1,40058f,1;X3,220127#9b... *hangs forever* The issue is that nothing advances the packet pointer if add_breakpoint_condition either fails to parse the agent expression, or fails to find the breakpoint, resulting in an infinite loop in process_point_options. The latter case should really be fixed by GDBserver tracking GDB Z1 breakpoints in its breakpoint structures like Z0 breakpoints are, but the latter case still needs handling. add_breakpoint_commands has the same issue, though at present I don't know any way to trigger it other than sending a manually cooked packet. Unbelievably, it doesn't look like we have any test that tries setting a conditional hardware breakpoint. Looking at cond-eval-mode.exp, it looks like the file was meant to actually test something, but it's mostly empty today. This patch adds tests that tries all sorts of conditional breakpoints and watchpoints. The test hangs/fails without the GDBserver fix. Tested on x86_64 Fedora 17. gdb/gdbserver/ 2014-04-10 Pedro Alves <palves@redhat.com> * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Check if the condition or command is NULL before checking if the breakpoint is known. On success, return true. * mem-break.h (add_breakpoint_condition): Document return. (add_breakpoint_commands): Add describing comment. * server.c (skip_to_semicolon): New function. (process_point_options): Use it. gdb/testsuite/ 2014-04-10 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.c: New file. * gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust prepare_for_testing to build the new file. Check result of runto_main. (test_break, test_watch): New procedures. (top level): Use them.
2014-04-10 20:22:23 +02:00
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
Conditional Z1 breakpoint hangs GDBserver. While trying to fix hbreak2.exp against GDBserver I noticed this... (gdb) hbreak main if 1 Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000 Sending packet: $m40058f,1#31...Packet received: c7 Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46. Sending packet: $Z1,40058f,1;X3,220127#9b... *hangs forever* The issue is that nothing advances the packet pointer if add_breakpoint_condition either fails to parse the agent expression, or fails to find the breakpoint, resulting in an infinite loop in process_point_options. The latter case should really be fixed by GDBserver tracking GDB Z1 breakpoints in its breakpoint structures like Z0 breakpoints are, but the latter case still needs handling. add_breakpoint_commands has the same issue, though at present I don't know any way to trigger it other than sending a manually cooked packet. Unbelievably, it doesn't look like we have any test that tries setting a conditional hardware breakpoint. Looking at cond-eval-mode.exp, it looks like the file was meant to actually test something, but it's mostly empty today. This patch adds tests that tries all sorts of conditional breakpoints and watchpoints. The test hangs/fails without the GDBserver fix. Tested on x86_64 Fedora 17. gdb/gdbserver/ 2014-04-10 Pedro Alves <palves@redhat.com> * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Check if the condition or command is NULL before checking if the breakpoint is known. On success, return true. * mem-break.h (add_breakpoint_condition): Document return. (add_breakpoint_commands): Add describing comment. * server.c (skip_to_semicolon): New function. (process_point_options): Use it. gdb/testsuite/ 2014-04-10 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.c: New file. * gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust prepare_for_testing to build the new file. Check result of runto_main. (test_break, test_watch): New procedures. (top level): Use them.
2014-04-10 20:22:23 +02:00
if ![runto_main] then {
Fix test names starting with uppercase output by basic functions The following patch is based on the previous patch i sent and handles cases of test names that start with an uppercase letter. Test names should start with lowercase unless it starts with the name of a technology, architecture, ISA etc. This first patch addresses cases of test names output explicitly via xfail, kfail, kpass, fail, pass, unsupported, untested and also names set with the pattern "set test" and "set testname". gdb/testsuite/ChangeLog: 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout all the files below. * gdb.ada/array_return.exp * gdb.ada/catch_ex.exp * gdb.ada/info_exc.exp * gdb.ada/mi_catch_ex.exp * gdb.ada/mi_dyn_arr.exp * gdb.ada/mi_ex_cond.exp * gdb.ada/mi_exc_info.exp * gdb.ada/mi_interface.exp * gdb.ada/mi_task_arg.exp * gdb.ada/mi_task_info.exp * gdb.ada/mi_var_array.exp * gdb.arch/alpha-step.exp * gdb.arch/amd64-disp-step.exp * gdb.arch/arm-disp-step.exp * gdb.arch/disp-step-insn-reloc.exp * gdb.arch/e500-prologue.exp * gdb.arch/ftrace-insn-reloc.exp * gdb.arch/gdb1558.exp * gdb.arch/i386-bp_permanent.exp * gdb.arch/i386-disp-step.exp * gdb.arch/i386-float.exp * gdb.arch/i386-gnu-cfi.exp * gdb.arch/ia64-breakpoint-shadow.exp * gdb.arch/mips16-thunks.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-aix-prologue.exp * gdb.arch/powerpc-power.exp * gdb.arch/ppc-dfp.exp * gdb.arch/s390-tdbregs.exp * gdb.arch/spu-info.exp * gdb.arch/spu-ls.exp * gdb.arch/thumb-bx-pc.exp * gdb.base/advance.exp * gdb.base/annota-input-while-running.exp * gdb.base/arrayidx.exp * gdb.base/asmlabel.exp * gdb.base/async.exp * gdb.base/attach-wait-input.exp * gdb.base/auto-connect-native-target.exp * gdb.base/batch-preserve-term-settings.exp * gdb.base/bfp-test.exp * gdb.base/bigcore.exp * gdb.base/bp-permanent.exp * gdb.base/break-always.exp * gdb.base/break-fun-addr.exp * gdb.base/break-idempotent.exp * gdb.base/break-main-file-remove-fail.exp * gdb.base/break-probes.exp * gdb.base/break-unload-file.exp * gdb.base/break.exp * gdb.base/call-ar-st.exp * gdb.base/call-rt-st.exp * gdb.base/call-sc.exp * gdb.base/call-signal-resume.exp * gdb.base/call-strs.exp * gdb.base/callexit.exp * gdb.base/callfuncs.exp * gdb.base/catch-gdb-caused-signals.exp * gdb.base/catch-signal-siginfo-cond.exp * gdb.base/catch-syscall.exp * gdb.base/compare-sections.exp * gdb.base/cond-eval-mode.exp * gdb.base/condbreak-call-false.exp * gdb.base/consecutive-step-over.exp * gdb.base/cursal.exp * gdb.base/disabled-location.exp * gdb.base/disasm-end-cu.exp * gdb.base/display.exp * gdb.base/double-prompt-target-event-error.exp * gdb.base/dprintf-bp-same-addr.exp * gdb.base/dprintf-detach.exp * gdb.base/dprintf-next.exp * gdb.base/dprintf-non-stop.exp * gdb.base/dprintf-pending.exp * gdb.base/dso2dso.exp * gdb.base/ending-run.exp * gdb.base/enum_cond.exp * gdb.base/examine-backward.exp * gdb.base/exe-lock.exp * gdb.base/exec-invalid-sysroot.exp * gdb.base/execl-update-breakpoints.exp * gdb.base/execution-termios.exp * gdb.base/fileio.exp * gdb.base/fixsection.exp * gdb.base/foll-exec-mode.exp * gdb.base/foll-exec.exp * gdb.base/fork-running-state.exp * gdb.base/frame-args.exp * gdb.base/fullpath-expand.exp * gdb.base/func-ptr.exp * gdb.base/gcore-relro-pie.exp * gdb.base/gdb1090.exp * gdb.base/gdb1555.exp * gdb.base/global-var-nested-by-dso.exp * gdb.base/gnu-ifunc.exp * gdb.base/hbreak-in-shr-unsupported.exp * gdb.base/hbreak-unmapped.exp * gdb.base/hook-stop.exp * gdb.base/infcall-input.exp * gdb.base/info-fun.exp * gdb.base/info-shared.exp * gdb.base/interrupt-noterm.exp * gdb.base/jit-so.exp * gdb.base/jit.exp * gdb.base/line-symtabs.exp * gdb.base/list.exp * gdb.base/longjmp.exp * gdb.base/macscp.exp * gdb.base/max-value-size.exp * gdb.base/nodebug.exp * gdb.base/nofield.exp * gdb.base/overlays.exp * gdb.base/paginate-after-ctrl-c-running.exp * gdb.base/paginate-bg-execution.exp * gdb.base/paginate-inferior-exit.exp * gdb.base/pending.exp * gdb.base/pr11022.exp * gdb.base/printcmds.exp * gdb.base/ptr-typedef.exp * gdb.base/ptype.exp * gdb.base/randomize.exp * gdb.base/range-stepping.exp * gdb.base/realname-expand.exp * gdb.base/relativedebug.exp * gdb.base/remote.exp * gdb.base/savedregs.exp * gdb.base/sepdebug.exp * gdb.base/set-noassign.exp * gdb.base/shlib-call.exp * gdb.base/shreloc.exp * gdb.base/sigaltstack.exp * gdb.base/sigbpt.exp * gdb.base/siginfo-addr.exp * gdb.base/siginfo-obj.exp * gdb.base/siginfo-thread.exp * gdb.base/signest.exp * gdb.base/signull.exp * gdb.base/sigrepeat.exp * gdb.base/skip.exp * gdb.base/so-impl-ld.exp * gdb.base/solib-corrupted.exp * gdb.base/solib-disc.exp * gdb.base/solib-display.exp * gdb.base/solib-overlap.exp * gdb.base/solib-search.exp * gdb.base/solib-symbol.exp * gdb.base/source-execution.exp * gdb.base/sss-bp-on-user-bp-2.exp * gdb.base/sss-bp-on-user-bp.exp * gdb.base/stack-checking.exp * gdb.base/stale-infcall.exp * gdb.base/step-break.exp * gdb.base/step-line.exp * gdb.base/step-over-exit.exp * gdb.base/step-test.exp * gdb.base/structs.exp * gdb.base/sym-file.exp * gdb.base/symtab-search-order.exp * gdb.base/term.exp * gdb.base/type-opaque.exp * gdb.base/unload.exp * gdb.base/until-nodebug.exp * gdb.base/until.exp * gdb.base/unwindonsignal.exp * gdb.base/watch-cond.exp * gdb.base/watch-non-mem.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-reuse-slot.exp * gdb.base/watchpoint-solib.exp * gdb.base/watchpoint.exp * gdb.btrace/dlopen.exp * gdb.cell/arch.exp * gdb.cell/break.exp * gdb.cell/bt.exp * gdb.cell/core.exp * gdb.cell/data.exp * gdb.cell/dwarfaddr.exp * gdb.cell/ea-cache.exp * gdb.cell/ea-standalone.exp * gdb.cell/ea-test.exp * gdb.cell/f-regs.exp * gdb.cell/fork.exp * gdb.cell/gcore.exp * gdb.cell/mem-access.exp * gdb.cell/ptype.exp * gdb.cell/registers.exp * gdb.cell/sizeof.exp * gdb.cell/solib-symbol.exp * gdb.cell/solib.exp * gdb.compile/compile-tls.exp * gdb.cp/exception.exp * gdb.cp/gdb2495.exp * gdb.cp/local.exp * gdb.cp/mb-inline.exp * gdb.cp/mb-templates.exp * gdb.cp/pr10687.exp * gdb.cp/pr9167.exp * gdb.cp/scope-err.exp * gdb.cp/templates.exp * gdb.cp/virtfunc.exp * gdb.dwarf2/dw2-dir-file-name.exp * gdb.dwarf2/dw2-single-line-discriminators.exp * gdb.fortran/complex.exp * gdb.fortran/library-module.exp * gdb.guile/guile.exp * gdb.guile/scm-cmd.exp * gdb.guile/scm-frame-inline.exp * gdb.guile/scm-objfile.exp * gdb.guile/scm-pretty-print.exp * gdb.guile/scm-symbol.exp * gdb.guile/scm-type.exp * gdb.guile/scm-value.exp * gdb.linespec/keywords.exp * gdb.linespec/ls-errs.exp * gdb.linespec/macro-relative.exp * gdb.linespec/thread.exp * gdb.mi/mi-breakpoint-changed.exp * gdb.mi/mi-dprintf-pending.exp * gdb.mi/mi-fullname-deleted.exp * gdb.mi/mi-logging.exp * gdb.mi/mi-pending.exp * gdb.mi/mi-solib.exp * gdb.mi/new-ui-mi-sync.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/dummy-frame-restore.exp * gdb.multi/multi-arch-exec.exp * gdb.multi/remove-inferiors.exp * gdb.multi/watchpoint-multi-exit.exp * gdb.opt/solib-intra-step.exp * gdb.perf/backtrace.exp * gdb.perf/single-step.exp * gdb.perf/skip-command.exp * gdb.perf/skip-prologue.exp * gdb.perf/solib.exp * gdb.python/lib-types.exp * gdb.python/py-as-string.exp * gdb.python/py-bad-printers.exp * gdb.python/py-block.exp * gdb.python/py-breakpoint.exp * gdb.python/py-cmd.exp * gdb.python/py-events.exp * gdb.python/py-evthreads.exp * gdb.python/py-finish-breakpoint.exp * gdb.python/py-finish-breakpoint2.exp * gdb.python/py-frame-inline.exp * gdb.python/py-frame.exp * gdb.python/py-inferior.exp * gdb.python/py-infthread.exp * gdb.python/py-mi.exp * gdb.python/py-objfile.exp * gdb.python/py-pp-maint.exp * gdb.python/py-pp-registration.exp * gdb.python/py-prettyprint.exp * gdb.python/py-recurse-unwind.exp * gdb.python/py-shared.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-template.exp * gdb.python/py-type.exp * gdb.python/py-unwind-maint.exp * gdb.python/py-unwind.exp * gdb.python/py-value.exp * gdb.python/python.exp * gdb.reverse/finish-reverse-bkpt.exp * gdb.reverse/insn-reverse.exp * gdb.reverse/next-reverse-bkpt-over-sr.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/solib-reverse.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/fork-child-threads.exp * gdb.threads/fork-plus-threads.exp * gdb.threads/fork-thread-pending.exp * gdb.threads/forking-threads-plus-breakpoint.exp * gdb.threads/hand-call-in-threads.exp * gdb.threads/interrupted-hand-call.exp * gdb.threads/linux-dp.exp * gdb.threads/local-watch-wrong-thread.exp * gdb.threads/next-while-other-thread-longjmps.exp * gdb.threads/non-ldr-exit.exp * gdb.threads/pending-step.exp * gdb.threads/print-threads.exp * gdb.threads/process-dies-while-detaching.exp * gdb.threads/process-dies-while-handling-bp.exp * gdb.threads/pthreads.exp * gdb.threads/queue-signal.exp * gdb.threads/reconnect-signal.exp * gdb.threads/signal-command-handle-nopass.exp * gdb.threads/signal-command-multiple-signals-pending.exp * gdb.threads/signal-delivered-right-thread.exp * gdb.threads/signal-sigtrap.exp * gdb.threads/sigthread.exp * gdb.threads/staticthreads.exp * gdb.threads/stepi-random-signal.exp * gdb.threads/thread-unwindonsignal.exp * gdb.threads/thread_check.exp * gdb.threads/thread_events.exp * gdb.threads/tid-reuse.exp * gdb.threads/tls-nodebug.exp * gdb.threads/tls-shared.exp * gdb.threads/tls-so_extern.exp * gdb.threads/tls.exp * gdb.threads/wp-replication.exp * gdb.trace/actions-changed.exp * gdb.trace/actions.exp * gdb.trace/backtrace.exp * gdb.trace/change-loc.exp * gdb.trace/collection.exp * gdb.trace/deltrace.exp * gdb.trace/disconnected-tracing.exp * gdb.trace/entry-values.exp * gdb.trace/ftrace-lock.exp * gdb.trace/ftrace.exp * gdb.trace/infotrace.exp * gdb.trace/mi-trace-frame-collected.exp * gdb.trace/mi-trace-unavailable.exp * gdb.trace/mi-traceframe-changed.exp * gdb.trace/mi-tracepoint-changed.exp * gdb.trace/mi-tsv-changed.exp * gdb.trace/no-attach-trace.exp * gdb.trace/packetlen.exp * gdb.trace/passc-dyn.exp * gdb.trace/passcount.exp * gdb.trace/pending.exp * gdb.trace/pr16508.exp * gdb.trace/qtro.exp * gdb.trace/range-stepping.exp * gdb.trace/read-memory.exp * gdb.trace/report.exp * gdb.trace/save-trace.exp * gdb.trace/signal.exp * gdb.trace/stap-trace.exp * gdb.trace/status-stop.exp * gdb.trace/strace.exp * gdb.trace/tfile.exp * gdb.trace/tfind.exp * gdb.trace/trace-break.exp * gdb.trace/trace-condition.exp * gdb.trace/trace-enable-disable.exp * gdb.trace/trace-mt.exp * gdb.trace/tracecmd.exp * gdb.trace/tracefile-pseudo-reg.exp * gdb.trace/tspeed.exp * gdb.trace/tstatus.exp * gdb.trace/tsv.exp * gdb.trace/unavailable.exp * gdb.trace/while-dyn.exp * gdb.trace/while-stepping.exp * lib/gdb-guile.exp * lib/gdb.exp * lib/mi-support.exp * lib/pascal.exp * lib/perftest.exp * lib/prelink-support.exp * lib/selftest-support.exp
2016-12-01 21:40:05 +01:00
fail "can't run to main"
Conditional Z1 breakpoint hangs GDBserver. While trying to fix hbreak2.exp against GDBserver I noticed this... (gdb) hbreak main if 1 Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000 Sending packet: $m40058f,1#31...Packet received: c7 Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46. Sending packet: $Z1,40058f,1;X3,220127#9b... *hangs forever* The issue is that nothing advances the packet pointer if add_breakpoint_condition either fails to parse the agent expression, or fails to find the breakpoint, resulting in an infinite loop in process_point_options. The latter case should really be fixed by GDBserver tracking GDB Z1 breakpoints in its breakpoint structures like Z0 breakpoints are, but the latter case still needs handling. add_breakpoint_commands has the same issue, though at present I don't know any way to trigger it other than sending a manually cooked packet. Unbelievably, it doesn't look like we have any test that tries setting a conditional hardware breakpoint. Looking at cond-eval-mode.exp, it looks like the file was meant to actually test something, but it's mostly empty today. This patch adds tests that tries all sorts of conditional breakpoints and watchpoints. The test hangs/fails without the GDBserver fix. Tested on x86_64 Fedora 17. gdb/gdbserver/ 2014-04-10 Pedro Alves <palves@redhat.com> * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Check if the condition or command is NULL before checking if the breakpoint is known. On success, return true. * mem-break.h (add_breakpoint_condition): Document return. (add_breakpoint_commands): Add describing comment. * server.c (skip_to_semicolon): New function. (process_point_options): Use it. gdb/testsuite/ 2014-04-10 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.c: New file. * gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust prepare_for_testing to build the new file. Check result of runto_main. (test_break, test_watch): New procedures. (top level): Use them.
2014-04-10 20:22:23 +02:00
return 0
}
set test_host "set breakpoint condition-evaluation host"
set test_auto "set breakpoint condition-evaluation auto"
set test_target "set breakpoint condition-evaluation target"
gdb_test_no_output $test_host
gdb_test_no_output $test_auto
# If target-side condition evaluation is not supported, this warning will be
# displayed.
Fix several "set remote foo-packet on/off" commands. For several RSP packets, there's a corresponding "set remote foo-packet on/off/auto" command that one can use do bypass auto-detection of support for the packet or feature. However, I noticed that setting several of these commands to 'on' or 'off' doesn't actually have any effect. These are, at least: set remote breakpoint-commands-packet set remote conditional-breakpoints-packet set remote fast-tracepoints-packet set remote static-tracepoints-packet set remote install-in-trace-packet These are commands that control a remote protocol feature that doesn't have a corresponding regular packet, and because of that we cache the knowledge of the remote side support as returned by the qSupported packet in the remote_state object. E.g., in the case of the 'set remote breakpoint-commands-packet' command, whether the feature is supported is recorded in the 'breakpoint_commands' field of the remote_state object. Whether to bypass packet support auto-detection or not is controlled by the 'detect' field of the corresponding packet's packet_config structure. That field is the variable associated directly with the "set remote foo-packet" command. Actual remote stub support for the packet (or feature) is recorded in the 'support' field of the same structure. However, when the user toggles the command, the 'support' field is also correspondingly updated to PACKET_ENABLE/DISABLE/SUPPORT_UNKNOWN, discarding the knowledge of whether the target actually supports the feature. If one toggles back to 'auto', it's no big issue for real packets, as they'll just end up re-probed the next time they might be necessary. But features whose support is only reported through qSupported don't get their corresponding (manually added/maintained) fields in remote_state objected updated. As we lost the actual status of the target support for the feature, GDB would need to probe the qSupported features again, which GDB doesn't do. But we can avoid that extra traffic, and clean things up, IMO. Instead of going in that direction, this patch completely decouples struct packet_config's 'detect' and 'support' fields. E.g., when the user does "set remote foo-packet off", instead of setting the packet config's 'support' field to PACKET_DISABLE, the 'support' field is not touched at all anymore. That is, we end up respecting this simple table: | packet_config->detect | packet_config->support | should use packet/feature? | |-----------------------+------------------------+----------------------------| | auto | PACKET_ENABLE | PACKET_ENABLE | | auto | PACKET_DISABLE | PACKET_DISABLE | | auto | PACKET_UNKNOWN | PACKET_UNKNOWN | | yes | don't care | PACKET_ENABLE | | no | don't care | PACKET_DISABLE | This is implemented by the new packet_support function. With that, we need to update this pattern throughout: if (remote_protocol_packets[PACKET_foo].support == PACKET_DISABLE) to do this instead: if (packet_support (PACKET_qAttached) == PACKET_DISABLE) where as mentioned, the packet_support function takes struct packet_config's 'detect' field into account, like in the table above. As when the packet is force-disabled or force-enabled, the 'support' field is just ignored, if the command is set back to auto, we'll resume respecting whatever the target said it supports. IOW, the end result is that the 'support' field always represents whether the target actually supports the packet or not. After all that, the manually maintained breakpoint_commands and equivalent fields of struct remote_state can then be eliminated, with references replaced by checking the result of calling the packet_support function on the corresponding packet or feature. This required adding new PACKET_foo enum values for several features that didn't have it yet. (The patch does not add corresponding "set remote foo-packet" style commands though, focusing only on bug fixing and laying the groundwork). Tested on x86_64 Fedora 17, native GDBserver. The new tests all fail without this patch. gdb/ 2014-04-25 Pedro Alves <palves@redhat.com> * remote.c (struct remote_state): Remove multi_process_aware, non_stop_aware, cond_tracepoints, cond_breakpoints, breakpoint_commands, fast_tracepoints, static_tracepoints, install_in_trace, disconnected_tracing, enable_disable_tracepoints, string_tracing, and augmented_libraries_svr4_read fields. (remote_multi_process_p): Move further below in the file. (struct packet_config): Add comments. (update_packet_config): Delete function. (show_packet_config_cmd): Use packet_config_support. (add_packet_config_cmd): Use NULL as set callback. (packet_ok): "set remote foo-packet"-style commands no longer change config->supported -- adjust. (PACKET_ConditionalTracepoints, PACKET_ConditionalBreakpoints) (PACKET_BreakpointCommands, PACKET_FastTracepoints) (PACKET_StaticTracepoints, PACKET_InstallInTrace): Add comments. (PACKET_QNonStop, PACKET_multiprocess_feature) (PACKET_EnableDisableTracepoints_feature, PACKET_tracenz_feature) (PACKET_DisconnectedTracing_feature) (PACKET_augmented_libraries_svr4_read_feature): New enum values. (set_remote_protocol_packet_cmd): Delete function. (packet_config_support, packet_support): New functions. (set_remote_protocol_Z_packet_cmd): Don't call update_packet_config. (remote_query_attached, remote_pass_signals) (remote_program_signals, remote_threads_info) (remote_threads_extra_info, remote_start_remote): Use packet_support. (remote_start_remote): Use packet_config_support and packet_support. (init_all_packet_configs): Set all packets to unknown support, instead of calling update_packet_config. (remote_check_symbols): Use packet_support. (remote_supported_packet): Unconditionally set the packet config's support status. (remote_multi_process_feature, remote_non_stop_feature) (remote_cond_tracepoint_feature, remote_cond_breakpoint_feature) (remote_breakpoint_commands_feature) (remote_fast_tracepoint_feature, remote_static_tracepoint_feature) (remote_install_in_trace_feature) (remote_disconnected_tracing_feature) (remote_enable_disable_tracepoint_feature) (remote_string_tracing_feature) (remote_augmented_libraries_svr4_read_feature): Delete functions. (remote_protocol_features): Adjust to use remote_supported_packet for "augmented-libraries-svr4-read", "multiprocess", "QNonStop", "ConditionalTracepoints", "ConditionalBreakpoints", "BreakpointCommands", "FastTracepoints", "StaticTracepoints", "InstallInTrace", "DisconnectedTracing", "DisconnectedTracing", "EnableDisableTracepoints", and "tracenz". (remote_query_supported): Use packet_support. (remote_open_1): Adjust. (extended_remote_attach_1): Use packet_support. Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (remote_vcont_resume): Use packet_support. (remote_resume, remote_stop_ns, fetch_register_using_p) (remote_prepare_to_store, store_register_using_P) (check_binary_download, remote_write_bytes): Use packet_support. (remote_vkill): Use packet_support. Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (extended_remote_supports_disable_randomization): Use packet_support. (extended_remote_run): Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (remote_insert_breakpoint, remote_remove_breakpoint) (remote_insert_watchpoint, remote_remove_watchpoint) (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Use packet_support. (remote_search_memory): Use packet_config_support. (remote_get_thread_local_address, remote_get_tib_address) (remote_hostio_send_command, remote_can_execute_reverse): Use packet_support. (remote_supports_cond_tracepoints) (remote_supports_cond_breakpoints) (remote_supports_fast_tracepoints) (remote_supports_static_tracepoints) (remote_supports_install_in_trace) (remote_supports_enable_disable_tracepoint) (remote_supports_string_tracing) (remote_can_run_breakpoint_commands): Rewrite, checking whether the packet config says the feature is enabled or disabled. (remote_download_tracepoint, remote_trace_set_readonly_regions) (remote_get_trace_status): Use packet_support. (remote_set_disconnected_tracing): Adjust to check whether the feature is enabled with packet_support. (remote_set_trace_buffer_size, remote_use_agent) (remote_can_use_agent, remote_supports_btrace): Use packet_support. (remote_enable_btrace, remote_disable_btrace, remote_read_btrace): Use packet_config_support. (remote_augmented_libraries_svr4_read): Rewrite, checking whether the packet config says the feature is enabled or disabled. (set_range_stepping): Use packet_support. gdb/testsuite/ 2014-04-25 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to user. (top level): Test that "set remote conditional-breakpoints-packet off" works as intended. * gdb.base/dprintf.exp: Test that "set remote breakpoint-commands-packet off" works as intended. * gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled): New function. (top level): Call it. * gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set remote fast-tracepoints-packet off" works as intended. * gdb.trace/qtro.exp (gdb_is_target_remote): Moved ... * lib/gdb.exp (gdb_is_target_remote): ... here.
2014-04-25 19:07:02 +02:00
set warning "warning: Target does not support breakpoint condition evaluation.\r\nUsing host evaluation mode instead."
gdb_test_multiple $test_target $test_target {
Fix several "set remote foo-packet on/off" commands. For several RSP packets, there's a corresponding "set remote foo-packet on/off/auto" command that one can use do bypass auto-detection of support for the packet or feature. However, I noticed that setting several of these commands to 'on' or 'off' doesn't actually have any effect. These are, at least: set remote breakpoint-commands-packet set remote conditional-breakpoints-packet set remote fast-tracepoints-packet set remote static-tracepoints-packet set remote install-in-trace-packet These are commands that control a remote protocol feature that doesn't have a corresponding regular packet, and because of that we cache the knowledge of the remote side support as returned by the qSupported packet in the remote_state object. E.g., in the case of the 'set remote breakpoint-commands-packet' command, whether the feature is supported is recorded in the 'breakpoint_commands' field of the remote_state object. Whether to bypass packet support auto-detection or not is controlled by the 'detect' field of the corresponding packet's packet_config structure. That field is the variable associated directly with the "set remote foo-packet" command. Actual remote stub support for the packet (or feature) is recorded in the 'support' field of the same structure. However, when the user toggles the command, the 'support' field is also correspondingly updated to PACKET_ENABLE/DISABLE/SUPPORT_UNKNOWN, discarding the knowledge of whether the target actually supports the feature. If one toggles back to 'auto', it's no big issue for real packets, as they'll just end up re-probed the next time they might be necessary. But features whose support is only reported through qSupported don't get their corresponding (manually added/maintained) fields in remote_state objected updated. As we lost the actual status of the target support for the feature, GDB would need to probe the qSupported features again, which GDB doesn't do. But we can avoid that extra traffic, and clean things up, IMO. Instead of going in that direction, this patch completely decouples struct packet_config's 'detect' and 'support' fields. E.g., when the user does "set remote foo-packet off", instead of setting the packet config's 'support' field to PACKET_DISABLE, the 'support' field is not touched at all anymore. That is, we end up respecting this simple table: | packet_config->detect | packet_config->support | should use packet/feature? | |-----------------------+------------------------+----------------------------| | auto | PACKET_ENABLE | PACKET_ENABLE | | auto | PACKET_DISABLE | PACKET_DISABLE | | auto | PACKET_UNKNOWN | PACKET_UNKNOWN | | yes | don't care | PACKET_ENABLE | | no | don't care | PACKET_DISABLE | This is implemented by the new packet_support function. With that, we need to update this pattern throughout: if (remote_protocol_packets[PACKET_foo].support == PACKET_DISABLE) to do this instead: if (packet_support (PACKET_qAttached) == PACKET_DISABLE) where as mentioned, the packet_support function takes struct packet_config's 'detect' field into account, like in the table above. As when the packet is force-disabled or force-enabled, the 'support' field is just ignored, if the command is set back to auto, we'll resume respecting whatever the target said it supports. IOW, the end result is that the 'support' field always represents whether the target actually supports the packet or not. After all that, the manually maintained breakpoint_commands and equivalent fields of struct remote_state can then be eliminated, with references replaced by checking the result of calling the packet_support function on the corresponding packet or feature. This required adding new PACKET_foo enum values for several features that didn't have it yet. (The patch does not add corresponding "set remote foo-packet" style commands though, focusing only on bug fixing and laying the groundwork). Tested on x86_64 Fedora 17, native GDBserver. The new tests all fail without this patch. gdb/ 2014-04-25 Pedro Alves <palves@redhat.com> * remote.c (struct remote_state): Remove multi_process_aware, non_stop_aware, cond_tracepoints, cond_breakpoints, breakpoint_commands, fast_tracepoints, static_tracepoints, install_in_trace, disconnected_tracing, enable_disable_tracepoints, string_tracing, and augmented_libraries_svr4_read fields. (remote_multi_process_p): Move further below in the file. (struct packet_config): Add comments. (update_packet_config): Delete function. (show_packet_config_cmd): Use packet_config_support. (add_packet_config_cmd): Use NULL as set callback. (packet_ok): "set remote foo-packet"-style commands no longer change config->supported -- adjust. (PACKET_ConditionalTracepoints, PACKET_ConditionalBreakpoints) (PACKET_BreakpointCommands, PACKET_FastTracepoints) (PACKET_StaticTracepoints, PACKET_InstallInTrace): Add comments. (PACKET_QNonStop, PACKET_multiprocess_feature) (PACKET_EnableDisableTracepoints_feature, PACKET_tracenz_feature) (PACKET_DisconnectedTracing_feature) (PACKET_augmented_libraries_svr4_read_feature): New enum values. (set_remote_protocol_packet_cmd): Delete function. (packet_config_support, packet_support): New functions. (set_remote_protocol_Z_packet_cmd): Don't call update_packet_config. (remote_query_attached, remote_pass_signals) (remote_program_signals, remote_threads_info) (remote_threads_extra_info, remote_start_remote): Use packet_support. (remote_start_remote): Use packet_config_support and packet_support. (init_all_packet_configs): Set all packets to unknown support, instead of calling update_packet_config. (remote_check_symbols): Use packet_support. (remote_supported_packet): Unconditionally set the packet config's support status. (remote_multi_process_feature, remote_non_stop_feature) (remote_cond_tracepoint_feature, remote_cond_breakpoint_feature) (remote_breakpoint_commands_feature) (remote_fast_tracepoint_feature, remote_static_tracepoint_feature) (remote_install_in_trace_feature) (remote_disconnected_tracing_feature) (remote_enable_disable_tracepoint_feature) (remote_string_tracing_feature) (remote_augmented_libraries_svr4_read_feature): Delete functions. (remote_protocol_features): Adjust to use remote_supported_packet for "augmented-libraries-svr4-read", "multiprocess", "QNonStop", "ConditionalTracepoints", "ConditionalBreakpoints", "BreakpointCommands", "FastTracepoints", "StaticTracepoints", "InstallInTrace", "DisconnectedTracing", "DisconnectedTracing", "EnableDisableTracepoints", and "tracenz". (remote_query_supported): Use packet_support. (remote_open_1): Adjust. (extended_remote_attach_1): Use packet_support. Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (remote_vcont_resume): Use packet_support. (remote_resume, remote_stop_ns, fetch_register_using_p) (remote_prepare_to_store, store_register_using_P) (check_binary_download, remote_write_bytes): Use packet_support. (remote_vkill): Use packet_support. Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (extended_remote_supports_disable_randomization): Use packet_support. (extended_remote_run): Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (remote_insert_breakpoint, remote_remove_breakpoint) (remote_insert_watchpoint, remote_remove_watchpoint) (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Use packet_support. (remote_search_memory): Use packet_config_support. (remote_get_thread_local_address, remote_get_tib_address) (remote_hostio_send_command, remote_can_execute_reverse): Use packet_support. (remote_supports_cond_tracepoints) (remote_supports_cond_breakpoints) (remote_supports_fast_tracepoints) (remote_supports_static_tracepoints) (remote_supports_install_in_trace) (remote_supports_enable_disable_tracepoint) (remote_supports_string_tracing) (remote_can_run_breakpoint_commands): Rewrite, checking whether the packet config says the feature is enabled or disabled. (remote_download_tracepoint, remote_trace_set_readonly_regions) (remote_get_trace_status): Use packet_support. (remote_set_disconnected_tracing): Adjust to check whether the feature is enabled with packet_support. (remote_set_trace_buffer_size, remote_use_agent) (remote_can_use_agent, remote_supports_btrace): Use packet_support. (remote_enable_btrace, remote_disable_btrace, remote_read_btrace): Use packet_config_support. (remote_augmented_libraries_svr4_read): Rewrite, checking whether the packet config says the feature is enabled or disabled. (set_range_stepping): Use packet_support. gdb/testsuite/ 2014-04-25 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to user. (top level): Test that "set remote conditional-breakpoints-packet off" works as intended. * gdb.base/dprintf.exp: Test that "set remote breakpoint-commands-packet off" works as intended. * gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled): New function. (top level): Call it. * gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set remote fast-tracepoints-packet off" works as intended. * gdb.trace/qtro.exp (gdb_is_target_remote): Moved ... * lib/gdb.exp (gdb_is_target_remote): ... here.
2014-04-25 19:07:02 +02:00
-re "$warning\r\n$gdb_prompt $" {
unsupported $test_target
return -1
}
-re "^$test_target\r\n$gdb_prompt $" {
pass $test_target
}
}
Conditional Z1 breakpoint hangs GDBserver. While trying to fix hbreak2.exp against GDBserver I noticed this... (gdb) hbreak main if 1 Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000 Sending packet: $m40058f,1#31...Packet received: c7 Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46. Sending packet: $Z1,40058f,1;X3,220127#9b... *hangs forever* The issue is that nothing advances the packet pointer if add_breakpoint_condition either fails to parse the agent expression, or fails to find the breakpoint, resulting in an infinite loop in process_point_options. The latter case should really be fixed by GDBserver tracking GDB Z1 breakpoints in its breakpoint structures like Z0 breakpoints are, but the latter case still needs handling. add_breakpoint_commands has the same issue, though at present I don't know any way to trigger it other than sending a manually cooked packet. Unbelievably, it doesn't look like we have any test that tries setting a conditional hardware breakpoint. Looking at cond-eval-mode.exp, it looks like the file was meant to actually test something, but it's mostly empty today. This patch adds tests that tries all sorts of conditional breakpoints and watchpoints. The test hangs/fails without the GDBserver fix. Tested on x86_64 Fedora 17. gdb/gdbserver/ 2014-04-10 Pedro Alves <palves@redhat.com> * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Check if the condition or command is NULL before checking if the breakpoint is known. On success, return true. * mem-break.h (add_breakpoint_condition): Document return. (add_breakpoint_commands): Add describing comment. * server.c (skip_to_semicolon): New function. (process_point_options): Use it. gdb/testsuite/ 2014-04-10 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.c: New file. * gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust prepare_for_testing to build the new file. Check result of runto_main. (test_break, test_watch): New procedures. (top level): Use them.
2014-04-10 20:22:23 +02:00
Fix several "set remote foo-packet on/off" commands. For several RSP packets, there's a corresponding "set remote foo-packet on/off/auto" command that one can use do bypass auto-detection of support for the packet or feature. However, I noticed that setting several of these commands to 'on' or 'off' doesn't actually have any effect. These are, at least: set remote breakpoint-commands-packet set remote conditional-breakpoints-packet set remote fast-tracepoints-packet set remote static-tracepoints-packet set remote install-in-trace-packet These are commands that control a remote protocol feature that doesn't have a corresponding regular packet, and because of that we cache the knowledge of the remote side support as returned by the qSupported packet in the remote_state object. E.g., in the case of the 'set remote breakpoint-commands-packet' command, whether the feature is supported is recorded in the 'breakpoint_commands' field of the remote_state object. Whether to bypass packet support auto-detection or not is controlled by the 'detect' field of the corresponding packet's packet_config structure. That field is the variable associated directly with the "set remote foo-packet" command. Actual remote stub support for the packet (or feature) is recorded in the 'support' field of the same structure. However, when the user toggles the command, the 'support' field is also correspondingly updated to PACKET_ENABLE/DISABLE/SUPPORT_UNKNOWN, discarding the knowledge of whether the target actually supports the feature. If one toggles back to 'auto', it's no big issue for real packets, as they'll just end up re-probed the next time they might be necessary. But features whose support is only reported through qSupported don't get their corresponding (manually added/maintained) fields in remote_state objected updated. As we lost the actual status of the target support for the feature, GDB would need to probe the qSupported features again, which GDB doesn't do. But we can avoid that extra traffic, and clean things up, IMO. Instead of going in that direction, this patch completely decouples struct packet_config's 'detect' and 'support' fields. E.g., when the user does "set remote foo-packet off", instead of setting the packet config's 'support' field to PACKET_DISABLE, the 'support' field is not touched at all anymore. That is, we end up respecting this simple table: | packet_config->detect | packet_config->support | should use packet/feature? | |-----------------------+------------------------+----------------------------| | auto | PACKET_ENABLE | PACKET_ENABLE | | auto | PACKET_DISABLE | PACKET_DISABLE | | auto | PACKET_UNKNOWN | PACKET_UNKNOWN | | yes | don't care | PACKET_ENABLE | | no | don't care | PACKET_DISABLE | This is implemented by the new packet_support function. With that, we need to update this pattern throughout: if (remote_protocol_packets[PACKET_foo].support == PACKET_DISABLE) to do this instead: if (packet_support (PACKET_qAttached) == PACKET_DISABLE) where as mentioned, the packet_support function takes struct packet_config's 'detect' field into account, like in the table above. As when the packet is force-disabled or force-enabled, the 'support' field is just ignored, if the command is set back to auto, we'll resume respecting whatever the target said it supports. IOW, the end result is that the 'support' field always represents whether the target actually supports the packet or not. After all that, the manually maintained breakpoint_commands and equivalent fields of struct remote_state can then be eliminated, with references replaced by checking the result of calling the packet_support function on the corresponding packet or feature. This required adding new PACKET_foo enum values for several features that didn't have it yet. (The patch does not add corresponding "set remote foo-packet" style commands though, focusing only on bug fixing and laying the groundwork). Tested on x86_64 Fedora 17, native GDBserver. The new tests all fail without this patch. gdb/ 2014-04-25 Pedro Alves <palves@redhat.com> * remote.c (struct remote_state): Remove multi_process_aware, non_stop_aware, cond_tracepoints, cond_breakpoints, breakpoint_commands, fast_tracepoints, static_tracepoints, install_in_trace, disconnected_tracing, enable_disable_tracepoints, string_tracing, and augmented_libraries_svr4_read fields. (remote_multi_process_p): Move further below in the file. (struct packet_config): Add comments. (update_packet_config): Delete function. (show_packet_config_cmd): Use packet_config_support. (add_packet_config_cmd): Use NULL as set callback. (packet_ok): "set remote foo-packet"-style commands no longer change config->supported -- adjust. (PACKET_ConditionalTracepoints, PACKET_ConditionalBreakpoints) (PACKET_BreakpointCommands, PACKET_FastTracepoints) (PACKET_StaticTracepoints, PACKET_InstallInTrace): Add comments. (PACKET_QNonStop, PACKET_multiprocess_feature) (PACKET_EnableDisableTracepoints_feature, PACKET_tracenz_feature) (PACKET_DisconnectedTracing_feature) (PACKET_augmented_libraries_svr4_read_feature): New enum values. (set_remote_protocol_packet_cmd): Delete function. (packet_config_support, packet_support): New functions. (set_remote_protocol_Z_packet_cmd): Don't call update_packet_config. (remote_query_attached, remote_pass_signals) (remote_program_signals, remote_threads_info) (remote_threads_extra_info, remote_start_remote): Use packet_support. (remote_start_remote): Use packet_config_support and packet_support. (init_all_packet_configs): Set all packets to unknown support, instead of calling update_packet_config. (remote_check_symbols): Use packet_support. (remote_supported_packet): Unconditionally set the packet config's support status. (remote_multi_process_feature, remote_non_stop_feature) (remote_cond_tracepoint_feature, remote_cond_breakpoint_feature) (remote_breakpoint_commands_feature) (remote_fast_tracepoint_feature, remote_static_tracepoint_feature) (remote_install_in_trace_feature) (remote_disconnected_tracing_feature) (remote_enable_disable_tracepoint_feature) (remote_string_tracing_feature) (remote_augmented_libraries_svr4_read_feature): Delete functions. (remote_protocol_features): Adjust to use remote_supported_packet for "augmented-libraries-svr4-read", "multiprocess", "QNonStop", "ConditionalTracepoints", "ConditionalBreakpoints", "BreakpointCommands", "FastTracepoints", "StaticTracepoints", "InstallInTrace", "DisconnectedTracing", "DisconnectedTracing", "EnableDisableTracepoints", and "tracenz". (remote_query_supported): Use packet_support. (remote_open_1): Adjust. (extended_remote_attach_1): Use packet_support. Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (remote_vcont_resume): Use packet_support. (remote_resume, remote_stop_ns, fetch_register_using_p) (remote_prepare_to_store, store_register_using_P) (check_binary_download, remote_write_bytes): Use packet_support. (remote_vkill): Use packet_support. Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (extended_remote_supports_disable_randomization): Use packet_support. (extended_remote_run): Switch on the result of packet_ok instead of checking whether the packet ended up disabled. (remote_insert_breakpoint, remote_remove_breakpoint) (remote_insert_watchpoint, remote_remove_watchpoint) (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Use packet_support. (remote_search_memory): Use packet_config_support. (remote_get_thread_local_address, remote_get_tib_address) (remote_hostio_send_command, remote_can_execute_reverse): Use packet_support. (remote_supports_cond_tracepoints) (remote_supports_cond_breakpoints) (remote_supports_fast_tracepoints) (remote_supports_static_tracepoints) (remote_supports_install_in_trace) (remote_supports_enable_disable_tracepoint) (remote_supports_string_tracing) (remote_can_run_breakpoint_commands): Rewrite, checking whether the packet config says the feature is enabled or disabled. (remote_download_tracepoint, remote_trace_set_readonly_regions) (remote_get_trace_status): Use packet_support. (remote_set_disconnected_tracing): Adjust to check whether the feature is enabled with packet_support. (remote_set_trace_buffer_size, remote_use_agent) (remote_can_use_agent, remote_supports_btrace): Use packet_support. (remote_enable_btrace, remote_disable_btrace, remote_read_btrace): Use packet_config_support. (remote_augmented_libraries_svr4_read): Rewrite, checking whether the packet config says the feature is enabled or disabled. (set_range_stepping): Use packet_support. gdb/testsuite/ 2014-04-25 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to user. (top level): Test that "set remote conditional-breakpoints-packet off" works as intended. * gdb.base/dprintf.exp: Test that "set remote breakpoint-commands-packet off" works as intended. * gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled): New function. (top level): Call it. * gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set remote fast-tracepoints-packet off" works as intended. * gdb.trace/qtro.exp (gdb_is_target_remote): Moved ... * lib/gdb.exp (gdb_is_target_remote): ... here.
2014-04-25 19:07:02 +02:00
# We now know that the target supports target-side conditional
# evaluation. Now make sure we can force-disable the
# ConditionalBreakpoints RSP feature.
if [gdb_is_target_remote] {
gdb_test_no_output "set remote conditional-breakpoints-packet off"
gdb_test $test_target "$warning" \
"set breakpoint condition-evaluation target, with support disabled"
# Confirm we can re-enable it.
gdb_test_no_output "set remote conditional-breakpoints-packet on"
gdb_test_no_output $test_target "restore $test_target"
}
Conditional Z1 breakpoint hangs GDBserver. While trying to fix hbreak2.exp against GDBserver I noticed this... (gdb) hbreak main if 1 Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000 Sending packet: $m40058f,1#31...Packet received: c7 Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46. Sending packet: $Z1,40058f,1;X3,220127#9b... *hangs forever* The issue is that nothing advances the packet pointer if add_breakpoint_condition either fails to parse the agent expression, or fails to find the breakpoint, resulting in an infinite loop in process_point_options. The latter case should really be fixed by GDBserver tracking GDB Z1 breakpoints in its breakpoint structures like Z0 breakpoints are, but the latter case still needs handling. add_breakpoint_commands has the same issue, though at present I don't know any way to trigger it other than sending a manually cooked packet. Unbelievably, it doesn't look like we have any test that tries setting a conditional hardware breakpoint. Looking at cond-eval-mode.exp, it looks like the file was meant to actually test something, but it's mostly empty today. This patch adds tests that tries all sorts of conditional breakpoints and watchpoints. The test hangs/fails without the GDBserver fix. Tested on x86_64 Fedora 17. gdb/gdbserver/ 2014-04-10 Pedro Alves <palves@redhat.com> * mem-break.c (add_breakpoint_condition, add_breakpoint_commands): Check if the condition or command is NULL before checking if the breakpoint is known. On success, return true. * mem-break.h (add_breakpoint_condition): Document return. (add_breakpoint_commands): Add describing comment. * server.c (skip_to_semicolon): New function. (process_point_options): Use it. gdb/testsuite/ 2014-04-10 Pedro Alves <palves@redhat.com> * gdb.base/cond-eval-mode.c: New file. * gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust prepare_for_testing to build the new file. Check result of runto_main. (test_break, test_watch): New procedures. (top level): Use them.
2014-04-10 20:22:23 +02:00
# Test setting a condition in a breakpoint. BREAK_COMMAND is the
# break/hwatch command to test.
#
proc test_break { break_command } {
global gdb_prompt
with_test_prefix "$break_command" {
delete_breakpoints
gdb_test "$break_command foo" "reakpoint.* at .*"
# A condition that evals true.
gdb_test "condition \$bpnum cond_global==0" ".*"
set can_do_cmd 0
set test "continue"
gdb_test_multiple $test $test {
-re "You may have requested too many.*$gdb_prompt $" {
pass $test
}
-re "Breakpoint .*, foo .*$gdb_prompt $" {
pass $test
set can_do_cmd 1
}
}
if { !$can_do_cmd } {
unsupported "no target support"
return
}
delete_breakpoints
gdb_test "$break_command foo" ".*reakpoint .* at .*"
# A condition that evals false.
gdb_test "condition \$bpnum cond_global==1" ".*"
gdb_test "b bar" "Breakpoint .* at .*"
gdb_test "continue" "Breakpoint .*, bar .*"
}
}
# Test setting conditions in watchpoints. WATCH_COMMAND is the watch
# command to test.
#
proc test_watch { watch_command } {
global gdb_prompt
with_test_prefix "$watch_command" {
if [target_info exists gdb,no_hardware_watchpoints] {
unsupported "no target support"
return
}
delete_breakpoints
gdb_test "$watch_command global" ".*atchpoint .*: global.*"
# A condition that evals true.
gdb_test "condition \$bpnum cond_global==0" ".*"
set can_do_cmd 0
set test "continue"
gdb_test_multiple $test $test {
-re "You may have requested too many.*$gdb_prompt $" {
pass $test
}
-re "atchpoint .*: global.*$gdb_prompt $" {
pass $test
set can_do_cmd 1
}
}
if { !$can_do_cmd } {
unsupported "no target support"
return
}
delete_breakpoints
gdb_test "$watch_command global" ".*atchpoint .*: global.*"
# A condition that evals false.
gdb_test "condition \$bpnum cond_global==1" ".*"
gdb_test "b bar" "Breakpoint .* at .*"
gdb_test "continue" "Breakpoint .*, bar .*"
}
}
foreach break_command { "break" "hbreak" } {
test_break $break_command
}
foreach watch_command { "watch" "rwatch" "awatch" } {
test_watch $watch_command
}