binutils-gdb/gdb/mi/mi-cmd-break.c

516 lines
12 KiB
C
Raw Permalink Normal View History

/* MI Command Set - breakpoint and watchpoint commands.
Copyright (C) 2000-2020 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
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 "defs.h"
* breakpoint.h (struct breakpoint): New member GDBARCH. * breakpoint.c: Include "arch-utils.h". (set_raw_breakpoint_without_location): Add GDBARCH parameter. Use it to set breakpoint architecture. (set_raw_breakpoint): Add GDBARCH parameter. (create_internal_breakpoint): Likewise. (create_catchpoint): Likewise. (create_fork_vfork_event_catchpoint): Likewise. (create_breakpoint): Likewise. (create_breakpoints): Likewise. (break_command_really): Likewise. (create_ada_exception_breakpoint): Likewise. Update local callers to pass architecture: (create_internal_breakpoint): Update. (create_overlay_event_breakpoint): Update. (create_longjmp_master_breakpoint): Update. (create_thread_event_breakpoint): Update. (create_solib_event_breakpoint): Update. (create_catchpoint): Update. (create_fork_vfork_event_catchpoint): Update. (set_momentary_breakpoint): Update. (clone_momentary_breakpoint): Update. (create_breakpoint): Update. (create_breakpoints): Update. (break_command_really): Update. (break_command_1): Update. (set_breakpoint): Update. (watch_command_1): Update. (catch_fork_command_1): Update. (catch_exec_commnd_1): Update. (handle_gnu_v3_exceptions): Update. (create_ada_exception_breakpoint): Update. (catch_ada_exception_command): Update. (catch_assert_command): Update. (trace_command): Update. * breakpoint.h (struct bp_location): New member GDBARCH. * breakpoint.c (get_sal_arch): New function. (set_raw_breakpoint): Set location architecture. (add_location_to_breakpoint): Likewise. (clone_momentary_breakpoint): Likewise. (watch_command_1): Likewise. (update_watchpoint): Likewise. (bp_loc_is_permanent): Use location architecture instead of current_gdbarch. (adjust_breakpoint_address): Add GDBARCH parameter; use it instead of current_gdbarch. Update callers of adjust_breakpoint_address to pass breakpoint location architecture: (set_raw_breakpoint): Update. (watch_command_1): Update. * tracepoint.c: (collect_symbol): Add GDBARCH parameter, use instead of current_gdbarch. (add_local_symbols): Add GDBARCH parameter. Pass to collect_symbol. (encode_actions): Pass tracepoint architecture to add_local_symbols (encode_actions): Use tracepoint architecture instead of current_gdbarch. Pass it to add_local_symbols and collect_symbol. * breakpoint.h (struct breakpoint_ops): Replace last_addr parameter of print_one callback with last_loc. * breakpoint.c (print_one_breakpoint_location): Replace last_addr parameter with last_loc. (print_one_breakpoint): Likewise. (do_captured_breakpoint_query): Update call. (breakpoint_1): Pass last_loc instead of last_addr to print_one_breakpoint. Pass last location architecture instead of current_gdbarch to set_next_address. Update all implementations of the print_one callback: * breakpoint.c (print_one_catch_fork): Update. (print_one_catch_vfork): Update. (print_one_catch_exec): Update. (print_one_exception_catchpoint): Update. * ada-lang.c (print_one_exception): Update. (print_one_catch_exception): Update. (print_one_catch_exception_unhandled): Update. (print_one_catch_assert): Update. * breakpoint.c (print_one_breakpoint_location): Add PRINT_ADDRESS_BITS parameter. Use it instead of gdbarch_addr_bit (current_gdbarch). (print_one_breakpoint): Add PRINT_ADDRESS_BITS parameter and pass it to print_one_breakpoint_location. (breakpoint_address_bits): New function. (do_captured_breakpoint_query): Compute number of address bits to print and pass it to print_one_breakpoint. (breakpoint_1): Likewise. Use it instead of current_gdbarch. * breakpoint.h (create_thread_event_breakpoint): Add GDBARCH. * breakpoint.c (create_thread_event_breakpoint): Likewise. Update callers to create_thread_event_breakpoint: * aix-thread.c (pd_enable): Update. * linux-thread-db.c (enable_thread_event): Update. * breakpoint.h (create_solib_event_breakpoint): Add GDBARCH. * breakpoint.c (create_solib_event_breakpoint): Likewise. Update callers to create_solib_event_breakpoint: * solib-frv.c (enable_break, enable_break2): Update. * solib-pa64.c (pa64_solib_create_inferior_hook): Update. * solib-som.c (som_solib_create_inferior_hook): Update. * solib-darwin.c (darwin_solib_create_inferior_hook): Update. * solib-svr4.c (enable_break): Update. * breakpoint.h (insert_single_step_breakpoint): Add GDBARCH. * breakpoint.c (insert_single_step_breakpoint): Likewise. Update callers to insert_single_step_breakpoint: * alpha-tdep.c (alpha_software_single_step): Update. * arm-linux-tdep.c (arm_linux_software_single_step): Update. * arm-tdep.c (arm_software_single_step): Update. * cris-tdep.c (cris_software_single_step): Update. * rs6000-aix-tdep.c (rs6000_software_single_step): Update. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Update. * sparc-tdep.c (sparc_software_single_step): Update. * spu-tdep.c (spu_software_single_step): Update. * mips-tdep.c (deal_with_atomic_sequence): Add GDBARCH parameter. Pass it to insert_single_step_breakpoint. (mips_software_single_step): Pass architecture to deal_with_atomic_sequence and insert_single_step_breakpoint. * breakpoint.h (deprecated_insert_raw_breakpoint): Add GDBARCH. (deprecated_remove_raw_breakpoint): Likewise. * breakpoint.c (deprecated_insert_raw_breakpoint): Add GDBARCH. (deprecated_remove_raw_breakpoint): Likewise. Update callers to deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint: * breakpoint.c (single_step_gdbarch): New static variable. (insert_single_step_breakpoint): Pass GDBARCH parameter to deprecated_insert_raw_breakpoint. Store it in single_step_gdbarch. (remove_single_step_breakpoints): Pass architecture stored in single_step_gdbarch to deprecated_remove_raw_breakpoint. * rs6000-nat.c (exec_one_dummy_insn): Update. * solib-irix.c (enable_break, disable_break): Update. * procfs.c (procfs_mourn_inferior): Update. (remove_dbx_link_breakpoint): Update. * breakpoint.h (set_breakpoint): Add GDBARCH parameter. (set_momentary_breakpoint, set_momentary_breakpoint_at_pc): Likewise. * breakpoint.c (set_breakpoint): Add GDBARCH parameter. (set_momentary_breakpoint, set_momentary_breakpoint_at_pc): Likewise. Update callers to set_breakpoint, set_momentary_breakpoint and set_momentary_breakpoint_at_pc: * breakpoint.c (set_momentary_breakpoint_at_pc): Update. (until_break_command): Update. * infcall.c (call_function_by_hand): Update. * infcmd.c (finish_backward, finish_forward): Update. * infrun.c (insert_step_resume_breakpoint_at_sal): Add GDBARCH parameter. Pass it to set_momentary_breakpoint. (insert_longjmp_resume_breakpoint): Add GDBARCH parameter. Pass it to set_momentary_breakpoint_at_pc. (handle_inferior_event): Update. (insert_step_resume_breakpoint_at_frame): Update. (insert_step_resume_breakpoint_at_caller): Update.. * mi/mi-cmd-break.c: Include "arch-utils.h". (mi_cmd_break_insert): Update. * target.h (struct target_ops): Add GDBARCH parameter to to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, and to_remove_hw_breakpoint members. (target_insert_breakpoint, target_remove_breakpoint, target_insert_hw_breakpoint, target_remove_hw_breakpoint): Add GDBARCH parameter, pass to target routine. (memory_remove_breakpoint, memory_insert_breakpoint): Add GDBARCH parameter. * target.c (debug_to_insert_breakpoint, debug_to_remove_breakpoint, debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Add GDBARCH parameter, pass to target routine. (update_current_target): Update function signature. * breakpoint.c (insert_bp_location, remove_breakpoint, deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint): Pass architecture to target_ routines. Update all implementations of the target breakpoint routines to take GDBARCH parameter and use it instead of GDBARCH as appropriate: * corelow.c (ignore): Update. * exec.c (ignore): Update. * mem-break.c (memory_insert_breakpoint): Update. (memory_remove_breakpoint): Update. * monitor.c (monitor_insert_breakpoint): Update. (monitor_remove_breakpoint): Update. * record.c (record_insert_breakpoint): Update. (record_beneath_to_insert_breakpoint): Update. (record_remove_breakpoint): Update. (record_beneath_to_remove_breakpoint): Update. * remote.c (remote_insert_breakpoint): Update. (remote_remove_breakpoint): Update. (remote_insert_hw_breakpoint): Update. (remote_remove_hw_breakpoint): Update. * remote-m32r-sdi.c (m32r_insert_breakpoint): Update. (m32r_remove_breakpoint): Update. * remote-mips.c (mips_insert_breakpoint): Update. (mips_remove_breakpoint): Update. * i386-nat.c (i386_insert_hw_breakpoint): Update. (i386_remove_hw_breakpoint): Update. * nto-procfs.c (procfs_insert_breakpoint): Update. (procfs_remove_breakpoint): Update. (procfs_insert_hw_breakpoint): Update. (procfs_remove_hw_breakpoint): Update. doc/ChangeLog: * gdbint.texi (Examples of Use of @code{ui_out} functions): Update example code extrated from breakpoint.c.
2009-07-02 19:12:28 +02:00
#include "arch-utils.h"
#include "mi-cmds.h"
#include "ui-out.h"
#include "mi-out.h"
#include "breakpoint.h"
#include "mi-getopt.h"
Convert observers to C++ This converts observers from using a special source-generating script to be plain C++. This version of the patch takes advantage of C++11 by using std::function and variadic templates; incorporates Pedro's patches; and renames the header file to "observable.h" (this change eliminates the need for a clean rebuild). Note that Pedro's patches used a template lambda in tui-hooks.c, but this failed to compile on some buildbot instances (presumably due to differing C++ versions); I replaced this with an ordinary template function. Regression tested on the buildbot. gdb/ChangeLog 2018-03-19 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * unittests/observable-selftests.c: New file. * common/observable.h: New file. * observable.h: New file. * ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c, arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c, breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c, corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c, extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c, infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c, linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c, mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c, ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c, python/py-breakpoint.c, python/py-finishbreakpoint.c, python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c, record-btrace.c, record-full.c, record.c, regcache.c, remote.c, riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c, spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c, symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c, tui/tui-interp.c, valops.c: Update all users. * tui/tui-hooks.c (tui_bp_created_observer) (tui_bp_deleted_observer, tui_bp_modified_observer) (tui_inferior_exit_observer, tui_before_prompt_observer) (tui_normal_stop_observer, tui_register_changed_observer): Remove. (tui_observers_token): New global. (attach_or_detach, tui_attach_detach_observers): New functions. (tui_install_hooks, tui_remove_hooks): Use tui_attach_detach_observers. * record-btrace.c (record_btrace_thread_observer): Remove. (record_btrace_thread_observer_token): New global. * observer.sh: Remove. * observer.c: Rename to observable.c. * observable.c (namespace gdb_observers): Define new objects. (observer_debug): Move into gdb_observers namespace. (struct observer, struct observer_list, xalloc_observer_list_node) (xfree_observer_list_node, generic_observer_attach) (generic_observer_detach, generic_observer_notify): Remove. (_initialize_observer): Update. Don't include observer.inc. * Makefile.in (generated_files): Remove observer.h, observer.inc. (clean mostlyclean): Likewise. (observer.h, observer.inc): Remove targets. (SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c. (COMMON_SFILES): Use observable.c, not observer.c. * .gitignore: Remove observer.h. gdb/doc/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * observer.texi: Remove. gdb/testsuite/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * gdb.gdb/observer.exp: Remove.
2016-10-02 18:50:20 +02:00
#include "observable.h"
MI breakpoint notifications. * annotate.c (breakpoint_changed): Adjust parameter type. * breakpoint.c (set_breakpoint_condition): Adjust to change in breakpoint_modified type. (breakpoint_set_commands): Likewise. (do_map_commands_command): Likewise. (bpstat_check_breakpoint_conditions): Notify that breakpoint has changed after bumping hit count. (bpstat_stop_status): Likewise. (print_one_breakpoint_location): Don't wrap in tuple here. (print_one_breakpoint): Always print individual locations. For locations, use unnamed tuple. (disable_breakpoints_in_unloaded_shlib): Notify that breakpoint has changed. (create_catchpoint, create_syscall_event_catchpoint): Call breakpoint_created obsever. (mention): Don't call breakpoint_created observer. (create_breakpoint_sal): Call breakpoint_created observer. (create_breakpoint, watch_command_1): Likewise. (create_ada_exception_breakpoint): Likewise. (delete_breakpoint): Call breakpoint_deleted breakpoint. (locations_are_equal): New. (update_breakpoint_locations): If locations were changed, notify. (set_ignore_count, disable_breakpoint, do_enable_breakpoint): Call breakpoint_modified observer. * mi/mi-cmd-break.c (breakpoint_notify): Adjust. (mi_cmd_break_insert): Don't set observers for modify and delete. * mi/mi-interp.c (mi_suppress_breakpoint_notifications): New. (mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified): New. (mi_interpreter_init): Hook the above. * mi/mi-main.c (mi_cmd_execute): Disable breakpoint notifications while -break-* commands are executing. * mi/mi-main.h (mi_suppress_breakpoint_notifications): New. * mi/mi-out.c (struct ui_out_data): New field original_buffer. (mi_redirect): New. (mi_ui_out_impl): Hook in mi_redirect. (mi_field_skip): True to the name, skip the field, don't output a field with an empty value. * python/py-breakpoint.c (gdbpy_breakpoint_created) (gdbpy_breakpoint_deleted): Adjust. * tui/tui-hooks.c (tui_event_create_breakpoint) (tui_event_delete_breakpoint, tui_event_modify_breakpoint): Adjust.
2011-04-27 12:17:39 +02:00
#include "mi-main.h"
#include "mi-cmd-break.h"
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
#include "language.h"
#include "location.h"
#include "linespec.h"
#include "gdb_obstack.h"
#include <ctype.h>
#include "tracepoint.h"
enum
{
FROM_TTY = 0
};
gdb: * tui/tui-hooks.c: Include observer.h. (tui_event_default, tui_old_event_hooks, tui_event_hooks): Remove. (tui_bp_created_observer, tui_bp_deleted_observer, tui_bp_modified_observer): New globals. (tui_install_hooks): Use observers, not events. (tui_remove_hooks): Likewise. * mi/mi-cmd-break.c: Include observer.h, not gdb-events.h. (mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New globals. (breakpoint_notify): Check mi_can_breakpoint_notify. (breakpoint_hooks): Remove. (mi_cmd_break_insert): Attach observers. Don't use events. * tracepoint.c: Include observer.h, not gdb-events.h. (tracepoint_operation, trace_pass_command): Notify observer. * interps.c: Don't include gdb-events.h. (clear_interpreter_hooks): Don't call clear_gdb_event_hooks. * gdbarch.c: Rebuild. * gdbarch.sh: Emit include for observer.h, not gdb-events.h. (deprecated_current_gdbarch_select_hack): Notify observer. * breakpoint.h: Don't include gdb-events.h. * breakpoint.c: Don't include gdb-events.h. (condition_command): Notify observer. (commands_command): Likewise. (commands_from_control_command): Likewise. (mention, delete_breakpoint, set_ignore_count): Likewise. (disable_breakpoint, do_enable_breakpoint): Likewise. * Makefile.in (gdb_events_h): Remove. (breakpoint_h): Update. (COMMON_OBS): Remove gdb-events.o. (gdb-events.o): Remove. (breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o, gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update. * gdb-events.c: Remove. * gdb-events.h: Remove. * gdb-events.sh: Remove. gdb/doc: * observer.texi (GDB Observers): Document new observers: breakpoint_created, breakpoint_deleted, breakpoint_modified, tracepoint_created, tracepoint_deleted, tracepoint_modified, architecture_changed. gdb/gdbtk: * generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h. (gdbtk_add_hooks): Use observers, not events. (gdbtk_architecture_changed): Add argument, for observer. * generic/gdbtk-bp.c: Include observer.h. (gdb_set_bp): Notify observer. (gdb_set_bp_addr): Likewise.
2008-07-25 18:12:03 +02:00
/* True if MI breakpoint observers have been registered. */
static int mi_breakpoint_observers_installed;
/* Control whether breakpoint_notify may act. */
static int mi_can_breakpoint_notify;
/* Output a single breakpoint, when allowed. */
static void
MI breakpoint notifications. * annotate.c (breakpoint_changed): Adjust parameter type. * breakpoint.c (set_breakpoint_condition): Adjust to change in breakpoint_modified type. (breakpoint_set_commands): Likewise. (do_map_commands_command): Likewise. (bpstat_check_breakpoint_conditions): Notify that breakpoint has changed after bumping hit count. (bpstat_stop_status): Likewise. (print_one_breakpoint_location): Don't wrap in tuple here. (print_one_breakpoint): Always print individual locations. For locations, use unnamed tuple. (disable_breakpoints_in_unloaded_shlib): Notify that breakpoint has changed. (create_catchpoint, create_syscall_event_catchpoint): Call breakpoint_created obsever. (mention): Don't call breakpoint_created observer. (create_breakpoint_sal): Call breakpoint_created observer. (create_breakpoint, watch_command_1): Likewise. (create_ada_exception_breakpoint): Likewise. (delete_breakpoint): Call breakpoint_deleted breakpoint. (locations_are_equal): New. (update_breakpoint_locations): If locations were changed, notify. (set_ignore_count, disable_breakpoint, do_enable_breakpoint): Call breakpoint_modified observer. * mi/mi-cmd-break.c (breakpoint_notify): Adjust. (mi_cmd_break_insert): Don't set observers for modify and delete. * mi/mi-interp.c (mi_suppress_breakpoint_notifications): New. (mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified): New. (mi_interpreter_init): Hook the above. * mi/mi-main.c (mi_cmd_execute): Disable breakpoint notifications while -break-* commands are executing. * mi/mi-main.h (mi_suppress_breakpoint_notifications): New. * mi/mi-out.c (struct ui_out_data): New field original_buffer. (mi_redirect): New. (mi_ui_out_impl): Hook in mi_redirect. (mi_field_skip): True to the name, skip the field, don't output a field with an empty value. * python/py-breakpoint.c (gdbpy_breakpoint_created) (gdbpy_breakpoint_deleted): Adjust. * tui/tui-hooks.c (tui_event_create_breakpoint) (tui_event_delete_breakpoint, tui_event_modify_breakpoint): Adjust.
2011-04-27 12:17:39 +02:00
breakpoint_notify (struct breakpoint *b)
{
gdb: * tui/tui-hooks.c: Include observer.h. (tui_event_default, tui_old_event_hooks, tui_event_hooks): Remove. (tui_bp_created_observer, tui_bp_deleted_observer, tui_bp_modified_observer): New globals. (tui_install_hooks): Use observers, not events. (tui_remove_hooks): Likewise. * mi/mi-cmd-break.c: Include observer.h, not gdb-events.h. (mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New globals. (breakpoint_notify): Check mi_can_breakpoint_notify. (breakpoint_hooks): Remove. (mi_cmd_break_insert): Attach observers. Don't use events. * tracepoint.c: Include observer.h, not gdb-events.h. (tracepoint_operation, trace_pass_command): Notify observer. * interps.c: Don't include gdb-events.h. (clear_interpreter_hooks): Don't call clear_gdb_event_hooks. * gdbarch.c: Rebuild. * gdbarch.sh: Emit include for observer.h, not gdb-events.h. (deprecated_current_gdbarch_select_hack): Notify observer. * breakpoint.h: Don't include gdb-events.h. * breakpoint.c: Don't include gdb-events.h. (condition_command): Notify observer. (commands_command): Likewise. (commands_from_control_command): Likewise. (mention, delete_breakpoint, set_ignore_count): Likewise. (disable_breakpoint, do_enable_breakpoint): Likewise. * Makefile.in (gdb_events_h): Remove. (breakpoint_h): Update. (COMMON_OBS): Remove gdb-events.o. (gdb-events.o): Remove. (breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o, gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update. * gdb-events.c: Remove. * gdb-events.h: Remove. * gdb-events.sh: Remove. gdb/doc: * observer.texi (GDB Observers): Document new observers: breakpoint_created, breakpoint_deleted, breakpoint_modified, tracepoint_created, tracepoint_deleted, tracepoint_modified, architecture_changed. gdb/gdbtk: * generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h. (gdbtk_add_hooks): Use observers, not events. (gdbtk_architecture_changed): Add argument, for observer. * generic/gdbtk-bp.c: Include observer.h. (gdb_set_bp): Notify observer. (gdb_set_bp_addr): Likewise.
2008-07-25 18:12:03 +02:00
if (mi_can_breakpoint_notify)
Eliminate catch_exceptions/catch_exceptions_with_msg This patch gets rid of catch_exceptions / catch_exceptions_with_msg. The latter is done mostly by getting rid of the three remaining vestigial libgdb wrapper functions, which are really pointless nowadays. This results in a good number of simplifications. (I checked that Insight doesn't use those functions.) The gdb.mi/mi-pthreads.exp change is necessary because this actually fixes a bug, IMO -- the patch stops MI's -thread-select causing output on the CLI stream. I.e., before: -thread-select 123456789 &"Thread ID 123456789 not known.\n" ^error,msg="Thread ID 123456789 not known." (gdb) After: -thread-select 123456789 ^error,msg="Thread ID 123456789 not known." (gdb) gdb/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * breakpoint.c (struct captured_breakpoint_query_args) (do_captured_breakpoint_query, gdb_breakpoint_query): Delete. (print_breakpoint): New. * breakpoint.h (print_breakpoint): Declare. * common/common-exceptions.h (enum return_reason): Remove references to catch_exceptions. * exceptions.c (catch_exceptions, catch_exceptions_with_msg): Delete. * exceptions.h (catch_exceptions_ftype, catch_exceptions) (catch_exception_ftype, catch_exceptions_with_msg): Delete. * gdb.h: Delete. * gdbthread.h (thread_select): Declare. * mi/mi-cmd-break.c: Don't include gdb.h. (breakpoint_notify): Use print_breakpoint. * mi/mi-cmd-catch.c: Don't include gdb.h. * mi/mi-interp.c: Don't include gdb.h. (mi_print_breakpoint_for_event): New. (mi_breakpoint_created, mi_breakpoint_modified): Use mi_print_breakpoint_for_event. * mi/mi-main.c: Don't include gdb.h. (mi_cmd_thread_select): Parse the global thread ID here. Use thread_select instead of gdb_thread_select. (mi_cmd_thread_list_ids): Output "thread-ids" tuple here instead of using gdb_list_thread_ids. * remote-fileio.c (do_remote_fileio_request): Change type. Reply FILEIO_ENOSYS here. (remote_fileio_request): Use TRY/CATCH instead of catch_exceptions. * symfile-mem.c (struct symbol_file_add_from_memory_args) (symbol_file_add_from_memory_wrapper): Delete. (add_vsyscall_page): Use TRY/CATCH instead of catch_exceptions. * thread.c: Don't include gdb.h. (do_captured_list_thread_ids, gdb_list_thread_ids): Delete. (thread_alive): Use thread_select. (do_captured_thread_select): Delete, parts salvaged as ... (thread_select): ... this new function. (gdb_thread_select): Delete. gdb/testsuite/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> * gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Don't expect CLI output.
2017-10-10 17:45:51 +02:00
{
Rewrite TRY/CATCH This rewrites gdb's TRY/CATCH to plain C++ try/catch. The patch was largely written by script, though one change (to a comment in common-exceptions.h) was reverted by hand. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * xml-support.c: Use C++ exception handling. * x86-linux-nat.c: Use C++ exception handling. * windows-nat.c: Use C++ exception handling. * varobj.c: Use C++ exception handling. * value.c: Use C++ exception handling. * valprint.c: Use C++ exception handling. * valops.c: Use C++ exception handling. * unittests/parse-connection-spec-selftests.c: Use C++ exception handling. * unittests/cli-utils-selftests.c: Use C++ exception handling. * typeprint.c: Use C++ exception handling. * tui/tui.c: Use C++ exception handling. * tracefile-tfile.c: Use C++ exception handling. * top.c: Use C++ exception handling. * thread.c: Use C++ exception handling. * target.c: Use C++ exception handling. * symmisc.c: Use C++ exception handling. * symfile-mem.c: Use C++ exception handling. * stack.c: Use C++ exception handling. * sparc64-linux-tdep.c: Use C++ exception handling. * solib.c: Use C++ exception handling. * solib-svr4.c: Use C++ exception handling. * solib-spu.c: Use C++ exception handling. * solib-frv.c: Use C++ exception handling. * solib-dsbt.c: Use C++ exception handling. * selftest-arch.c: Use C++ exception handling. * s390-tdep.c: Use C++ exception handling. * rust-lang.c: Use C++ exception handling. * rust-exp.y: Use C++ exception handling. * rs6000-tdep.c: Use C++ exception handling. * rs6000-aix-tdep.c: Use C++ exception handling. * riscv-tdep.c: Use C++ exception handling. * remote.c: Use C++ exception handling. * remote-fileio.c: Use C++ exception handling. * record-full.c: Use C++ exception handling. * record-btrace.c: Use C++ exception handling. * python/python.c: Use C++ exception handling. * python/py-value.c: Use C++ exception handling. * python/py-utils.c: Use C++ exception handling. * python/py-unwind.c: Use C++ exception handling. * python/py-type.c: Use C++ exception handling. * python/py-symbol.c: Use C++ exception handling. * python/py-record.c: Use C++ exception handling. * python/py-record-btrace.c: Use C++ exception handling. * python/py-progspace.c: Use C++ exception handling. * python/py-prettyprint.c: Use C++ exception handling. * python/py-param.c: Use C++ exception handling. * python/py-objfile.c: Use C++ exception handling. * python/py-linetable.c: Use C++ exception handling. * python/py-lazy-string.c: Use C++ exception handling. * python/py-infthread.c: Use C++ exception handling. * python/py-inferior.c: Use C++ exception handling. * python/py-gdb-readline.c: Use C++ exception handling. * python/py-framefilter.c: Use C++ exception handling. * python/py-frame.c: Use C++ exception handling. * python/py-finishbreakpoint.c: Use C++ exception handling. * python/py-cmd.c: Use C++ exception handling. * python/py-breakpoint.c: Use C++ exception handling. * python/py-arch.c: Use C++ exception handling. * printcmd.c: Use C++ exception handling. * ppc-linux-tdep.c: Use C++ exception handling. * parse.c: Use C++ exception handling. * p-valprint.c: Use C++ exception handling. * objc-lang.c: Use C++ exception handling. * mi/mi-main.c: Use C++ exception handling. * mi/mi-interp.c: Use C++ exception handling. * mi/mi-cmd-stack.c: Use C++ exception handling. * mi/mi-cmd-break.c: Use C++ exception handling. * main.c: Use C++ exception handling. * linux-thread-db.c: Use C++ exception handling. * linux-tdep.c: Use C++ exception handling. * linux-nat.c: Use C++ exception handling. * linux-fork.c: Use C++ exception handling. * linespec.c: Use C++ exception handling. * language.c: Use C++ exception handling. * jit.c: Use C++ exception handling. * infrun.c: Use C++ exception handling. * infcmd.c: Use C++ exception handling. * infcall.c: Use C++ exception handling. * inf-loop.c: Use C++ exception handling. * i386-tdep.c: Use C++ exception handling. * i386-linux-tdep.c: Use C++ exception handling. * guile/scm-value.c: Use C++ exception handling. * guile/scm-type.c: Use C++ exception handling. * guile/scm-symtab.c: Use C++ exception handling. * guile/scm-symbol.c: Use C++ exception handling. * guile/scm-pretty-print.c: Use C++ exception handling. * guile/scm-ports.c: Use C++ exception handling. * guile/scm-param.c: Use C++ exception handling. * guile/scm-math.c: Use C++ exception handling. * guile/scm-lazy-string.c: Use C++ exception handling. * guile/scm-frame.c: Use C++ exception handling. * guile/scm-disasm.c: Use C++ exception handling. * guile/scm-cmd.c: Use C++ exception handling. * guile/scm-breakpoint.c: Use C++ exception handling. * guile/scm-block.c: Use C++ exception handling. * guile/guile-internal.h: Use C++ exception handling. * gnu-v3-abi.c: Use C++ exception handling. * gdbtypes.c: Use C++ exception handling. * frame.c: Use C++ exception handling. * frame-unwind.c: Use C++ exception handling. * fbsd-tdep.c: Use C++ exception handling. * f-valprint.c: Use C++ exception handling. * exec.c: Use C++ exception handling. * event-top.c: Use C++ exception handling. * event-loop.c: Use C++ exception handling. * eval.c: Use C++ exception handling. * dwarf2read.c: Use C++ exception handling. * dwarf2loc.c: Use C++ exception handling. * dwarf2-frame.c: Use C++ exception handling. * dwarf2-frame-tailcall.c: Use C++ exception handling. * dwarf-index-write.c: Use C++ exception handling. * dwarf-index-cache.c: Use C++ exception handling. * dtrace-probe.c: Use C++ exception handling. * disasm-selftests.c: Use C++ exception handling. * darwin-nat.c: Use C++ exception handling. * cp-valprint.c: Use C++ exception handling. * cp-support.c: Use C++ exception handling. * cp-abi.c: Use C++ exception handling. * corelow.c: Use C++ exception handling. * completer.c: Use C++ exception handling. * compile/compile-object-run.c: Use C++ exception handling. * compile/compile-object-load.c: Use C++ exception handling. * compile/compile-cplus-symbols.c: Use C++ exception handling. * compile/compile-c-symbols.c: Use C++ exception handling. * common/selftest.c: Use C++ exception handling. * common/new-op.c: Use C++ exception handling. * cli/cli-script.c: Use C++ exception handling. * cli/cli-interp.c: Use C++ exception handling. * cli/cli-cmds.c: Use C++ exception handling. * c-varobj.c: Use C++ exception handling. * btrace.c: Use C++ exception handling. * breakpoint.c: Use C++ exception handling. * break-catch-throw.c: Use C++ exception handling. * arch-utils.c: Use C++ exception handling. * amd64-tdep.c: Use C++ exception handling. * ada-valprint.c: Use C++ exception handling. * ada-typeprint.c: Use C++ exception handling. * ada-lang.c: Use C++ exception handling. * aarch64-tdep.c: Use C++ exception handling. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * server.c: Use C++ exception handling. * linux-low.c: Use C++ exception handling. * gdbreplay.c: Use C++ exception handling.
2019-04-04 00:02:42 +02:00
try
Eliminate catch_exceptions/catch_exceptions_with_msg This patch gets rid of catch_exceptions / catch_exceptions_with_msg. The latter is done mostly by getting rid of the three remaining vestigial libgdb wrapper functions, which are really pointless nowadays. This results in a good number of simplifications. (I checked that Insight doesn't use those functions.) The gdb.mi/mi-pthreads.exp change is necessary because this actually fixes a bug, IMO -- the patch stops MI's -thread-select causing output on the CLI stream. I.e., before: -thread-select 123456789 &"Thread ID 123456789 not known.\n" ^error,msg="Thread ID 123456789 not known." (gdb) After: -thread-select 123456789 ^error,msg="Thread ID 123456789 not known." (gdb) gdb/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * breakpoint.c (struct captured_breakpoint_query_args) (do_captured_breakpoint_query, gdb_breakpoint_query): Delete. (print_breakpoint): New. * breakpoint.h (print_breakpoint): Declare. * common/common-exceptions.h (enum return_reason): Remove references to catch_exceptions. * exceptions.c (catch_exceptions, catch_exceptions_with_msg): Delete. * exceptions.h (catch_exceptions_ftype, catch_exceptions) (catch_exception_ftype, catch_exceptions_with_msg): Delete. * gdb.h: Delete. * gdbthread.h (thread_select): Declare. * mi/mi-cmd-break.c: Don't include gdb.h. (breakpoint_notify): Use print_breakpoint. * mi/mi-cmd-catch.c: Don't include gdb.h. * mi/mi-interp.c: Don't include gdb.h. (mi_print_breakpoint_for_event): New. (mi_breakpoint_created, mi_breakpoint_modified): Use mi_print_breakpoint_for_event. * mi/mi-main.c: Don't include gdb.h. (mi_cmd_thread_select): Parse the global thread ID here. Use thread_select instead of gdb_thread_select. (mi_cmd_thread_list_ids): Output "thread-ids" tuple here instead of using gdb_list_thread_ids. * remote-fileio.c (do_remote_fileio_request): Change type. Reply FILEIO_ENOSYS here. (remote_fileio_request): Use TRY/CATCH instead of catch_exceptions. * symfile-mem.c (struct symbol_file_add_from_memory_args) (symbol_file_add_from_memory_wrapper): Delete. (add_vsyscall_page): Use TRY/CATCH instead of catch_exceptions. * thread.c: Don't include gdb.h. (do_captured_list_thread_ids, gdb_list_thread_ids): Delete. (thread_alive): Use thread_select. (do_captured_thread_select): Delete, parts salvaged as ... (thread_select): ... this new function. (gdb_thread_select): Delete. gdb/testsuite/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> * gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Don't expect CLI output.
2017-10-10 17:45:51 +02:00
{
print_breakpoint (b);
}
Rename gdb exception types This renames the gdb exception types. The old types were only needed due to the macros in common-exception.h that are now gone. The intermediate layer of gdb_exception_RETURN_MASK_ALL did not seem needed, so this patch removes it entirely. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * common/common-exceptions.h (gdb_exception_RETURN_MASK_ALL): Remove. (gdb_exception_error): Rename from gdb_exception_RETURN_MASK_ERROR. (gdb_exception_quit): Rename from gdb_exception_RETURN_MASK_QUIT. (gdb_quit_bad_alloc): Update. * aarch64-tdep.c: Update. * ada-lang.c: Update. * ada-typeprint.c: Update. * ada-valprint.c: Update. * amd64-tdep.c: Update. * arch-utils.c: Update. * break-catch-throw.c: Update. * breakpoint.c: Update. * btrace.c: Update. * c-varobj.c: Update. * cli/cli-cmds.c: Update. * cli/cli-interp.c: Update. * cli/cli-script.c: Update. * common/common-exceptions.c: Update. * common/new-op.c: Update. * common/selftest.c: Update. * compile/compile-c-symbols.c: Update. * compile/compile-cplus-symbols.c: Update. * compile/compile-object-load.c: Update. * compile/compile-object-run.c: Update. * completer.c: Update. * corelow.c: Update. * cp-abi.c: Update. * cp-support.c: Update. * cp-valprint.c: Update. * darwin-nat.c: Update. * disasm-selftests.c: Update. * dtrace-probe.c: Update. * dwarf-index-cache.c: Update. * dwarf-index-write.c: Update. * dwarf2-frame-tailcall.c: Update. * dwarf2-frame.c: Update. * dwarf2loc.c: Update. * dwarf2read.c: Update. * eval.c: Update. * event-loop.c: Update. * event-top.c: Update. * exec.c: Update. * f-valprint.c: Update. * fbsd-tdep.c: Update. * frame-unwind.c: Update. * frame.c: Update. * gdbtypes.c: Update. * gnu-v3-abi.c: Update. * guile/guile-internal.h: Update. * guile/scm-block.c: Update. * guile/scm-breakpoint.c: Update. * guile/scm-cmd.c: Update. * guile/scm-disasm.c: Update. * guile/scm-frame.c: Update. * guile/scm-lazy-string.c: Update. * guile/scm-math.c: Update. * guile/scm-param.c: Update. * guile/scm-ports.c: Update. * guile/scm-pretty-print.c: Update. * guile/scm-symbol.c: Update. * guile/scm-symtab.c: Update. * guile/scm-type.c: Update. * guile/scm-value.c: Update. * i386-linux-tdep.c: Update. * i386-tdep.c: Update. * inf-loop.c: Update. * infcall.c: Update. * infcmd.c: Update. * infrun.c: Update. * jit.c: Update. * language.c: Update. * linespec.c: Update. * linux-fork.c: Update. * linux-nat.c: Update. * linux-tdep.c: Update. * linux-thread-db.c: Update. * main.c: Update. * mi/mi-cmd-break.c: Update. * mi/mi-cmd-stack.c: Update. * mi/mi-interp.c: Update. * mi/mi-main.c: Update. * objc-lang.c: Update. * p-valprint.c: Update. * parse.c: Update. * ppc-linux-tdep.c: Update. * printcmd.c: Update. * python/py-arch.c: Update. * python/py-breakpoint.c: Update. * python/py-cmd.c: Update. * python/py-finishbreakpoint.c: Update. * python/py-frame.c: Update. * python/py-framefilter.c: Update. * python/py-gdb-readline.c: Update. * python/py-inferior.c: Update. * python/py-infthread.c: Update. * python/py-lazy-string.c: Update. * python/py-linetable.c: Update. * python/py-objfile.c: Update. * python/py-param.c: Update. * python/py-prettyprint.c: Update. * python/py-progspace.c: Update. * python/py-record-btrace.c: Update. * python/py-record.c: Update. * python/py-symbol.c: Update. * python/py-type.c: Update. * python/py-unwind.c: Update. * python/py-utils.c: Update. * python/py-value.c: Update. * python/python.c: Update. * record-btrace.c: Update. * record-full.c: Update. * remote-fileio.c: Update. * remote.c: Update. * riscv-tdep.c: Update. * rs6000-aix-tdep.c: Update. * rs6000-tdep.c: Update. * rust-exp.y: Update. * rust-lang.c: Update. * s390-tdep.c: Update. * selftest-arch.c: Update. * solib-dsbt.c: Update. * solib-frv.c: Update. * solib-spu.c: Update. * solib-svr4.c: Update. * solib.c: Update. * sparc64-linux-tdep.c: Update. * stack.c: Update. * symfile-mem.c: Update. * symmisc.c: Update. * target.c: Update. * thread.c: Update. * top.c: Update. * tracefile-tfile.c: Update. * tui/tui.c: Update. * typeprint.c: Update. * unittests/cli-utils-selftests.c: Update. * unittests/parse-connection-spec-selftests.c: Update. * valops.c: Update. * valprint.c: Update. * value.c: Update. * varobj.c: Update. * windows-nat.c: Update. * x86-linux-nat.c: Update. * xml-support.c: Update. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * gdbreplay.c: Update. * linux-low.c: Update. * server.c: Update.
2019-04-03 23:59:07 +02:00
catch (const gdb_exception &ex)
Eliminate catch_exceptions/catch_exceptions_with_msg This patch gets rid of catch_exceptions / catch_exceptions_with_msg. The latter is done mostly by getting rid of the three remaining vestigial libgdb wrapper functions, which are really pointless nowadays. This results in a good number of simplifications. (I checked that Insight doesn't use those functions.) The gdb.mi/mi-pthreads.exp change is necessary because this actually fixes a bug, IMO -- the patch stops MI's -thread-select causing output on the CLI stream. I.e., before: -thread-select 123456789 &"Thread ID 123456789 not known.\n" ^error,msg="Thread ID 123456789 not known." (gdb) After: -thread-select 123456789 ^error,msg="Thread ID 123456789 not known." (gdb) gdb/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * breakpoint.c (struct captured_breakpoint_query_args) (do_captured_breakpoint_query, gdb_breakpoint_query): Delete. (print_breakpoint): New. * breakpoint.h (print_breakpoint): Declare. * common/common-exceptions.h (enum return_reason): Remove references to catch_exceptions. * exceptions.c (catch_exceptions, catch_exceptions_with_msg): Delete. * exceptions.h (catch_exceptions_ftype, catch_exceptions) (catch_exception_ftype, catch_exceptions_with_msg): Delete. * gdb.h: Delete. * gdbthread.h (thread_select): Declare. * mi/mi-cmd-break.c: Don't include gdb.h. (breakpoint_notify): Use print_breakpoint. * mi/mi-cmd-catch.c: Don't include gdb.h. * mi/mi-interp.c: Don't include gdb.h. (mi_print_breakpoint_for_event): New. (mi_breakpoint_created, mi_breakpoint_modified): Use mi_print_breakpoint_for_event. * mi/mi-main.c: Don't include gdb.h. (mi_cmd_thread_select): Parse the global thread ID here. Use thread_select instead of gdb_thread_select. (mi_cmd_thread_list_ids): Output "thread-ids" tuple here instead of using gdb_list_thread_ids. * remote-fileio.c (do_remote_fileio_request): Change type. Reply FILEIO_ENOSYS here. (remote_fileio_request): Use TRY/CATCH instead of catch_exceptions. * symfile-mem.c (struct symbol_file_add_from_memory_args) (symbol_file_add_from_memory_wrapper): Delete. (add_vsyscall_page): Use TRY/CATCH instead of catch_exceptions. * thread.c: Don't include gdb.h. (do_captured_list_thread_ids, gdb_list_thread_ids): Delete. (thread_alive): Use thread_select. (do_captured_thread_select): Delete, parts salvaged as ... (thread_select): ... this new function. (gdb_thread_select): Delete. gdb/testsuite/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> * gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Don't expect CLI output.
2017-10-10 17:45:51 +02:00
{
exception_print (gdb_stderr, ex);
}
}
}
enum bp_type
{
REG_BP,
HW_BP,
REGEXP_BP
};
/* Arrange for all new breakpoints and catchpoints to be reported to
CURRENT_UIOUT until the destructor of the returned scoped_restore
is run.
Note that MI output will be probably invalid if more than one
breakpoint is created inside one MI command. */
scoped_restore_tmpl<int>
setup_breakpoint_reporting (void)
{
if (! mi_breakpoint_observers_installed)
{
Convert observers to C++ This converts observers from using a special source-generating script to be plain C++. This version of the patch takes advantage of C++11 by using std::function and variadic templates; incorporates Pedro's patches; and renames the header file to "observable.h" (this change eliminates the need for a clean rebuild). Note that Pedro's patches used a template lambda in tui-hooks.c, but this failed to compile on some buildbot instances (presumably due to differing C++ versions); I replaced this with an ordinary template function. Regression tested on the buildbot. gdb/ChangeLog 2018-03-19 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * unittests/observable-selftests.c: New file. * common/observable.h: New file. * observable.h: New file. * ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c, arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c, breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c, corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c, extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c, infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c, linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c, mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c, ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c, python/py-breakpoint.c, python/py-finishbreakpoint.c, python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c, record-btrace.c, record-full.c, record.c, regcache.c, remote.c, riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c, spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c, symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c, tui/tui-interp.c, valops.c: Update all users. * tui/tui-hooks.c (tui_bp_created_observer) (tui_bp_deleted_observer, tui_bp_modified_observer) (tui_inferior_exit_observer, tui_before_prompt_observer) (tui_normal_stop_observer, tui_register_changed_observer): Remove. (tui_observers_token): New global. (attach_or_detach, tui_attach_detach_observers): New functions. (tui_install_hooks, tui_remove_hooks): Use tui_attach_detach_observers. * record-btrace.c (record_btrace_thread_observer): Remove. (record_btrace_thread_observer_token): New global. * observer.sh: Remove. * observer.c: Rename to observable.c. * observable.c (namespace gdb_observers): Define new objects. (observer_debug): Move into gdb_observers namespace. (struct observer, struct observer_list, xalloc_observer_list_node) (xfree_observer_list_node, generic_observer_attach) (generic_observer_detach, generic_observer_notify): Remove. (_initialize_observer): Update. Don't include observer.inc. * Makefile.in (generated_files): Remove observer.h, observer.inc. (clean mostlyclean): Likewise. (observer.h, observer.inc): Remove targets. (SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c. (COMMON_SFILES): Use observable.c, not observer.c. * .gitignore: Remove observer.h. gdb/doc/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * observer.texi: Remove. gdb/testsuite/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * gdb.gdb/observer.exp: Remove.
2016-10-02 18:50:20 +02:00
gdb::observers::breakpoint_created.attach (breakpoint_notify);
mi_breakpoint_observers_installed = 1;
}
return make_scoped_restore (&mi_can_breakpoint_notify, 1);
}
/* Convert arguments in ARGV to the string in "format",argv,argv...
and return it. */
static std::string
mi_argv_to_format (char **argv, int argc)
{
int i;
std::string result;
/* Convert ARGV[OIND + 1] to format string and save to FORMAT. */
result += '\"';
for (i = 0; i < strlen (argv[0]); i++)
{
switch (argv[0][i])
{
case '\\':
result += "\\\\";
break;
case '\a':
result += "\\a";
break;
case '\b':
result += "\\b";
break;
case '\f':
result += "\\f";
break;
case '\n':
result += "\\n";
break;
case '\r':
result += "\\r";
break;
case '\t':
result += "\\t";
break;
case '\v':
result += "\\v";
break;
case '"':
result += "\\\"";
break;
default:
if (isprint (argv[0][i]))
result += argv[0][i];
else
{
char tmp[5];
xsnprintf (tmp, sizeof (tmp), "\\%o",
(unsigned char) argv[0][i]);
result += tmp;
}
break;
}
}
result += '\"';
/* Apply other argv to FORMAT. */
for (i = 1; i < argc; i++)
{
result += ',';
result += argv[i];
}
return result;
}
/* Insert breakpoint.
If dprintf is true, it will insert dprintf.
If not, it will insert other type breakpoint. */
static void
-Wwrite-strings: Constify mi_cmd_argv_ftype's 'command' parameter -Wwrite-strings flags this attempt to pass a literal to a "char *": mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); Fix that by constifying mi_cmd_argv_ftype's 'command' parameter and adjusting all MI commands. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * mi/mi-cmd-break.c (mi_cmd_break_insert_1, mi_cmd_break_insert) (mi_cmd_dprintf_insert, mi_cmd_break_passcount) (mi_cmd_break_watch, mi_cmd_break_commands): Constify 'command' parameter. * mi/mi-cmd-catch.c (mi_cmd_catch_assert, mi_cmd_catch_exception) (mi_cmd_catch_load, mi_cmd_catch_unload): Constify cmd' parameter. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Constify 'command' parameter. * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_cd, mi_cmd_env_path) (mi_cmd_env_dir, mi_cmd_inferior_tty_set, _cmd_inferior_tty_show) * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files) (mi_cmd_file_list_shared_libraries): Constify 'command' parameter. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) (mi_cmd_info_gdb_mi_command, mi_cmd_info_os): Constify 'command' parameter. * mi/mi-cmd-stack.c (mi_cmd_enable_frame_filters) (mi_cmd_stack_list_frames, mi_cmd_stack_info_depth) (mi_cmd_stack_list_locals, mi_cmd_stack_list_args) (mi_cmd_stack_list_variables, mi_cmd_stack_select_frame) (mi_cmd_stack_info_frame): Constify 'command' parameter. * mi/mi-cmd-target.c (mi_cmd_target_file_get) (mi_cmd_target_file_put, mi_cmd_target_file_delete): Constify 'command' parameter. * mi/mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete) (mi_cmd_var_set_format, mi_cmd_var_set_visualizer) (mi_cmd_var_set_frozen, mi_cmd_var_show_format) (mi_cmd_var_info_num_children, mi_cmd_var_list_children) (mi_cmd_var_info_type, mi_cmd_var_info_path_expression) (mi_cmd_var_info_expression, mi_cmd_var_show_attributes) (mi_cmd_var_evaluate_expression, mi_cmd_var_assign) (mi_cmd_var_update, mi_cmd_enable_pretty_printing) (mi_cmd_var_set_update_range): Constify 'command' parameter. * mi/mi-cmds.h (mi_cmd_argv_ftype): Constify 'command' parameter. * mi/mi-interp.c (mi_cmd_interpreter_exec): Constify 'command' parameter. * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_next) (mi_cmd_exec_next_instruction, mi_cmd_exec_step) (mi_cmd_exec_step_instruction, mi_cmd_exec_finish) (mi_cmd_exec_return ,mi_cmd_exec_jump, mi_cmd_exec_continue) (mi_cmd_exec_interrupt, mi_cmd_exec_run, mi_cmd_target_detach) (mi_cmd_target_flash_erase, mi_cmd_thread_select) (mi_cmd_thread_list_ids, mi_cmd_thread_info) (mi_cmd_list_thread_groups, mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers) (mi_cmd_data_write_register_values) (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) (mi_cmd_data_read_memory_bytes, mi_cmd_data_write_memory) (mi_cmd_data_write_memory_bytes, mi_cmd_enable_timings) (mi_cmd_list_features, mi_cmd_list_target_features) (mi_cmd_add_inferior, mi_cmd_remove_inferior) (mi_cmd_trace_define_variable, mi_cmd_trace_list_variables) (mi_cmd_trace_find, mi_cmd_trace_save, mi_cmd_trace_start) (mi_cmd_trace_status, mi_cmd_trace_stop, mi_cmd_ada_task_info) (mi_cmd_trace_frame_collected): Constify 'command' parameter. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Constify 'command' parameter.
2017-04-05 20:21:34 +02:00
mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
{
Constify some linespec functions This changes a few linespec functions to work on "const char *" and then fixes up all the callers. This allows further constification elsewhere. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * tracepoint.c (info_scope_command): Constify. * python/python.c (gdbpy_decode_line): Constify. * python/py-breakpoint.c (bppy_init): Constify. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Constify. * location.h: (new_linespec_location) (string_to_event_location_basic, string_to_event_location): Constify. * location.c (new_linespec_location) (string_to_event_location_basic, string_to_event_location): Constify. * linespec.h (decode_line_with_current_source) (decode_line_with_last_displayed, linespec_lex_to_end): Constify. * linespec.c (linespec_lex_to_end) (decode_line_with_current_source) (decode_line_with_last_displayed): Constify. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Constify. * cli/cli-cmds.c (edit_command, list_command): Constify. * breakpoint.h (until_break_command, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (init_ada_exception_breakpoint): Constify. * breakpoint.c (break_command_1, dprintf_command) (break_range_command, watch_command_wrapper) (rwatch_command_wrapper, awatch_command_wrapper) (until_break_command, init_ada_exception_breakpoint) (strace_marker_create_sals_from_location, trace_command) (ftrace_command, strace_command, struct tracepoint): Constify. * ax-gdb.c (agent_command_1): Constify. * ada-lang.c (ada_exception_sal): Constify.
2017-09-13 02:32:41 +02:00
const char *address = NULL;
int hardware = 0;
int temp_p = 0;
int thread = -1;
int ignore_count = 0;
char *condition = NULL;
int pending = 0;
int enabled = 1;
int tracepoint = 0;
Static tracepoints support, and UST integration. gdb/gdbserver/ * configure.ac: Handle --with-ust. substitute ustlibs and ustinc. * mem-break.c (uninsert_all_breakpoints) (reinsert_all_breakpoints): New. * mem-break.h (reinsert_all_breakpoints, uninsert_all_breakpoints): * tracepoint.c (ust_loaded, helper_thread_id, cmd_buf): New. (gdb_agent_ust_loaded, helper_thread_id) (gdb_agent_helper_thread_id): New macros. (struct ipa_sym_addresses): Add addr_ust_loaded, addr_helper_thread_id, addr_cmd_buf. (symbol_list): Add ust_loaded, helper_thread_id, cmd_buf. (in_process_agent_loaded_ust): New. (write_e_ust_not_loaded): New. (maybe_write_ipa_ust_not_loaded): New. (struct collect_static_trace_data_action): New. (enum tracepoint_type) <static_tracepoint>: New. (struct tracepoint) <handle>: Mention static tracepoints. (struct static_tracepoint_ctx): New. (CMD_BUF_SIZE): New. (add_tracepoint_action): Handle static tracepoint actions. (unprobe_marker_at): New. (clear_installed_tracepoints): Handle static tracepoints. (cmd_qtdp): Handle static tracepoints. (probe_marker_at): New. (cmd_qtstart): Handle static tracepoints. (response_tracepoint): Handle static tracepoints. (cmd_qtfstm, cmd_qtsstm, cmd_qtstmat): New. (handle_tracepoint_query): Handle qTfSTM, qTsSTM and qTSTMat. (get_context_regcache): Handle static tracepoints. (do_action_at_tracepoint): Handle static tracepoint actions. (traceframe_find_block_type): Handle static trace data blocks. (traceframe_read_sdata): New. (download_tracepoints): Download static tracepoint actions. [HAVE_UST] Include ust/ust.h, dlfcn.h, sys/socket.h, and sys/un.h. (GDB_PROBE_NAME): New. (ust_ops): New. (GET_UST_SYM): New. (USTF): New. (dlsym_ust): New. (ust_marker_to_static_tracepoint): New. (gdb_probe): New. (collect_ust_data_at_tracepoint): New. (gdb_ust_probe): New. (UNIX_PATH_MAX, SOCK_DIR): New. (gdb_ust_connect_sync_socket): New. (resume_thread, stop_thread): New. (run_inferior_command): New. (init_named_socket): New. (gdb_ust_socket_init): New. (cstr_to_hexstr): New. (next_st): New. (first_marker, next_marker): New. (response_ust_marker): New. (cmd_qtfstm, cmd_qtsstm): New. (unprobe_marker_at, probe_marker_at): New. (cmd_qtstmat, gdb_ust_thread): New. (gdb_ust_init): New. (initialize_tracepoint_ftlib): Call gdb_ust_init. * linux-amd64-ipa.c [HAVE_UST]: Include ust/processor.h (ST_REGENTRY): New. (x86_64_st_collect_regmap): New. (X86_64_NUM_ST_COLLECT_GREGS): New. (AMD64_RIP_REGNUM): New. (supply_static_tracepoint_registers): New. * linux-i386-ipa.c [HAVE_UST]: Include ust/processor.h (ST_REGENTRY): New. (i386_st_collect_regmap): New. (i386_NUM_ST_COLLECT_GREGS): New. (supply_static_tracepoint_registers): New. * server.c (handle_query): Handle qXfer:statictrace:read. <qSupported>: Report support for StaticTracepoints, and qXfer:statictrace:read features. * server.h (traceframe_read_sdata) (supply_static_tracepoint_registers): Declare. * remote-utils.c (convert_int_to_ascii, hexchars, ishex, tohex) (unpack_varlen_hex): Include in IPA build. * Makefile.in (ustlibs, ustinc): New. (IPA_OBJS): Add remote-utils-ipa.o. ($(IPA_LIB)): Link -ldl and -lpthread. (UST_CFLAGS): New. (IPAGENT_CFLAGS): Add UST_CFLAGS. * config.in, configure: Regenerate. gdb/ * NEWS: Mention new support for static tracepoints. (New packets): Mention qTfSTM, qTsSTM, qTSTMat and qXfer:statictrace:read. (New features in the GDB remote stub, GDBserver): Mention static tracepoints support using an UST based backend. (New commands): Mention "info static-tracepoint-markers" and "strace". * breakpoint.c (is_marker_spec): New. (is_tracepoint): Handle static tracepoints. (validate_commands_for_breakpoint): Static tracepoints can't do while-stepping. (static_tracepoints_here): New. (bpstat_what): Handle static tracepoints. (print_one_breakpoint_location, allocate_bp_location, mention): Ditto. (create_breakpoint_sal): Ditto. (decode_static_tracepoint_spec): New. (create_breakpoint): Replace `hardwareflag', and `traceflag' with `type_wanted'. Adjust. Handle static tracepoint marker locations. (break_command_1): Adjust. (update_static_tracepoint): New. (update_breakpoint_locations): Handle static tracepoints. (breakpoint_re_set_one): Handle static tracepoint marker locations. (disable_command, enable_command): Handle static tracepoints. (trace_command, ftrace_command): Adjust. (strace_command): New. (create_tracepoint_from_upload): Adjust. (save_breakpoints): Handle static tracepoints. (_initialize_breakpoint): Install the "strace" command. * breakpoint.h (enum bptype): New bp_static_tracepoint type. (struct breakpoint): New fields static_trace_marker_id and static_trace_marker_id_idx. (breakpoints_here_p): Declare. (create_breakpoint): Adjust. (static_tracepoints_here): Declare. * remote.c (struct remote_state) <static_tracepoints>: New field. (PACKET_qXfer_statictrace_read, PACKET_StaticTracepoints): New. (remote_static_tracepoint_marker_at): New. (remote_static_tracepoint_markers_by_strid): New. (remote_static_tracepoint_feature): New. (remote_disconnected_tracing_feature): Handle "StaticTracepoints". (remote_xfer_partial): Handle TARGET_OBJECT_STATIC_TRACE_DATA. (remote_supports_static_tracepoints): New. (remote_download_tracepoint): Download static tracepoints. (init_remote_ops): Install remote_static_tracepoint_marker_at and remote_static_tracepoint_markers_by_strid. (_initialize_remote): Install set|show remote static-tracepoints, and set|show remote read-sdata-object commands. * target.c (update_current_target): Inherit and default to_static_tracepoint_marker_at, and to_static_tracepoint_markers_by_strid. * target.h (static_tracepoint_marker): Forward declare. (enum target_object): New object TARGET_OBJECT_STATIC_TRACE_DATA. (static_tracepoint_marker_p): New typedef. (DEF_VEC_P(static_tracepoint_marker_p)): New VEC type. (struct target_ops): New fields to_static_tracepoint_marker_at and to_static_tracepoint_markers_by_strid. (target_static_tracepoint_marker_at) (target_static_tracepoint_markers_by_strid): New. * tracepoint.c: Include source.h. (validate_actionline): Handle $_sdata. (struct collection_list): New field strace_data. (add_static_trace_data): New. (clear_collection_list): Clear strace_data. (stringify_collection_list): Account for a possible static trace data collection. (encode_actions_1): Encode an $_sdata collection. (parse_tracepoint_definition): Handle static tracepoints. (parse_static_tracepoint_marker_definition): New. (release_static_tracepoint_marker): New. (print_one_static_tracepoint_marker): New. (info_static_tracepoint_markers_command): New. (sdata_make_value): New. (_initialize_tracepoint): Create the $_sdata convenience variable. Add the "info static-tracepoint-markers" command. Mention $_sdata in the "collect" command's help output. * tracepoint.h (struct static_tracepoint_marker): New. (parse_static_tracepoint_marker_definition) (release_static_tracepoint_marker): Declare. * mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust. * python/py-breakpoint.c (bppy_new): Adjust. doc/ * gdb.texinfo (Convenience Variables): Document $_sdata. (Commands to Set Tracepoints): Describe static tracepoints. Add `Listing Static Tracepoint Markers' menu entry. Document "strace". (Tracepoint Action Lists): Document collecting $_sdata. (Listing Static Tracepoint Markers): New subsection. (Tracepoints support in gdbserver): Mention static tracepoints. (remote packets, enabling and disabling): Mention read-sdata-object. (General Query Packets) <qSupported>: Document qXfer:sdata:read and StaticTracepoint. Mention qTfSTM, qTsSTM and qTSTMat as tracepoint packets. Document qXfer:sdata:read. (Tracepoint packets): Document qTfSTM, qTsSTM and qTSTMat.
2010-07-01 12:36:12 +02:00
enum bptype type_wanted;
Introduce event_location_up This removes make_cleanup_delete_event_location and instead changes the various location functions to return an event_location_up, a new unique_ptr typedef. This is largely straightforward, but be sure to examine the init_breakpoint_sal change. I believe the code I deleted there is dead, because "location != NULL" can never be true in that branch; but you should double-check. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (scope_info): Update. * spu-tdep.c (spu_catch_start): Update. * python/python.c (gdbpy_decode_line): Update. * python/py-finishbreakpoint.c (bpfinishpy_init): Update. * python/py-breakpoint.c (bppy_init): Update. * probe.c (parse_probes): Update. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Update. * location.h (event_location_deleter): New struct. (event_location_up): New typedef. (new_linespec_location, new_address_location, new_probe_location) (new_explicit_location, copy_event_location) (string_to_event_location, string_to_event_location_basic) (string_to_explicit_location): Update return type. (make_cleanup_delete_event_location): Remove. * location.c (new_linespec_location, new_address_location) (new_probe_location, new_explicit_location, copy_event_location): Return event_location_up. (delete_event_location_cleanup) (make_cleanup_delete_event_location): Remove. (string_to_explicit_location, string_to_event_location_basic) (string_to_event_location): Return event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * completer.c (location_completer): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint) (create_thread_event_breakpoint): Update. (init_breakpoint_sal): Update. Remove some dead code. (create_breakpoint_sal): Change type of "location". Update. (create_breakpoints_sal, create_breakpoint, break_command_1) (dprintf_command, break_range_command, until_break_command) (init_ada_exception_breakpoint) (strace_marker_create_sals_from_location) (update_static_tracepoint, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Update. * break-catch-throw.c (re_set_exception_catchpoint): Update. * ax-gdb.c (agent_command_1): Update.
2017-04-06 04:44:01 +02:00
event_location_up location;
struct breakpoint_ops *ops;
int is_explicit = 0;
Mass rename `explicit' -> `explicit_loc'. BuildBot reminded me that "explicit" is a reserved keyword in C++. This patch simply renames all the (illegal) uses of "explicit". This should fix the build errors with --enable-build-with-cxx bots. gdb/ChangeLog * break-catch-throw.c (re_set_exception_catchpoint) Rename reserved C++ keyword "explicit" to "explicit_loc". * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_static_tracepoint): Rename reserved C++ keyword "explicit" to "explicit_loc". * completer.c (collect_explicit_location_matches) (explicit_location_completer): Rename reserved C++ keyword "explicit" to "explicit_loc". * linespec.c (struct linespec) <explicit>: Rename to "explicit_loc". (canonicalize_linespec, create_sals_line_offset) (convert_linespec_to_sals, convert_explicit_location_to_sals) (event_location_to_sals, decode_objc): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.c (struct event_location) <explicit>: Rename to "explicit_loc". (initialize_explicit_location, new_explicit_location) (explicit_location_to_string_internal, explicit_location_to_linespec): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.h (explicit_location_to_string) (explicit_location_to_linespec, initialize_explicit_location) (new_explicit_location): Rename reserved C++ keyword "explicit" to "explicit_loc". * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++ keyword "explicit" to "explicit_loc".
2015-08-13 18:48:12 +02:00
struct explicit_location explicit_loc;
std::string extra_string;
enum opt
{
HARDWARE_OPT, TEMP_OPT, CONDITION_OPT,
IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT,
TRACEPOINT_OPT,
EXPLICIT_SOURCE_OPT, EXPLICIT_FUNC_OPT,
EXPLICIT_LABEL_OPT, EXPLICIT_LINE_OPT
};
static const struct mi_opt opts[] =
{
{"h", HARDWARE_OPT, 0},
{"t", TEMP_OPT, 0},
{"c", CONDITION_OPT, 1},
{"i", IGNORE_COUNT_OPT, 1},
{"p", THREAD_OPT, 1},
{"f", PENDING_OPT, 0},
{"d", DISABLE_OPT, 0},
{"a", TRACEPOINT_OPT, 0},
{"-source" , EXPLICIT_SOURCE_OPT, 1},
{"-function", EXPLICIT_FUNC_OPT, 1},
{"-label", EXPLICIT_LABEL_OPT, 1},
{"-line", EXPLICIT_LINE_OPT, 1},
Warning fixes. * ada-lang.c (find_struct_field): Initialize *byte_offset_p. * breakpoint.c (do_enable_breakpoint): Ignore both mem_cnt and i. * c-typeprint.c (c_type_print_varspec_suffix): Don't test length greater than or equal to zero. * m2-typeprint.c (m2_array): Likewise. * p-typeprint.c (pascal_type_print_varspec_prefix): Likewise. * gdbtypes.c (copy_type_recursive): Correct == typo. * i386-tdep.c (i386_skip_prologue): Remove stray semicolon. * linux-nat.c (linux_nat_info_proc_cmd): Don't compare a pointer greater than zero. * macroscope.c (sal_macro_scope): Don't name a local variable "main". (default_macro_scope): Remove unused variable. * prologue-value.h (pv_area_find_reg): Don't name an argument "register". * remote-fileio.c (remote_fio_func_map): Add missing braces. * remote.c (sigint_remote_twice_token, sigint_remote_token): Change type. (cleanup_sigint_signal_handler): Remove casts. * valprint.c (val_print): Use a volatile local for the modified argument. * varobj.c (languages): Remove extra array dimension. (varobj_create): Correct access to languages array. * mi/mi-cmd-break.c (mi_cmd_break_insert, mi_cmd_break_watch): Add missing braces. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_path, mi_cmd_env_dir): Likewise. * mi/mi-getopt.c (mi_valid_noargs): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_write_memory): Likewise. * signals/signals.c (target_signal_to_string): Cast to int before comparing. * tui/tui-layout.c (init_and_make_win): Take and return a void *. Update all callers.
2007-01-03 20:01:25 +01:00
{ 0, 0, 0 }
};
/* Parse arguments. It could be -r or -h or -t, <location> or ``--''
to denote the end of the option list. */
int oind = 0;
char *oarg;
Mass rename `explicit' -> `explicit_loc'. BuildBot reminded me that "explicit" is a reserved keyword in C++. This patch simply renames all the (illegal) uses of "explicit". This should fix the build errors with --enable-build-with-cxx bots. gdb/ChangeLog * break-catch-throw.c (re_set_exception_catchpoint) Rename reserved C++ keyword "explicit" to "explicit_loc". * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_static_tracepoint): Rename reserved C++ keyword "explicit" to "explicit_loc". * completer.c (collect_explicit_location_matches) (explicit_location_completer): Rename reserved C++ keyword "explicit" to "explicit_loc". * linespec.c (struct linespec) <explicit>: Rename to "explicit_loc". (canonicalize_linespec, create_sals_line_offset) (convert_linespec_to_sals, convert_explicit_location_to_sals) (event_location_to_sals, decode_objc): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.c (struct event_location) <explicit>: Rename to "explicit_loc". (initialize_explicit_location, new_explicit_location) (explicit_location_to_string_internal, explicit_location_to_linespec): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.h (explicit_location_to_string) (explicit_location_to_linespec, initialize_explicit_location) (new_explicit_location): Rename reserved C++ keyword "explicit" to "explicit_loc". * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++ keyword "explicit" to "explicit_loc".
2015-08-13 18:48:12 +02:00
initialize_explicit_location (&explicit_loc);
while (1)
{
gdb * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Fix error messages. * mi/mi-main.c (mi_cmd_thread_select): Fix error messages. (mi_cmd_thread_list_ids): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_list_register_values): Likewise. (mi_cmd_data_write_register_values): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory): Likewise. (mi_cmd_enable_timings): Likewise. * mi/mi-interp.c (mi_cmd_interpreter_exec): Fix error messages. * mi/mi-cmd-var.c (mi_cmd_var_create): Fix error messages. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_assign): Likewise. (mi_cmd_var_update): Likewise. (mi_cmd_enable_pretty_printing): Likewise. (mi_cmd_var_set_update_range): Likewise. * mi/mi-cmd-target.c (mi_cmd_target_file_get): Fix error messages. (mi_cmd_target_file_put): Likewise. (mi_cmd_target_file_delete): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Fix error messages. (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_locals): Likewise. (mi_cmd_stack_list_args): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_info_frame): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Fix error messages. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Fix error messages. (mi_cmd_env_cd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Fix error messages. * mi/mi-cmd-break.c (mi_cmd_break_insert): Fix error messages. (mi_cmd_break_watch): Likewise. gdb/testsuite * gdb.mi/gdb2549.exp: Update for error message changes. * gdb.mi/mi-cli.exp: Likewise. * gdb.mi/mi-disassemble.exp: Likewise. * gdb.mi/mi-pthreads.exp: Likewise. * gdb.mi/mi-regs.exp: Likewise. * gdb.mi/mi-stack.exp: Likewise. * gdb.mi/mi-var-block.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-disassemble.exp: Likewise. * gdb.mi/mi2-pthreads.exp: Likewise. * gdb.mi/mi2-regs.exp: Likewise. * gdb.mi/mi2-stack.exp: Likewise. * gdb.mi/mi2-var-block.exp: Likewise. * gdb.mi/mi2-var-cmd.exp: Likewise.
2011-01-12 22:09:39 +01:00
int opt = mi_getopt ("-break-insert", argc, argv,
opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
{
case TEMP_OPT:
temp_p = 1;
break;
case HARDWARE_OPT:
hardware = 1;
break;
case CONDITION_OPT:
condition = oarg;
break;
case IGNORE_COUNT_OPT:
ignore_count = atol (oarg);
break;
case THREAD_OPT:
thread = atol (oarg);
break;
case PENDING_OPT:
pending = 1;
break;
case DISABLE_OPT:
enabled = 0;
break;
case TRACEPOINT_OPT:
tracepoint = 1;
break;
case EXPLICIT_SOURCE_OPT:
is_explicit = 1;
Mass rename `explicit' -> `explicit_loc'. BuildBot reminded me that "explicit" is a reserved keyword in C++. This patch simply renames all the (illegal) uses of "explicit". This should fix the build errors with --enable-build-with-cxx bots. gdb/ChangeLog * break-catch-throw.c (re_set_exception_catchpoint) Rename reserved C++ keyword "explicit" to "explicit_loc". * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_static_tracepoint): Rename reserved C++ keyword "explicit" to "explicit_loc". * completer.c (collect_explicit_location_matches) (explicit_location_completer): Rename reserved C++ keyword "explicit" to "explicit_loc". * linespec.c (struct linespec) <explicit>: Rename to "explicit_loc". (canonicalize_linespec, create_sals_line_offset) (convert_linespec_to_sals, convert_explicit_location_to_sals) (event_location_to_sals, decode_objc): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.c (struct event_location) <explicit>: Rename to "explicit_loc". (initialize_explicit_location, new_explicit_location) (explicit_location_to_string_internal, explicit_location_to_linespec): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.h (explicit_location_to_string) (explicit_location_to_linespec, initialize_explicit_location) (new_explicit_location): Rename reserved C++ keyword "explicit" to "explicit_loc". * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++ keyword "explicit" to "explicit_loc".
2015-08-13 18:48:12 +02:00
explicit_loc.source_filename = oarg;
break;
case EXPLICIT_FUNC_OPT:
is_explicit = 1;
Mass rename `explicit' -> `explicit_loc'. BuildBot reminded me that "explicit" is a reserved keyword in C++. This patch simply renames all the (illegal) uses of "explicit". This should fix the build errors with --enable-build-with-cxx bots. gdb/ChangeLog * break-catch-throw.c (re_set_exception_catchpoint) Rename reserved C++ keyword "explicit" to "explicit_loc". * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_static_tracepoint): Rename reserved C++ keyword "explicit" to "explicit_loc". * completer.c (collect_explicit_location_matches) (explicit_location_completer): Rename reserved C++ keyword "explicit" to "explicit_loc". * linespec.c (struct linespec) <explicit>: Rename to "explicit_loc". (canonicalize_linespec, create_sals_line_offset) (convert_linespec_to_sals, convert_explicit_location_to_sals) (event_location_to_sals, decode_objc): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.c (struct event_location) <explicit>: Rename to "explicit_loc". (initialize_explicit_location, new_explicit_location) (explicit_location_to_string_internal, explicit_location_to_linespec): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.h (explicit_location_to_string) (explicit_location_to_linespec, initialize_explicit_location) (new_explicit_location): Rename reserved C++ keyword "explicit" to "explicit_loc". * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++ keyword "explicit" to "explicit_loc".
2015-08-13 18:48:12 +02:00
explicit_loc.function_name = oarg;
break;
case EXPLICIT_LABEL_OPT:
is_explicit = 1;
Mass rename `explicit' -> `explicit_loc'. BuildBot reminded me that "explicit" is a reserved keyword in C++. This patch simply renames all the (illegal) uses of "explicit". This should fix the build errors with --enable-build-with-cxx bots. gdb/ChangeLog * break-catch-throw.c (re_set_exception_catchpoint) Rename reserved C++ keyword "explicit" to "explicit_loc". * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_static_tracepoint): Rename reserved C++ keyword "explicit" to "explicit_loc". * completer.c (collect_explicit_location_matches) (explicit_location_completer): Rename reserved C++ keyword "explicit" to "explicit_loc". * linespec.c (struct linespec) <explicit>: Rename to "explicit_loc". (canonicalize_linespec, create_sals_line_offset) (convert_linespec_to_sals, convert_explicit_location_to_sals) (event_location_to_sals, decode_objc): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.c (struct event_location) <explicit>: Rename to "explicit_loc". (initialize_explicit_location, new_explicit_location) (explicit_location_to_string_internal, explicit_location_to_linespec): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.h (explicit_location_to_string) (explicit_location_to_linespec, initialize_explicit_location) (new_explicit_location): Rename reserved C++ keyword "explicit" to "explicit_loc". * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++ keyword "explicit" to "explicit_loc".
2015-08-13 18:48:12 +02:00
explicit_loc.label_name = oarg;
break;
case EXPLICIT_LINE_OPT:
is_explicit = 1;
Mass rename `explicit' -> `explicit_loc'. BuildBot reminded me that "explicit" is a reserved keyword in C++. This patch simply renames all the (illegal) uses of "explicit". This should fix the build errors with --enable-build-with-cxx bots. gdb/ChangeLog * break-catch-throw.c (re_set_exception_catchpoint) Rename reserved C++ keyword "explicit" to "explicit_loc". * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_static_tracepoint): Rename reserved C++ keyword "explicit" to "explicit_loc". * completer.c (collect_explicit_location_matches) (explicit_location_completer): Rename reserved C++ keyword "explicit" to "explicit_loc". * linespec.c (struct linespec) <explicit>: Rename to "explicit_loc". (canonicalize_linespec, create_sals_line_offset) (convert_linespec_to_sals, convert_explicit_location_to_sals) (event_location_to_sals, decode_objc): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.c (struct event_location) <explicit>: Rename to "explicit_loc". (initialize_explicit_location, new_explicit_location) (explicit_location_to_string_internal, explicit_location_to_linespec): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.h (explicit_location_to_string) (explicit_location_to_linespec, initialize_explicit_location) (new_explicit_location): Rename reserved C++ keyword "explicit" to "explicit_loc". * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++ keyword "explicit" to "explicit_loc".
2015-08-13 18:48:12 +02:00
explicit_loc.line_offset = linespec_parse_line_offset (oarg);
break;
}
}
if (oind >= argc && !is_explicit)
error (_("-%s-insert: Missing <location>"),
dprintf ? "dprintf" : "break");
if (dprintf)
{
int format_num = is_explicit ? oind : oind + 1;
if (hardware || tracepoint)
error (_("-dprintf-insert: does not support -h or -a"));
if (format_num >= argc)
error (_("-dprintf-insert: Missing <format>"));
extra_string = mi_argv_to_format (argv + format_num, argc - format_num);
address = argv[oind];
}
else
{
if (is_explicit)
{
if (oind < argc)
error (_("-break-insert: Garbage following explicit location"));
}
else
{
if (oind < argc - 1)
error (_("-break-insert: Garbage following <location>"));
address = argv[oind];
}
}
/* Now we have what we need, let's insert the breakpoint! */
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
if (tracepoint)
{
/* Note that to request a fast tracepoint, the client uses the
"hardware" flag, although there's nothing of hardware related to
fast tracepoints -- one can implement slow tracepoints with
hardware breakpoints, but fast tracepoints are always software.
"fast" is a misnomer, actually, "jump" would be more appropriate.
A simulator or an emulator could conceivably implement fast
regular non-jump based tracepoints. */
type_wanted = hardware ? bp_fast_tracepoint : bp_tracepoint;
ops = &tracepoint_breakpoint_ops;
}
else if (dprintf)
{
type_wanted = bp_dprintf;
ops = &dprintf_breakpoint_ops;
}
else
{
type_wanted = hardware ? bp_hardware_breakpoint : bp_breakpoint;
ops = &bkpt_breakpoint_ops;
}
Static tracepoints support, and UST integration. gdb/gdbserver/ * configure.ac: Handle --with-ust. substitute ustlibs and ustinc. * mem-break.c (uninsert_all_breakpoints) (reinsert_all_breakpoints): New. * mem-break.h (reinsert_all_breakpoints, uninsert_all_breakpoints): * tracepoint.c (ust_loaded, helper_thread_id, cmd_buf): New. (gdb_agent_ust_loaded, helper_thread_id) (gdb_agent_helper_thread_id): New macros. (struct ipa_sym_addresses): Add addr_ust_loaded, addr_helper_thread_id, addr_cmd_buf. (symbol_list): Add ust_loaded, helper_thread_id, cmd_buf. (in_process_agent_loaded_ust): New. (write_e_ust_not_loaded): New. (maybe_write_ipa_ust_not_loaded): New. (struct collect_static_trace_data_action): New. (enum tracepoint_type) <static_tracepoint>: New. (struct tracepoint) <handle>: Mention static tracepoints. (struct static_tracepoint_ctx): New. (CMD_BUF_SIZE): New. (add_tracepoint_action): Handle static tracepoint actions. (unprobe_marker_at): New. (clear_installed_tracepoints): Handle static tracepoints. (cmd_qtdp): Handle static tracepoints. (probe_marker_at): New. (cmd_qtstart): Handle static tracepoints. (response_tracepoint): Handle static tracepoints. (cmd_qtfstm, cmd_qtsstm, cmd_qtstmat): New. (handle_tracepoint_query): Handle qTfSTM, qTsSTM and qTSTMat. (get_context_regcache): Handle static tracepoints. (do_action_at_tracepoint): Handle static tracepoint actions. (traceframe_find_block_type): Handle static trace data blocks. (traceframe_read_sdata): New. (download_tracepoints): Download static tracepoint actions. [HAVE_UST] Include ust/ust.h, dlfcn.h, sys/socket.h, and sys/un.h. (GDB_PROBE_NAME): New. (ust_ops): New. (GET_UST_SYM): New. (USTF): New. (dlsym_ust): New. (ust_marker_to_static_tracepoint): New. (gdb_probe): New. (collect_ust_data_at_tracepoint): New. (gdb_ust_probe): New. (UNIX_PATH_MAX, SOCK_DIR): New. (gdb_ust_connect_sync_socket): New. (resume_thread, stop_thread): New. (run_inferior_command): New. (init_named_socket): New. (gdb_ust_socket_init): New. (cstr_to_hexstr): New. (next_st): New. (first_marker, next_marker): New. (response_ust_marker): New. (cmd_qtfstm, cmd_qtsstm): New. (unprobe_marker_at, probe_marker_at): New. (cmd_qtstmat, gdb_ust_thread): New. (gdb_ust_init): New. (initialize_tracepoint_ftlib): Call gdb_ust_init. * linux-amd64-ipa.c [HAVE_UST]: Include ust/processor.h (ST_REGENTRY): New. (x86_64_st_collect_regmap): New. (X86_64_NUM_ST_COLLECT_GREGS): New. (AMD64_RIP_REGNUM): New. (supply_static_tracepoint_registers): New. * linux-i386-ipa.c [HAVE_UST]: Include ust/processor.h (ST_REGENTRY): New. (i386_st_collect_regmap): New. (i386_NUM_ST_COLLECT_GREGS): New. (supply_static_tracepoint_registers): New. * server.c (handle_query): Handle qXfer:statictrace:read. <qSupported>: Report support for StaticTracepoints, and qXfer:statictrace:read features. * server.h (traceframe_read_sdata) (supply_static_tracepoint_registers): Declare. * remote-utils.c (convert_int_to_ascii, hexchars, ishex, tohex) (unpack_varlen_hex): Include in IPA build. * Makefile.in (ustlibs, ustinc): New. (IPA_OBJS): Add remote-utils-ipa.o. ($(IPA_LIB)): Link -ldl and -lpthread. (UST_CFLAGS): New. (IPAGENT_CFLAGS): Add UST_CFLAGS. * config.in, configure: Regenerate. gdb/ * NEWS: Mention new support for static tracepoints. (New packets): Mention qTfSTM, qTsSTM, qTSTMat and qXfer:statictrace:read. (New features in the GDB remote stub, GDBserver): Mention static tracepoints support using an UST based backend. (New commands): Mention "info static-tracepoint-markers" and "strace". * breakpoint.c (is_marker_spec): New. (is_tracepoint): Handle static tracepoints. (validate_commands_for_breakpoint): Static tracepoints can't do while-stepping. (static_tracepoints_here): New. (bpstat_what): Handle static tracepoints. (print_one_breakpoint_location, allocate_bp_location, mention): Ditto. (create_breakpoint_sal): Ditto. (decode_static_tracepoint_spec): New. (create_breakpoint): Replace `hardwareflag', and `traceflag' with `type_wanted'. Adjust. Handle static tracepoint marker locations. (break_command_1): Adjust. (update_static_tracepoint): New. (update_breakpoint_locations): Handle static tracepoints. (breakpoint_re_set_one): Handle static tracepoint marker locations. (disable_command, enable_command): Handle static tracepoints. (trace_command, ftrace_command): Adjust. (strace_command): New. (create_tracepoint_from_upload): Adjust. (save_breakpoints): Handle static tracepoints. (_initialize_breakpoint): Install the "strace" command. * breakpoint.h (enum bptype): New bp_static_tracepoint type. (struct breakpoint): New fields static_trace_marker_id and static_trace_marker_id_idx. (breakpoints_here_p): Declare. (create_breakpoint): Adjust. (static_tracepoints_here): Declare. * remote.c (struct remote_state) <static_tracepoints>: New field. (PACKET_qXfer_statictrace_read, PACKET_StaticTracepoints): New. (remote_static_tracepoint_marker_at): New. (remote_static_tracepoint_markers_by_strid): New. (remote_static_tracepoint_feature): New. (remote_disconnected_tracing_feature): Handle "StaticTracepoints". (remote_xfer_partial): Handle TARGET_OBJECT_STATIC_TRACE_DATA. (remote_supports_static_tracepoints): New. (remote_download_tracepoint): Download static tracepoints. (init_remote_ops): Install remote_static_tracepoint_marker_at and remote_static_tracepoint_markers_by_strid. (_initialize_remote): Install set|show remote static-tracepoints, and set|show remote read-sdata-object commands. * target.c (update_current_target): Inherit and default to_static_tracepoint_marker_at, and to_static_tracepoint_markers_by_strid. * target.h (static_tracepoint_marker): Forward declare. (enum target_object): New object TARGET_OBJECT_STATIC_TRACE_DATA. (static_tracepoint_marker_p): New typedef. (DEF_VEC_P(static_tracepoint_marker_p)): New VEC type. (struct target_ops): New fields to_static_tracepoint_marker_at and to_static_tracepoint_markers_by_strid. (target_static_tracepoint_marker_at) (target_static_tracepoint_markers_by_strid): New. * tracepoint.c: Include source.h. (validate_actionline): Handle $_sdata. (struct collection_list): New field strace_data. (add_static_trace_data): New. (clear_collection_list): Clear strace_data. (stringify_collection_list): Account for a possible static trace data collection. (encode_actions_1): Encode an $_sdata collection. (parse_tracepoint_definition): Handle static tracepoints. (parse_static_tracepoint_marker_definition): New. (release_static_tracepoint_marker): New. (print_one_static_tracepoint_marker): New. (info_static_tracepoint_markers_command): New. (sdata_make_value): New. (_initialize_tracepoint): Create the $_sdata convenience variable. Add the "info static-tracepoint-markers" command. Mention $_sdata in the "collect" command's help output. * tracepoint.h (struct static_tracepoint_marker): New. (parse_static_tracepoint_marker_definition) (release_static_tracepoint_marker): Declare. * mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust. * python/py-breakpoint.c (bppy_new): Adjust. doc/ * gdb.texinfo (Convenience Variables): Document $_sdata. (Commands to Set Tracepoints): Describe static tracepoints. Add `Listing Static Tracepoint Markers' menu entry. Document "strace". (Tracepoint Action Lists): Document collecting $_sdata. (Listing Static Tracepoint Markers): New subsection. (Tracepoints support in gdbserver): Mention static tracepoints. (remote packets, enabling and disabling): Mention read-sdata-object. (General Query Packets) <qSupported>: Document qXfer:sdata:read and StaticTracepoint. Mention qTfSTM, qTsSTM and qTSTMat as tracepoint packets. Document qXfer:sdata:read. (Tracepoint packets): Document qTfSTM, qTsSTM and qTSTMat.
2010-07-01 12:36:12 +02:00
if (is_explicit)
{
/* Error check -- we must have one of the other
parameters specified. */
Mass rename `explicit' -> `explicit_loc'. BuildBot reminded me that "explicit" is a reserved keyword in C++. This patch simply renames all the (illegal) uses of "explicit". This should fix the build errors with --enable-build-with-cxx bots. gdb/ChangeLog * break-catch-throw.c (re_set_exception_catchpoint) Rename reserved C++ keyword "explicit" to "explicit_loc". * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_static_tracepoint): Rename reserved C++ keyword "explicit" to "explicit_loc". * completer.c (collect_explicit_location_matches) (explicit_location_completer): Rename reserved C++ keyword "explicit" to "explicit_loc". * linespec.c (struct linespec) <explicit>: Rename to "explicit_loc". (canonicalize_linespec, create_sals_line_offset) (convert_linespec_to_sals, convert_explicit_location_to_sals) (event_location_to_sals, decode_objc): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.c (struct event_location) <explicit>: Rename to "explicit_loc". (initialize_explicit_location, new_explicit_location) (explicit_location_to_string_internal, explicit_location_to_linespec): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.h (explicit_location_to_string) (explicit_location_to_linespec, initialize_explicit_location) (new_explicit_location): Rename reserved C++ keyword "explicit" to "explicit_loc". * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++ keyword "explicit" to "explicit_loc".
2015-08-13 18:48:12 +02:00
if (explicit_loc.source_filename != NULL
&& explicit_loc.function_name == NULL
&& explicit_loc.label_name == NULL
&& explicit_loc.line_offset.sign == LINE_OFFSET_UNKNOWN)
error (_("-%s-insert: --source option requires --function, --label,"
" or --line"), dprintf ? "dprintf" : "break");
Mass rename `explicit' -> `explicit_loc'. BuildBot reminded me that "explicit" is a reserved keyword in C++. This patch simply renames all the (illegal) uses of "explicit". This should fix the build errors with --enable-build-with-cxx bots. gdb/ChangeLog * break-catch-throw.c (re_set_exception_catchpoint) Rename reserved C++ keyword "explicit" to "explicit_loc". * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_static_tracepoint): Rename reserved C++ keyword "explicit" to "explicit_loc". * completer.c (collect_explicit_location_matches) (explicit_location_completer): Rename reserved C++ keyword "explicit" to "explicit_loc". * linespec.c (struct linespec) <explicit>: Rename to "explicit_loc". (canonicalize_linespec, create_sals_line_offset) (convert_linespec_to_sals, convert_explicit_location_to_sals) (event_location_to_sals, decode_objc): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.c (struct event_location) <explicit>: Rename to "explicit_loc". (initialize_explicit_location, new_explicit_location) (explicit_location_to_string_internal, explicit_location_to_linespec): Rename reserved C++ keyword "explicit" to "explicit_loc". * location.h (explicit_location_to_string) (explicit_location_to_linespec, initialize_explicit_location) (new_explicit_location): Rename reserved C++ keyword "explicit" to "explicit_loc". * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++ keyword "explicit" to "explicit_loc".
2015-08-13 18:48:12 +02:00
location = new_explicit_location (&explicit_loc);
}
else
{
Make "break foo" find "A::foo", A::B::foo", etc. [C++ and wild matching] This patch teaches GDB about setting breakpoints in all scopes (namespaces and classes) by default. Here's a contrived example: (gdb) b func<tab> (anonymous namespace)::A::function() Bn::(anonymous namespace)::B::function() function(int, int) (anonymous namespace)::B::function() Bn::(anonymous namespace)::function() gdb::(anonymous namespace)::A::function() (anonymous namespace)::B::function() const Bn::(anonymous namespace)::function(int, int) gdb::(anonymous namespace)::function() (anonymous namespace)::function() Bn::B::func() gdb::(anonymous namespace)::function(int, int) (anonymous namespace)::function(int, int) Bn::B::function() gdb::A::func() A::func() Bn::func() gdb::A::function() A::function() Bn::function() gdb::func() B::func() Bn::function(int, int) gdb::function() B::function() Bn::function(long) gdb::function(int, int) B::function() const func() gdb::function(long) B::function_const() const function() (gdb) b function Breakpoint 1 at 0x4005ce: function. (26 locations) (gdb) b B::function<tab> (anonymous namespace)::B::function() B::function() const Bn::B::function() (anonymous namespace)::B::function() const B::function_const() const B::function() Bn::(anonymous namespace)::B::function() (gdb) b B::function Breakpoint 1 at 0x40072c: B::function. (6 locations) To get back the original behavior of interpreting the function name as a fully-qualified name, you can use the new "-qualified" (or "-q") option/flag (added by this commit). For example: (gdb) b B::function (anonymous namespace)::B::function() B::function() const Bn::B::function() (anonymous namespace)::B::function() const B::function_const() const B::function() Bn::(anonymous namespace)::B::function() vs: (gdb) b -qualified B::function B::function() B::function() const B::function_const() const I've chosen "-qualified" / "-q" because "-f" (for "full" or "fully-qualified") is already taken for "-function". Note: the "-qualified" option works with both linespecs and explicit locations. I.e., these are equivalent: (gdb) b -q func (gdb) b -q -f func and so are these: (gdb) b -q filename.cc:func (gdb) b -q -s filename.cc -f func (gdb) b -s filename.cc -q -f func (gdb) b -s filename.cc -f func -q To better understand why I consider wild matching the better default, consider what happens when we get to the point when _all_ of GDB is wrapped under "namespace gdb {}". I have a patch series that does that, and when I started debugging that GDB, I immediately became frustrated. You'd have to write "b gdb::internal_error", "b gdb::foo", "b gdb::bar", etc. etc., which gets annoying pretty quickly. OTOH, consider how this makes it very easy to set breakpoints in classes wrapped in anonymous namespaces. You just don't think of them, GDB finds the symbols for you automatically. (At the Cauldron a couple months ago, several people told me that they run into a similar issue when debugging other C++ projects. One example was when debugging LLVM, which puts all its code under the "llvm" namespace.) Implementation-wise, what the patch does is: - makes C++ symbol name hashing only consider the last component of a symbol name. (so that we can look up symbol names by last-component name only). - adds a C++ symbol name matcher for symbol_name_match_type::WILD, which ignores missing leading specifiers / components. - adjusts a few preexisting testsuite tests to use "-qualified" when they mean it. - adds new testsuite tests. - adds unit tests. Grows the gdb.linespec/ tests like this: -# of expected passes 7823 +# of expected passes 8977 gdb/ChangeLog: 2017-11-29 Pedro Alves <palves@redhat.com> * NEWS: Mention that breakpoints on C++ functions are now set on on all namespaces/classes by default, and mention "break -qualified". * ax-gdb.c (agent_command_1): Adjust to pass a symbol_name_match_type to new_linespec_location. * breakpoint.c (parse_breakpoint_sals): Adjust to get_linespec_location's return type change. (strace_marker_create_sals_from_location): Adjust to pass a symbol_name_match_type to new_linespec_location. (strace_marker_decode_location): Adjust to get_linespec_location's return type change. (strace_command): Adjust to pass a symbol_name_match_type to new_linespec_location. (LOCATION_HELP_STRING): Add paragraph about wildmatching, and mention "-qualified". * c-lang.c (cplus_language_defn): Install cp_search_name_hash. * completer.c (explicit_location_match_type::MATCH_QUALIFIED): New enumerator. (complete_address_and_linespec_locations): New parameter 'match_type'. Pass it down. (explicit_options): Add "-qualified". (collect_explicit_location_matches): Pass the requested match type to the linespec completers. Handle MATCH_QUALIFIED. (location_completer): Handle "-qualified" combined with linespecs. * cp-support.c (cp_search_name_hash): New. (cp_symbol_name_matches_1): Implement wild matching for C++. (cp_fq_symbol_name_matches): Reimplement. (cp_get_symbol_name_matcher): Return different matchers depending on the lookup name's match type. (selftests::test_cp_symbol_name_matches): Add wild matching tests. * cp-support.h (cp_search_name_hash): New declaration. * dwarf2read.c (selftests::dw2_expand_symtabs_matching::test_symbols): Add symbols. (test_dw2_expand_symtabs_matching_symbol): Add wild matching tests. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Adjust to pass a symbol_name_match_type to new_linespec_location. * linespec.c (linespec_parse_basic): Lookup function symbols using the parser's symbol name match type. (convert_explicit_location_to_linespec): New symbol_name_match_type parameter. Pass it down to find_linespec_symbols. (convert_explicit_location_to_sals): Pass the location's name match type to convert_explicit_location_to_linespec. (parse_linespec): New match_type parameter. Save it in the parser. (linespec_parser_new): Default to symbol_name_match_type::WILD. (linespec_complete_function): New symbol_name_match_type parameter. Use it. (complete_linespec_component): Pass down the parser's recorded name match type. (linespec_complete_label): New symbol_name_match_type parameter. Use it. (linespec_complete): New symbol_name_match_type parameter. Save it in the parser and pass it down. Adjust to get_linespec_location's prototype change. (find_function_symbols, find_linespec_symbols): New symbol_name_match_type parameter. Pass it down instead of assuming symbol_name_match_type::WILD. * linespec.h (linespec_complete, linespec_complete_function) (linespec_complete_label): New symbol_name_match_type parameter. * location.c (event_location::linespec_location): Now a struct linespec_location. (EL_LINESPEC): Adjust. (initialize_explicit_location): Default to symbol_name_match_type::WILD. (new_linespec_location): New symbol_name_match_type parameter. Record it in the location. (get_linespec_location): Now returns a struct linespec_location. (new_explicit_location): Also copy func_name_match_type. (explicit_to_string_internal) (string_to_explicit_location): Handle "-qualified". (copy_event_location): Adjust to LINESPEC_LOCATION type change. Copy symbol_name_match_type fields. (event_location_deleter::operator()): Adjust to LINESPEC_LOCATION type change. (event_location_to_string): Adjust to LINESPEC_LOCATION type change. Handle "-qualfied". (string_to_explicit_location): Handle "-qualified". (string_to_event_location_basic): New symbol_name_match_type parameter. Pass it down. (string_to_event_location): Handle "-qualified". * location.h (struct linespec_location): New. (explicit_location::func_name_match_type): New field. (new_linespec_location): Now returns a const linespec_location *. (string_to_event_location_basic): New symbol_name_match_type parameter. (explicit_completion_info::saw_explicit_location_option): New field. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Adjust to pass a symbol_name_match_type to new_linespec_location. * python/py-breakpoint.c (bppy_init): Likewise. * python/python.c (gdbpy_decode_line): Likewise. gdb/testsuite/ChangeLog: 2017-11-29 Pedro Alves <palves@redhat.com> * gdb.base/langs.exp: Use -qualified. * gdb.cp/meth-typedefs.exp: Use -qualified, and add tests without it. * gdb.cp/namespace.exp: Use -qualified. * gdb.linespec/cpcompletion.exp (overload-2, fqn, fqn-2) (overload-3, template-overload, template-ret-type, const-overload) (const-overload-quoted, anon-ns, ambiguous-prefix): New procedures. (test_driver): Call them. * gdb.cp/save-bp-qualified.cc: New. * gdb.cp/save-bp-qualified.exp: New. * gdb.linespec/explicit.exp: Test -qualified. * lib/completion-support.exp (completion::explicit_opts_list): Add "-qualified". * lib/gdb.exp (gdb_breakpoint): Handle "qualified". gdb/doc/ChangeLog: 2017-11-29 Pedro Alves <palves@redhat.com> * gdb.texinfo (Linespec Locations): Document how "function" is interpreted in C++ and Ada. Document "-qualified". (Explicit Locations): Document how "-function" is interpreted in C++ and Ada. Document "-qualified".
2017-11-29 20:33:23 +01:00
location = string_to_event_location_basic (&address, current_language,
symbol_name_match_type::WILD);
if (*address)
Introduce event_location_up This removes make_cleanup_delete_event_location and instead changes the various location functions to return an event_location_up, a new unique_ptr typedef. This is largely straightforward, but be sure to examine the init_breakpoint_sal change. I believe the code I deleted there is dead, because "location != NULL" can never be true in that branch; but you should double-check. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (scope_info): Update. * spu-tdep.c (spu_catch_start): Update. * python/python.c (gdbpy_decode_line): Update. * python/py-finishbreakpoint.c (bpfinishpy_init): Update. * python/py-breakpoint.c (bppy_init): Update. * probe.c (parse_probes): Update. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Update. * location.h (event_location_deleter): New struct. (event_location_up): New typedef. (new_linespec_location, new_address_location, new_probe_location) (new_explicit_location, copy_event_location) (string_to_event_location, string_to_event_location_basic) (string_to_explicit_location): Update return type. (make_cleanup_delete_event_location): Remove. * location.c (new_linespec_location, new_address_location) (new_probe_location, new_explicit_location, copy_event_location): Return event_location_up. (delete_event_location_cleanup) (make_cleanup_delete_event_location): Remove. (string_to_explicit_location, string_to_event_location_basic) (string_to_event_location): Return event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * completer.c (location_completer): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint) (create_thread_event_breakpoint): Update. (init_breakpoint_sal): Update. Remove some dead code. (create_breakpoint_sal): Change type of "location". Update. (create_breakpoints_sal, create_breakpoint, break_command_1) (dprintf_command, break_range_command, until_break_command) (init_ada_exception_breakpoint) (strace_marker_create_sals_from_location) (update_static_tracepoint, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Update. * break-catch-throw.c (re_set_exception_catchpoint): Update. * ax-gdb.c (agent_command_1): Update.
2017-04-06 04:44:01 +02:00
error (_("Garbage '%s' at end of location"), address);
}
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
Introduce event_location_up This removes make_cleanup_delete_event_location and instead changes the various location functions to return an event_location_up, a new unique_ptr typedef. This is largely straightforward, but be sure to examine the init_breakpoint_sal change. I believe the code I deleted there is dead, because "location != NULL" can never be true in that branch; but you should double-check. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (scope_info): Update. * spu-tdep.c (spu_catch_start): Update. * python/python.c (gdbpy_decode_line): Update. * python/py-finishbreakpoint.c (bpfinishpy_init): Update. * python/py-breakpoint.c (bppy_init): Update. * probe.c (parse_probes): Update. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Update. * location.h (event_location_deleter): New struct. (event_location_up): New typedef. (new_linespec_location, new_address_location, new_probe_location) (new_explicit_location, copy_event_location) (string_to_event_location, string_to_event_location_basic) (string_to_explicit_location): Update return type. (make_cleanup_delete_event_location): Remove. * location.c (new_linespec_location, new_address_location) (new_probe_location, new_explicit_location, copy_event_location): Return event_location_up. (delete_event_location_cleanup) (make_cleanup_delete_event_location): Remove. (string_to_explicit_location, string_to_event_location_basic) (string_to_event_location): Return event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * completer.c (location_completer): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint) (create_thread_event_breakpoint): Update. (init_breakpoint_sal): Update. Remove some dead code. (create_breakpoint_sal): Change type of "location". Update. (create_breakpoints_sal, create_breakpoint, break_command_1) (dprintf_command, break_range_command, until_break_command) (init_ada_exception_breakpoint) (strace_marker_create_sals_from_location) (update_static_tracepoint, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Update. * break-catch-throw.c (re_set_exception_catchpoint): Update. * ax-gdb.c (agent_command_1): Update.
2017-04-06 04:44:01 +02:00
create_breakpoint (get_current_arch (), location.get (), condition, thread,
extra_string.c_str (),
0 /* condition and thread are valid. */,
Static tracepoints support, and UST integration. gdb/gdbserver/ * configure.ac: Handle --with-ust. substitute ustlibs and ustinc. * mem-break.c (uninsert_all_breakpoints) (reinsert_all_breakpoints): New. * mem-break.h (reinsert_all_breakpoints, uninsert_all_breakpoints): * tracepoint.c (ust_loaded, helper_thread_id, cmd_buf): New. (gdb_agent_ust_loaded, helper_thread_id) (gdb_agent_helper_thread_id): New macros. (struct ipa_sym_addresses): Add addr_ust_loaded, addr_helper_thread_id, addr_cmd_buf. (symbol_list): Add ust_loaded, helper_thread_id, cmd_buf. (in_process_agent_loaded_ust): New. (write_e_ust_not_loaded): New. (maybe_write_ipa_ust_not_loaded): New. (struct collect_static_trace_data_action): New. (enum tracepoint_type) <static_tracepoint>: New. (struct tracepoint) <handle>: Mention static tracepoints. (struct static_tracepoint_ctx): New. (CMD_BUF_SIZE): New. (add_tracepoint_action): Handle static tracepoint actions. (unprobe_marker_at): New. (clear_installed_tracepoints): Handle static tracepoints. (cmd_qtdp): Handle static tracepoints. (probe_marker_at): New. (cmd_qtstart): Handle static tracepoints. (response_tracepoint): Handle static tracepoints. (cmd_qtfstm, cmd_qtsstm, cmd_qtstmat): New. (handle_tracepoint_query): Handle qTfSTM, qTsSTM and qTSTMat. (get_context_regcache): Handle static tracepoints. (do_action_at_tracepoint): Handle static tracepoint actions. (traceframe_find_block_type): Handle static trace data blocks. (traceframe_read_sdata): New. (download_tracepoints): Download static tracepoint actions. [HAVE_UST] Include ust/ust.h, dlfcn.h, sys/socket.h, and sys/un.h. (GDB_PROBE_NAME): New. (ust_ops): New. (GET_UST_SYM): New. (USTF): New. (dlsym_ust): New. (ust_marker_to_static_tracepoint): New. (gdb_probe): New. (collect_ust_data_at_tracepoint): New. (gdb_ust_probe): New. (UNIX_PATH_MAX, SOCK_DIR): New. (gdb_ust_connect_sync_socket): New. (resume_thread, stop_thread): New. (run_inferior_command): New. (init_named_socket): New. (gdb_ust_socket_init): New. (cstr_to_hexstr): New. (next_st): New. (first_marker, next_marker): New. (response_ust_marker): New. (cmd_qtfstm, cmd_qtsstm): New. (unprobe_marker_at, probe_marker_at): New. (cmd_qtstmat, gdb_ust_thread): New. (gdb_ust_init): New. (initialize_tracepoint_ftlib): Call gdb_ust_init. * linux-amd64-ipa.c [HAVE_UST]: Include ust/processor.h (ST_REGENTRY): New. (x86_64_st_collect_regmap): New. (X86_64_NUM_ST_COLLECT_GREGS): New. (AMD64_RIP_REGNUM): New. (supply_static_tracepoint_registers): New. * linux-i386-ipa.c [HAVE_UST]: Include ust/processor.h (ST_REGENTRY): New. (i386_st_collect_regmap): New. (i386_NUM_ST_COLLECT_GREGS): New. (supply_static_tracepoint_registers): New. * server.c (handle_query): Handle qXfer:statictrace:read. <qSupported>: Report support for StaticTracepoints, and qXfer:statictrace:read features. * server.h (traceframe_read_sdata) (supply_static_tracepoint_registers): Declare. * remote-utils.c (convert_int_to_ascii, hexchars, ishex, tohex) (unpack_varlen_hex): Include in IPA build. * Makefile.in (ustlibs, ustinc): New. (IPA_OBJS): Add remote-utils-ipa.o. ($(IPA_LIB)): Link -ldl and -lpthread. (UST_CFLAGS): New. (IPAGENT_CFLAGS): Add UST_CFLAGS. * config.in, configure: Regenerate. gdb/ * NEWS: Mention new support for static tracepoints. (New packets): Mention qTfSTM, qTsSTM, qTSTMat and qXfer:statictrace:read. (New features in the GDB remote stub, GDBserver): Mention static tracepoints support using an UST based backend. (New commands): Mention "info static-tracepoint-markers" and "strace". * breakpoint.c (is_marker_spec): New. (is_tracepoint): Handle static tracepoints. (validate_commands_for_breakpoint): Static tracepoints can't do while-stepping. (static_tracepoints_here): New. (bpstat_what): Handle static tracepoints. (print_one_breakpoint_location, allocate_bp_location, mention): Ditto. (create_breakpoint_sal): Ditto. (decode_static_tracepoint_spec): New. (create_breakpoint): Replace `hardwareflag', and `traceflag' with `type_wanted'. Adjust. Handle static tracepoint marker locations. (break_command_1): Adjust. (update_static_tracepoint): New. (update_breakpoint_locations): Handle static tracepoints. (breakpoint_re_set_one): Handle static tracepoint marker locations. (disable_command, enable_command): Handle static tracepoints. (trace_command, ftrace_command): Adjust. (strace_command): New. (create_tracepoint_from_upload): Adjust. (save_breakpoints): Handle static tracepoints. (_initialize_breakpoint): Install the "strace" command. * breakpoint.h (enum bptype): New bp_static_tracepoint type. (struct breakpoint): New fields static_trace_marker_id and static_trace_marker_id_idx. (breakpoints_here_p): Declare. (create_breakpoint): Adjust. (static_tracepoints_here): Declare. * remote.c (struct remote_state) <static_tracepoints>: New field. (PACKET_qXfer_statictrace_read, PACKET_StaticTracepoints): New. (remote_static_tracepoint_marker_at): New. (remote_static_tracepoint_markers_by_strid): New. (remote_static_tracepoint_feature): New. (remote_disconnected_tracing_feature): Handle "StaticTracepoints". (remote_xfer_partial): Handle TARGET_OBJECT_STATIC_TRACE_DATA. (remote_supports_static_tracepoints): New. (remote_download_tracepoint): Download static tracepoints. (init_remote_ops): Install remote_static_tracepoint_marker_at and remote_static_tracepoint_markers_by_strid. (_initialize_remote): Install set|show remote static-tracepoints, and set|show remote read-sdata-object commands. * target.c (update_current_target): Inherit and default to_static_tracepoint_marker_at, and to_static_tracepoint_markers_by_strid. * target.h (static_tracepoint_marker): Forward declare. (enum target_object): New object TARGET_OBJECT_STATIC_TRACE_DATA. (static_tracepoint_marker_p): New typedef. (DEF_VEC_P(static_tracepoint_marker_p)): New VEC type. (struct target_ops): New fields to_static_tracepoint_marker_at and to_static_tracepoint_markers_by_strid. (target_static_tracepoint_marker_at) (target_static_tracepoint_markers_by_strid): New. * tracepoint.c: Include source.h. (validate_actionline): Handle $_sdata. (struct collection_list): New field strace_data. (add_static_trace_data): New. (clear_collection_list): Clear strace_data. (stringify_collection_list): Account for a possible static trace data collection. (encode_actions_1): Encode an $_sdata collection. (parse_tracepoint_definition): Handle static tracepoints. (parse_static_tracepoint_marker_definition): New. (release_static_tracepoint_marker): New. (print_one_static_tracepoint_marker): New. (info_static_tracepoint_markers_command): New. (sdata_make_value): New. (_initialize_tracepoint): Create the $_sdata convenience variable. Add the "info static-tracepoint-markers" command. Mention $_sdata in the "collect" command's help output. * tracepoint.h (struct static_tracepoint_marker): New. (parse_static_tracepoint_marker_definition) (release_static_tracepoint_marker): Declare. * mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust. * python/py-breakpoint.c (bppy_new): Adjust. doc/ * gdb.texinfo (Convenience Variables): Document $_sdata. (Commands to Set Tracepoints): Describe static tracepoints. Add `Listing Static Tracepoint Markers' menu entry. Document "strace". (Tracepoint Action Lists): Document collecting $_sdata. (Listing Static Tracepoint Markers): New subsection. (Tracepoints support in gdbserver): Mention static tracepoints. (remote packets, enabling and disabling): Mention read-sdata-object. (General Query Packets) <qSupported>: Document qXfer:sdata:read and StaticTracepoint. Mention qTfSTM, qTsSTM and qTSTMat as tracepoint packets. Document qXfer:sdata:read. (Tracepoint packets): Document qTfSTM, qTsSTM and qTSTMat.
2010-07-01 12:36:12 +02:00
temp_p, type_wanted,
ignore_count,
pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
ops, 0, enabled, 0, 0);
}
/* Implements the -break-insert command.
See the MI manual for the list of possible options. */
void
-Wwrite-strings: Constify mi_cmd_argv_ftype's 'command' parameter -Wwrite-strings flags this attempt to pass a literal to a "char *": mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); Fix that by constifying mi_cmd_argv_ftype's 'command' parameter and adjusting all MI commands. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * mi/mi-cmd-break.c (mi_cmd_break_insert_1, mi_cmd_break_insert) (mi_cmd_dprintf_insert, mi_cmd_break_passcount) (mi_cmd_break_watch, mi_cmd_break_commands): Constify 'command' parameter. * mi/mi-cmd-catch.c (mi_cmd_catch_assert, mi_cmd_catch_exception) (mi_cmd_catch_load, mi_cmd_catch_unload): Constify cmd' parameter. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Constify 'command' parameter. * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_cd, mi_cmd_env_path) (mi_cmd_env_dir, mi_cmd_inferior_tty_set, _cmd_inferior_tty_show) * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files) (mi_cmd_file_list_shared_libraries): Constify 'command' parameter. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) (mi_cmd_info_gdb_mi_command, mi_cmd_info_os): Constify 'command' parameter. * mi/mi-cmd-stack.c (mi_cmd_enable_frame_filters) (mi_cmd_stack_list_frames, mi_cmd_stack_info_depth) (mi_cmd_stack_list_locals, mi_cmd_stack_list_args) (mi_cmd_stack_list_variables, mi_cmd_stack_select_frame) (mi_cmd_stack_info_frame): Constify 'command' parameter. * mi/mi-cmd-target.c (mi_cmd_target_file_get) (mi_cmd_target_file_put, mi_cmd_target_file_delete): Constify 'command' parameter. * mi/mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete) (mi_cmd_var_set_format, mi_cmd_var_set_visualizer) (mi_cmd_var_set_frozen, mi_cmd_var_show_format) (mi_cmd_var_info_num_children, mi_cmd_var_list_children) (mi_cmd_var_info_type, mi_cmd_var_info_path_expression) (mi_cmd_var_info_expression, mi_cmd_var_show_attributes) (mi_cmd_var_evaluate_expression, mi_cmd_var_assign) (mi_cmd_var_update, mi_cmd_enable_pretty_printing) (mi_cmd_var_set_update_range): Constify 'command' parameter. * mi/mi-cmds.h (mi_cmd_argv_ftype): Constify 'command' parameter. * mi/mi-interp.c (mi_cmd_interpreter_exec): Constify 'command' parameter. * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_next) (mi_cmd_exec_next_instruction, mi_cmd_exec_step) (mi_cmd_exec_step_instruction, mi_cmd_exec_finish) (mi_cmd_exec_return ,mi_cmd_exec_jump, mi_cmd_exec_continue) (mi_cmd_exec_interrupt, mi_cmd_exec_run, mi_cmd_target_detach) (mi_cmd_target_flash_erase, mi_cmd_thread_select) (mi_cmd_thread_list_ids, mi_cmd_thread_info) (mi_cmd_list_thread_groups, mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers) (mi_cmd_data_write_register_values) (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) (mi_cmd_data_read_memory_bytes, mi_cmd_data_write_memory) (mi_cmd_data_write_memory_bytes, mi_cmd_enable_timings) (mi_cmd_list_features, mi_cmd_list_target_features) (mi_cmd_add_inferior, mi_cmd_remove_inferior) (mi_cmd_trace_define_variable, mi_cmd_trace_list_variables) (mi_cmd_trace_find, mi_cmd_trace_save, mi_cmd_trace_start) (mi_cmd_trace_status, mi_cmd_trace_stop, mi_cmd_ada_task_info) (mi_cmd_trace_frame_collected): Constify 'command' parameter. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Constify 'command' parameter.
2017-04-05 20:21:34 +02:00
mi_cmd_break_insert (const char *command, char **argv, int argc)
{
mi_cmd_break_insert_1 (0, command, argv, argc);
}
/* Implements the -dprintf-insert command.
See the MI manual for the list of possible options. */
void
-Wwrite-strings: Constify mi_cmd_argv_ftype's 'command' parameter -Wwrite-strings flags this attempt to pass a literal to a "char *": mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); Fix that by constifying mi_cmd_argv_ftype's 'command' parameter and adjusting all MI commands. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * mi/mi-cmd-break.c (mi_cmd_break_insert_1, mi_cmd_break_insert) (mi_cmd_dprintf_insert, mi_cmd_break_passcount) (mi_cmd_break_watch, mi_cmd_break_commands): Constify 'command' parameter. * mi/mi-cmd-catch.c (mi_cmd_catch_assert, mi_cmd_catch_exception) (mi_cmd_catch_load, mi_cmd_catch_unload): Constify cmd' parameter. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Constify 'command' parameter. * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_cd, mi_cmd_env_path) (mi_cmd_env_dir, mi_cmd_inferior_tty_set, _cmd_inferior_tty_show) * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files) (mi_cmd_file_list_shared_libraries): Constify 'command' parameter. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) (mi_cmd_info_gdb_mi_command, mi_cmd_info_os): Constify 'command' parameter. * mi/mi-cmd-stack.c (mi_cmd_enable_frame_filters) (mi_cmd_stack_list_frames, mi_cmd_stack_info_depth) (mi_cmd_stack_list_locals, mi_cmd_stack_list_args) (mi_cmd_stack_list_variables, mi_cmd_stack_select_frame) (mi_cmd_stack_info_frame): Constify 'command' parameter. * mi/mi-cmd-target.c (mi_cmd_target_file_get) (mi_cmd_target_file_put, mi_cmd_target_file_delete): Constify 'command' parameter. * mi/mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete) (mi_cmd_var_set_format, mi_cmd_var_set_visualizer) (mi_cmd_var_set_frozen, mi_cmd_var_show_format) (mi_cmd_var_info_num_children, mi_cmd_var_list_children) (mi_cmd_var_info_type, mi_cmd_var_info_path_expression) (mi_cmd_var_info_expression, mi_cmd_var_show_attributes) (mi_cmd_var_evaluate_expression, mi_cmd_var_assign) (mi_cmd_var_update, mi_cmd_enable_pretty_printing) (mi_cmd_var_set_update_range): Constify 'command' parameter. * mi/mi-cmds.h (mi_cmd_argv_ftype): Constify 'command' parameter. * mi/mi-interp.c (mi_cmd_interpreter_exec): Constify 'command' parameter. * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_next) (mi_cmd_exec_next_instruction, mi_cmd_exec_step) (mi_cmd_exec_step_instruction, mi_cmd_exec_finish) (mi_cmd_exec_return ,mi_cmd_exec_jump, mi_cmd_exec_continue) (mi_cmd_exec_interrupt, mi_cmd_exec_run, mi_cmd_target_detach) (mi_cmd_target_flash_erase, mi_cmd_thread_select) (mi_cmd_thread_list_ids, mi_cmd_thread_info) (mi_cmd_list_thread_groups, mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers) (mi_cmd_data_write_register_values) (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) (mi_cmd_data_read_memory_bytes, mi_cmd_data_write_memory) (mi_cmd_data_write_memory_bytes, mi_cmd_enable_timings) (mi_cmd_list_features, mi_cmd_list_target_features) (mi_cmd_add_inferior, mi_cmd_remove_inferior) (mi_cmd_trace_define_variable, mi_cmd_trace_list_variables) (mi_cmd_trace_find, mi_cmd_trace_save, mi_cmd_trace_start) (mi_cmd_trace_status, mi_cmd_trace_stop, mi_cmd_ada_task_info) (mi_cmd_trace_frame_collected): Constify 'command' parameter. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Constify 'command' parameter.
2017-04-05 20:21:34 +02:00
mi_cmd_dprintf_insert (const char *command, char **argv, int argc)
{
mi_cmd_break_insert_1 (1, command, argv, argc);
}
enum wp_type
{
REG_WP,
READ_WP,
ACCESS_WP
};
void
-Wwrite-strings: Constify mi_cmd_argv_ftype's 'command' parameter -Wwrite-strings flags this attempt to pass a literal to a "char *": mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); Fix that by constifying mi_cmd_argv_ftype's 'command' parameter and adjusting all MI commands. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * mi/mi-cmd-break.c (mi_cmd_break_insert_1, mi_cmd_break_insert) (mi_cmd_dprintf_insert, mi_cmd_break_passcount) (mi_cmd_break_watch, mi_cmd_break_commands): Constify 'command' parameter. * mi/mi-cmd-catch.c (mi_cmd_catch_assert, mi_cmd_catch_exception) (mi_cmd_catch_load, mi_cmd_catch_unload): Constify cmd' parameter. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Constify 'command' parameter. * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_cd, mi_cmd_env_path) (mi_cmd_env_dir, mi_cmd_inferior_tty_set, _cmd_inferior_tty_show) * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files) (mi_cmd_file_list_shared_libraries): Constify 'command' parameter. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) (mi_cmd_info_gdb_mi_command, mi_cmd_info_os): Constify 'command' parameter. * mi/mi-cmd-stack.c (mi_cmd_enable_frame_filters) (mi_cmd_stack_list_frames, mi_cmd_stack_info_depth) (mi_cmd_stack_list_locals, mi_cmd_stack_list_args) (mi_cmd_stack_list_variables, mi_cmd_stack_select_frame) (mi_cmd_stack_info_frame): Constify 'command' parameter. * mi/mi-cmd-target.c (mi_cmd_target_file_get) (mi_cmd_target_file_put, mi_cmd_target_file_delete): Constify 'command' parameter. * mi/mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete) (mi_cmd_var_set_format, mi_cmd_var_set_visualizer) (mi_cmd_var_set_frozen, mi_cmd_var_show_format) (mi_cmd_var_info_num_children, mi_cmd_var_list_children) (mi_cmd_var_info_type, mi_cmd_var_info_path_expression) (mi_cmd_var_info_expression, mi_cmd_var_show_attributes) (mi_cmd_var_evaluate_expression, mi_cmd_var_assign) (mi_cmd_var_update, mi_cmd_enable_pretty_printing) (mi_cmd_var_set_update_range): Constify 'command' parameter. * mi/mi-cmds.h (mi_cmd_argv_ftype): Constify 'command' parameter. * mi/mi-interp.c (mi_cmd_interpreter_exec): Constify 'command' parameter. * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_next) (mi_cmd_exec_next_instruction, mi_cmd_exec_step) (mi_cmd_exec_step_instruction, mi_cmd_exec_finish) (mi_cmd_exec_return ,mi_cmd_exec_jump, mi_cmd_exec_continue) (mi_cmd_exec_interrupt, mi_cmd_exec_run, mi_cmd_target_detach) (mi_cmd_target_flash_erase, mi_cmd_thread_select) (mi_cmd_thread_list_ids, mi_cmd_thread_info) (mi_cmd_list_thread_groups, mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers) (mi_cmd_data_write_register_values) (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) (mi_cmd_data_read_memory_bytes, mi_cmd_data_write_memory) (mi_cmd_data_write_memory_bytes, mi_cmd_enable_timings) (mi_cmd_list_features, mi_cmd_list_target_features) (mi_cmd_add_inferior, mi_cmd_remove_inferior) (mi_cmd_trace_define_variable, mi_cmd_trace_list_variables) (mi_cmd_trace_find, mi_cmd_trace_save, mi_cmd_trace_start) (mi_cmd_trace_status, mi_cmd_trace_stop, mi_cmd_ada_task_info) (mi_cmd_trace_frame_collected): Constify 'command' parameter. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Constify 'command' parameter.
2017-04-05 20:21:34 +02:00
mi_cmd_break_passcount (const char *command, char **argv, int argc)
{
int n;
int p;
2011-07-25 Pedro Alves <pedro@codesourcery.com> gdb/ * breakpoint.h (print_recreate_thread): Declare. (struct breakpoint): Move step_count, pass_count, number_on_target, static_trace_marker_id, static_trace_marker_id_idx ... (struct tracepoint): ... to this new struct. (get_tracepoint, get_tracepoint_by_number_on_target) (get_tracepoint_by_number): Change return type to struct tracepoint pointer. * breakpoint.c (is_tracepoint_type): New, factored out from is_tracepoint. (is_tracepoint): Adjust. (print_one_breakpoint_location): Cast to struct tracepoint as necessary, and adjust. (print_recreate_catch_fork, print_recreate_catch_vfork) (print_recreate_catch_syscall, print_recreate_catch_exec): Call print_recreate_thread. (init_breakpoint_sal): New, factored out from create_breakpoint_sal. (create_breakpoint_sal): Reimplement. (create_breakpoint): Allocate a struct tracecepoint if the caller wanted a tracepoint. Use init_breakpoint_sal and install_breakpoint. (print_recreate_ranged_breakpoint, print_recreate_watchpoint) (print_recreate_masked_watchpoint) (print_recreate_exception_catchpoint): Call print_recreate_thread. (tracepoint_print_one_detail): Adjust. (tracepoint_print_recreate): Adjust. Call print_recreate_thread. Dump the pass count here. (update_static_tracepoint): Adjust. (addr_string_to_sals): Adjust. (create_tracepoint_from_upload): Adjust. Change return type to struct tracepoint pointer. (trace_pass_set_count): Change parameter type to struct tracepoint pointer, and adjust. (trace_pass_command): Adjust. (get_tracepoint, get_tracepoint_by_number_on_target) (get_tracepoint_by_number): Change return type to struct tracepoint pointer, and adjust. (print_recreate_thread): New, factored out from save_breakpoints. (save_breakpoints): Don't print thread and task and passcount recreation here. * remote.c (remote_download_tracepoint): Adjust. * tracepoint.c (trace_actions_command, validate_actionline) (start_tracing, tfind_1, trace_find_tracepoint_command) (trace_dump_command): Adjust. (find_matching_tracepoint): Change return type to struct tracepoint pointer, and adjust. (merge_uploaded_tracepoints, tfile_get_traceframe_address) (tfile_trace_find, tfile_fetch_registers): Adjust. * tracepoint.h (create_tracepoint_from_upload): Change return type to struct tracepoint pointer. * ada-lang.c (print_recreate_exception): Call print_recreate_thread. * mi/mi-cmd-break.c (mi_cmd_break_passcount): Adjust.
2011-07-25 13:24:44 +02:00
struct tracepoint *t;
if (argc != 2)
error (_("Usage: tracepoint-number passcount"));
n = atoi (argv[0]);
p = atoi (argv[1]);
t = get_tracepoint (n);
if (t)
{
t->pass_count = p;
Convert observers to C++ This converts observers from using a special source-generating script to be plain C++. This version of the patch takes advantage of C++11 by using std::function and variadic templates; incorporates Pedro's patches; and renames the header file to "observable.h" (this change eliminates the need for a clean rebuild). Note that Pedro's patches used a template lambda in tui-hooks.c, but this failed to compile on some buildbot instances (presumably due to differing C++ versions); I replaced this with an ordinary template function. Regression tested on the buildbot. gdb/ChangeLog 2018-03-19 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * unittests/observable-selftests.c: New file. * common/observable.h: New file. * observable.h: New file. * ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c, arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c, breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c, corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c, extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c, infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c, linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c, mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c, ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c, python/py-breakpoint.c, python/py-finishbreakpoint.c, python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c, record-btrace.c, record-full.c, record.c, regcache.c, remote.c, riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c, spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c, symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c, tui/tui-interp.c, valops.c: Update all users. * tui/tui-hooks.c (tui_bp_created_observer) (tui_bp_deleted_observer, tui_bp_modified_observer) (tui_inferior_exit_observer, tui_before_prompt_observer) (tui_normal_stop_observer, tui_register_changed_observer): Remove. (tui_observers_token): New global. (attach_or_detach, tui_attach_detach_observers): New functions. (tui_install_hooks, tui_remove_hooks): Use tui_attach_detach_observers. * record-btrace.c (record_btrace_thread_observer): Remove. (record_btrace_thread_observer_token): New global. * observer.sh: Remove. * observer.c: Rename to observable.c. * observable.c (namespace gdb_observers): Define new objects. (observer_debug): Move into gdb_observers namespace. (struct observer, struct observer_list, xalloc_observer_list_node) (xfree_observer_list_node, generic_observer_attach) (generic_observer_detach, generic_observer_notify): Remove. (_initialize_observer): Update. Don't include observer.inc. * Makefile.in (generated_files): Remove observer.h, observer.inc. (clean mostlyclean): Likewise. (observer.h, observer.inc): Remove targets. (SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c. (COMMON_SFILES): Use observable.c, not observer.c. * .gitignore: Remove observer.h. gdb/doc/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * observer.texi: Remove. gdb/testsuite/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * gdb.gdb/observer.exp: Remove.
2016-10-02 18:50:20 +02:00
gdb::observers::breakpoint_modified.notify (t);
}
else
{
error (_("Could not find tracepoint %d"), n);
}
}
/* Insert a watchpoint. The type of watchpoint is specified by the
first argument:
-break-watch <expr> --> insert a regular wp.
-break-watch -r <expr> --> insert a read watchpoint.
-break-watch -a <expr> --> insert an access wp. */
void
-Wwrite-strings: Constify mi_cmd_argv_ftype's 'command' parameter -Wwrite-strings flags this attempt to pass a literal to a "char *": mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); Fix that by constifying mi_cmd_argv_ftype's 'command' parameter and adjusting all MI commands. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * mi/mi-cmd-break.c (mi_cmd_break_insert_1, mi_cmd_break_insert) (mi_cmd_dprintf_insert, mi_cmd_break_passcount) (mi_cmd_break_watch, mi_cmd_break_commands): Constify 'command' parameter. * mi/mi-cmd-catch.c (mi_cmd_catch_assert, mi_cmd_catch_exception) (mi_cmd_catch_load, mi_cmd_catch_unload): Constify cmd' parameter. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Constify 'command' parameter. * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_cd, mi_cmd_env_path) (mi_cmd_env_dir, mi_cmd_inferior_tty_set, _cmd_inferior_tty_show) * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files) (mi_cmd_file_list_shared_libraries): Constify 'command' parameter. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) (mi_cmd_info_gdb_mi_command, mi_cmd_info_os): Constify 'command' parameter. * mi/mi-cmd-stack.c (mi_cmd_enable_frame_filters) (mi_cmd_stack_list_frames, mi_cmd_stack_info_depth) (mi_cmd_stack_list_locals, mi_cmd_stack_list_args) (mi_cmd_stack_list_variables, mi_cmd_stack_select_frame) (mi_cmd_stack_info_frame): Constify 'command' parameter. * mi/mi-cmd-target.c (mi_cmd_target_file_get) (mi_cmd_target_file_put, mi_cmd_target_file_delete): Constify 'command' parameter. * mi/mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete) (mi_cmd_var_set_format, mi_cmd_var_set_visualizer) (mi_cmd_var_set_frozen, mi_cmd_var_show_format) (mi_cmd_var_info_num_children, mi_cmd_var_list_children) (mi_cmd_var_info_type, mi_cmd_var_info_path_expression) (mi_cmd_var_info_expression, mi_cmd_var_show_attributes) (mi_cmd_var_evaluate_expression, mi_cmd_var_assign) (mi_cmd_var_update, mi_cmd_enable_pretty_printing) (mi_cmd_var_set_update_range): Constify 'command' parameter. * mi/mi-cmds.h (mi_cmd_argv_ftype): Constify 'command' parameter. * mi/mi-interp.c (mi_cmd_interpreter_exec): Constify 'command' parameter. * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_next) (mi_cmd_exec_next_instruction, mi_cmd_exec_step) (mi_cmd_exec_step_instruction, mi_cmd_exec_finish) (mi_cmd_exec_return ,mi_cmd_exec_jump, mi_cmd_exec_continue) (mi_cmd_exec_interrupt, mi_cmd_exec_run, mi_cmd_target_detach) (mi_cmd_target_flash_erase, mi_cmd_thread_select) (mi_cmd_thread_list_ids, mi_cmd_thread_info) (mi_cmd_list_thread_groups, mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers) (mi_cmd_data_write_register_values) (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) (mi_cmd_data_read_memory_bytes, mi_cmd_data_write_memory) (mi_cmd_data_write_memory_bytes, mi_cmd_enable_timings) (mi_cmd_list_features, mi_cmd_list_target_features) (mi_cmd_add_inferior, mi_cmd_remove_inferior) (mi_cmd_trace_define_variable, mi_cmd_trace_list_variables) (mi_cmd_trace_find, mi_cmd_trace_save, mi_cmd_trace_start) (mi_cmd_trace_status, mi_cmd_trace_stop, mi_cmd_ada_task_info) (mi_cmd_trace_frame_collected): Constify 'command' parameter. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Constify 'command' parameter.
2017-04-05 20:21:34 +02:00
mi_cmd_break_watch (const char *command, char **argv, int argc)
{
char *expr = NULL;
enum wp_type type = REG_WP;
enum opt
{
READ_OPT, ACCESS_OPT
};
static const struct mi_opt opts[] =
{
{"r", READ_OPT, 0},
{"a", ACCESS_OPT, 0},
Warning fixes. * ada-lang.c (find_struct_field): Initialize *byte_offset_p. * breakpoint.c (do_enable_breakpoint): Ignore both mem_cnt and i. * c-typeprint.c (c_type_print_varspec_suffix): Don't test length greater than or equal to zero. * m2-typeprint.c (m2_array): Likewise. * p-typeprint.c (pascal_type_print_varspec_prefix): Likewise. * gdbtypes.c (copy_type_recursive): Correct == typo. * i386-tdep.c (i386_skip_prologue): Remove stray semicolon. * linux-nat.c (linux_nat_info_proc_cmd): Don't compare a pointer greater than zero. * macroscope.c (sal_macro_scope): Don't name a local variable "main". (default_macro_scope): Remove unused variable. * prologue-value.h (pv_area_find_reg): Don't name an argument "register". * remote-fileio.c (remote_fio_func_map): Add missing braces. * remote.c (sigint_remote_twice_token, sigint_remote_token): Change type. (cleanup_sigint_signal_handler): Remove casts. * valprint.c (val_print): Use a volatile local for the modified argument. * varobj.c (languages): Remove extra array dimension. (varobj_create): Correct access to languages array. * mi/mi-cmd-break.c (mi_cmd_break_insert, mi_cmd_break_watch): Add missing braces. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_path, mi_cmd_env_dir): Likewise. * mi/mi-getopt.c (mi_valid_noargs): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_write_memory): Likewise. * signals/signals.c (target_signal_to_string): Cast to int before comparing. * tui/tui-layout.c (init_and_make_win): Take and return a void *. Update all callers.
2007-01-03 20:01:25 +01:00
{ 0, 0, 0 }
};
/* Parse arguments. */
int oind = 0;
char *oarg;
while (1)
{
gdb * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Fix error messages. * mi/mi-main.c (mi_cmd_thread_select): Fix error messages. (mi_cmd_thread_list_ids): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_list_register_values): Likewise. (mi_cmd_data_write_register_values): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory): Likewise. (mi_cmd_enable_timings): Likewise. * mi/mi-interp.c (mi_cmd_interpreter_exec): Fix error messages. * mi/mi-cmd-var.c (mi_cmd_var_create): Fix error messages. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_assign): Likewise. (mi_cmd_var_update): Likewise. (mi_cmd_enable_pretty_printing): Likewise. (mi_cmd_var_set_update_range): Likewise. * mi/mi-cmd-target.c (mi_cmd_target_file_get): Fix error messages. (mi_cmd_target_file_put): Likewise. (mi_cmd_target_file_delete): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Fix error messages. (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_locals): Likewise. (mi_cmd_stack_list_args): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_info_frame): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Fix error messages. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Fix error messages. (mi_cmd_env_cd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Fix error messages. * mi/mi-cmd-break.c (mi_cmd_break_insert): Fix error messages. (mi_cmd_break_watch): Likewise. gdb/testsuite * gdb.mi/gdb2549.exp: Update for error message changes. * gdb.mi/mi-cli.exp: Likewise. * gdb.mi/mi-disassemble.exp: Likewise. * gdb.mi/mi-pthreads.exp: Likewise. * gdb.mi/mi-regs.exp: Likewise. * gdb.mi/mi-stack.exp: Likewise. * gdb.mi/mi-var-block.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-disassemble.exp: Likewise. * gdb.mi/mi2-pthreads.exp: Likewise. * gdb.mi/mi2-regs.exp: Likewise. * gdb.mi/mi2-stack.exp: Likewise. * gdb.mi/mi2-var-block.exp: Likewise. * gdb.mi/mi2-var-cmd.exp: Likewise.
2011-01-12 22:09:39 +01:00
int opt = mi_getopt ("-break-watch", argc, argv,
opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
{
case READ_OPT:
type = READ_WP;
break;
case ACCESS_OPT:
type = ACCESS_WP;
break;
}
}
if (oind >= argc)
gdb * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Fix error messages. * mi/mi-main.c (mi_cmd_thread_select): Fix error messages. (mi_cmd_thread_list_ids): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_list_register_values): Likewise. (mi_cmd_data_write_register_values): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory): Likewise. (mi_cmd_enable_timings): Likewise. * mi/mi-interp.c (mi_cmd_interpreter_exec): Fix error messages. * mi/mi-cmd-var.c (mi_cmd_var_create): Fix error messages. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_assign): Likewise. (mi_cmd_var_update): Likewise. (mi_cmd_enable_pretty_printing): Likewise. (mi_cmd_var_set_update_range): Likewise. * mi/mi-cmd-target.c (mi_cmd_target_file_get): Fix error messages. (mi_cmd_target_file_put): Likewise. (mi_cmd_target_file_delete): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Fix error messages. (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_locals): Likewise. (mi_cmd_stack_list_args): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_info_frame): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Fix error messages. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Fix error messages. (mi_cmd_env_cd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Fix error messages. * mi/mi-cmd-break.c (mi_cmd_break_insert): Fix error messages. (mi_cmd_break_watch): Likewise. gdb/testsuite * gdb.mi/gdb2549.exp: Update for error message changes. * gdb.mi/mi-cli.exp: Likewise. * gdb.mi/mi-disassemble.exp: Likewise. * gdb.mi/mi-pthreads.exp: Likewise. * gdb.mi/mi-regs.exp: Likewise. * gdb.mi/mi-stack.exp: Likewise. * gdb.mi/mi-var-block.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-disassemble.exp: Likewise. * gdb.mi/mi2-pthreads.exp: Likewise. * gdb.mi/mi2-regs.exp: Likewise. * gdb.mi/mi2-stack.exp: Likewise. * gdb.mi/mi2-var-block.exp: Likewise. * gdb.mi/mi2-var-cmd.exp: Likewise.
2011-01-12 22:09:39 +01:00
error (_("-break-watch: Missing <expression>"));
if (oind < argc - 1)
gdb * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Fix error messages. * mi/mi-main.c (mi_cmd_thread_select): Fix error messages. (mi_cmd_thread_list_ids): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_list_register_values): Likewise. (mi_cmd_data_write_register_values): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory): Likewise. (mi_cmd_enable_timings): Likewise. * mi/mi-interp.c (mi_cmd_interpreter_exec): Fix error messages. * mi/mi-cmd-var.c (mi_cmd_var_create): Fix error messages. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_assign): Likewise. (mi_cmd_var_update): Likewise. (mi_cmd_enable_pretty_printing): Likewise. (mi_cmd_var_set_update_range): Likewise. * mi/mi-cmd-target.c (mi_cmd_target_file_get): Fix error messages. (mi_cmd_target_file_put): Likewise. (mi_cmd_target_file_delete): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Fix error messages. (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_locals): Likewise. (mi_cmd_stack_list_args): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_info_frame): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Fix error messages. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Fix error messages. (mi_cmd_env_cd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Fix error messages. * mi/mi-cmd-break.c (mi_cmd_break_insert): Fix error messages. (mi_cmd_break_watch): Likewise. gdb/testsuite * gdb.mi/gdb2549.exp: Update for error message changes. * gdb.mi/mi-cli.exp: Likewise. * gdb.mi/mi-disassemble.exp: Likewise. * gdb.mi/mi-pthreads.exp: Likewise. * gdb.mi/mi-regs.exp: Likewise. * gdb.mi/mi-stack.exp: Likewise. * gdb.mi/mi-var-block.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-disassemble.exp: Likewise. * gdb.mi/mi2-pthreads.exp: Likewise. * gdb.mi/mi2-regs.exp: Likewise. * gdb.mi/mi2-stack.exp: Likewise. * gdb.mi/mi2-var-block.exp: Likewise. * gdb.mi/mi2-var-cmd.exp: Likewise.
2011-01-12 22:09:39 +01:00
error (_("-break-watch: Garbage following <expression>"));
expr = argv[oind];
/* Now we have what we need, let's insert the watchpoint! */
switch (type)
{
case REG_WP:
2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * python/py-breakpoint.c (BPPY_REQUIRE_VALID): Check if bp is NULL. (BPPY_SET_REQUIRE_VALID): Ditto. (bpnum_is_valid): Delete function. (bppy_get_visibility): New function. (bppy_new): Parse for, and validate internal keyword. Pass internal keyword to breakpoint or watchpoint functions. (build_bp_list): New function. (gdbpy_breakpoints): Rewrite. Use build_bp_list and iterate_over_breakpoints. (gdbpy_breakpoint_created): Rewrite. Do not store breakpoints in a look-aside vector. (gdbpy_breakpoint_deleted): Rewrite, defer breakpoint management to internal breakpoint chain. * breakpoint.c (set_breakpoint_number): New function. (breakpoint_1): Check if breakpoint number is more than zero. (set_raw_breakpoint_without_location): Set py_bp_object to NULL. (create_breakpoint_sal): Take a new parameter called internal. Call set_breakpoint_number with internal parameter. Do not mention internal breakpoints. All callers updated. (create_breakpoint): Ditto. (create_breakpoints_sal): Ditto. (watch_command_1): Ditto. (watch_command_wrapper): Take a new parameter called internal. All callers updated. (rwatch_command_wrapper): Ditto. (awatch_command_wrapper): Ditto. (save_breakpoints): Update breakpoint save condition check. (iterate_over_breakpoints): New function. * breakpoint.h: Add conditional python includes. Add py_bp_object and comment to struct breakpoint. Update all callers. * defs.h: Add PyObject definition for GDB builds without Python. 2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Breakpoints In Python): Document "internal" parameter, and visible attribute. 2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-breakpoint.exp: Add internal watchpoint and breakpoint tests.
2010-11-11 15:11:56 +01:00
watch_command_wrapper (expr, FROM_TTY, 0);
break;
case READ_WP:
2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * python/py-breakpoint.c (BPPY_REQUIRE_VALID): Check if bp is NULL. (BPPY_SET_REQUIRE_VALID): Ditto. (bpnum_is_valid): Delete function. (bppy_get_visibility): New function. (bppy_new): Parse for, and validate internal keyword. Pass internal keyword to breakpoint or watchpoint functions. (build_bp_list): New function. (gdbpy_breakpoints): Rewrite. Use build_bp_list and iterate_over_breakpoints. (gdbpy_breakpoint_created): Rewrite. Do not store breakpoints in a look-aside vector. (gdbpy_breakpoint_deleted): Rewrite, defer breakpoint management to internal breakpoint chain. * breakpoint.c (set_breakpoint_number): New function. (breakpoint_1): Check if breakpoint number is more than zero. (set_raw_breakpoint_without_location): Set py_bp_object to NULL. (create_breakpoint_sal): Take a new parameter called internal. Call set_breakpoint_number with internal parameter. Do not mention internal breakpoints. All callers updated. (create_breakpoint): Ditto. (create_breakpoints_sal): Ditto. (watch_command_1): Ditto. (watch_command_wrapper): Take a new parameter called internal. All callers updated. (rwatch_command_wrapper): Ditto. (awatch_command_wrapper): Ditto. (save_breakpoints): Update breakpoint save condition check. (iterate_over_breakpoints): New function. * breakpoint.h: Add conditional python includes. Add py_bp_object and comment to struct breakpoint. Update all callers. * defs.h: Add PyObject definition for GDB builds without Python. 2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Breakpoints In Python): Document "internal" parameter, and visible attribute. 2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-breakpoint.exp: Add internal watchpoint and breakpoint tests.
2010-11-11 15:11:56 +01:00
rwatch_command_wrapper (expr, FROM_TTY, 0);
break;
case ACCESS_WP:
2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * python/py-breakpoint.c (BPPY_REQUIRE_VALID): Check if bp is NULL. (BPPY_SET_REQUIRE_VALID): Ditto. (bpnum_is_valid): Delete function. (bppy_get_visibility): New function. (bppy_new): Parse for, and validate internal keyword. Pass internal keyword to breakpoint or watchpoint functions. (build_bp_list): New function. (gdbpy_breakpoints): Rewrite. Use build_bp_list and iterate_over_breakpoints. (gdbpy_breakpoint_created): Rewrite. Do not store breakpoints in a look-aside vector. (gdbpy_breakpoint_deleted): Rewrite, defer breakpoint management to internal breakpoint chain. * breakpoint.c (set_breakpoint_number): New function. (breakpoint_1): Check if breakpoint number is more than zero. (set_raw_breakpoint_without_location): Set py_bp_object to NULL. (create_breakpoint_sal): Take a new parameter called internal. Call set_breakpoint_number with internal parameter. Do not mention internal breakpoints. All callers updated. (create_breakpoint): Ditto. (create_breakpoints_sal): Ditto. (watch_command_1): Ditto. (watch_command_wrapper): Take a new parameter called internal. All callers updated. (rwatch_command_wrapper): Ditto. (awatch_command_wrapper): Ditto. (save_breakpoints): Update breakpoint save condition check. (iterate_over_breakpoints): New function. * breakpoint.h: Add conditional python includes. Add py_bp_object and comment to struct breakpoint. Update all callers. * defs.h: Add PyObject definition for GDB builds without Python. 2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Breakpoints In Python): Document "internal" parameter, and visible attribute. 2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-breakpoint.exp: Add internal watchpoint and breakpoint tests.
2010-11-11 15:11:56 +01:00
awatch_command_wrapper (expr, FROM_TTY, 0);
break;
default:
gdb * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Fix error messages. * mi/mi-main.c (mi_cmd_thread_select): Fix error messages. (mi_cmd_thread_list_ids): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_list_register_values): Likewise. (mi_cmd_data_write_register_values): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory): Likewise. (mi_cmd_enable_timings): Likewise. * mi/mi-interp.c (mi_cmd_interpreter_exec): Fix error messages. * mi/mi-cmd-var.c (mi_cmd_var_create): Fix error messages. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_assign): Likewise. (mi_cmd_var_update): Likewise. (mi_cmd_enable_pretty_printing): Likewise. (mi_cmd_var_set_update_range): Likewise. * mi/mi-cmd-target.c (mi_cmd_target_file_get): Fix error messages. (mi_cmd_target_file_put): Likewise. (mi_cmd_target_file_delete): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Fix error messages. (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_locals): Likewise. (mi_cmd_stack_list_args): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_select_frame): Likewise. (mi_cmd_stack_info_frame): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Fix error messages. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Fix error messages. (mi_cmd_env_cd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Fix error messages. * mi/mi-cmd-break.c (mi_cmd_break_insert): Fix error messages. (mi_cmd_break_watch): Likewise. gdb/testsuite * gdb.mi/gdb2549.exp: Update for error message changes. * gdb.mi/mi-cli.exp: Likewise. * gdb.mi/mi-disassemble.exp: Likewise. * gdb.mi/mi-pthreads.exp: Likewise. * gdb.mi/mi-regs.exp: Likewise. * gdb.mi/mi-stack.exp: Likewise. * gdb.mi/mi-var-block.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-disassemble.exp: Likewise. * gdb.mi/mi2-pthreads.exp: Likewise. * gdb.mi/mi2-regs.exp: Likewise. * gdb.mi/mi2-stack.exp: Likewise. * gdb.mi/mi2-var-block.exp: Likewise. * gdb.mi/mi2-var-cmd.exp: Likewise.
2011-01-12 22:09:39 +01:00
error (_("-break-watch: Unknown watchpoint type."));
}
}
void
-Wwrite-strings: Constify mi_cmd_argv_ftype's 'command' parameter -Wwrite-strings flags this attempt to pass a literal to a "char *": mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2); Fix that by constifying mi_cmd_argv_ftype's 'command' parameter and adjusting all MI commands. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * mi/mi-cmd-break.c (mi_cmd_break_insert_1, mi_cmd_break_insert) (mi_cmd_dprintf_insert, mi_cmd_break_passcount) (mi_cmd_break_watch, mi_cmd_break_commands): Constify 'command' parameter. * mi/mi-cmd-catch.c (mi_cmd_catch_assert, mi_cmd_catch_exception) (mi_cmd_catch_load, mi_cmd_catch_unload): Constify cmd' parameter. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Constify 'command' parameter. * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_cd, mi_cmd_env_path) (mi_cmd_env_dir, mi_cmd_inferior_tty_set, _cmd_inferior_tty_show) * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files) (mi_cmd_file_list_shared_libraries): Constify 'command' parameter. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) (mi_cmd_info_gdb_mi_command, mi_cmd_info_os): Constify 'command' parameter. * mi/mi-cmd-stack.c (mi_cmd_enable_frame_filters) (mi_cmd_stack_list_frames, mi_cmd_stack_info_depth) (mi_cmd_stack_list_locals, mi_cmd_stack_list_args) (mi_cmd_stack_list_variables, mi_cmd_stack_select_frame) (mi_cmd_stack_info_frame): Constify 'command' parameter. * mi/mi-cmd-target.c (mi_cmd_target_file_get) (mi_cmd_target_file_put, mi_cmd_target_file_delete): Constify 'command' parameter. * mi/mi-cmd-var.c (mi_cmd_var_create, mi_cmd_var_delete) (mi_cmd_var_set_format, mi_cmd_var_set_visualizer) (mi_cmd_var_set_frozen, mi_cmd_var_show_format) (mi_cmd_var_info_num_children, mi_cmd_var_list_children) (mi_cmd_var_info_type, mi_cmd_var_info_path_expression) (mi_cmd_var_info_expression, mi_cmd_var_show_attributes) (mi_cmd_var_evaluate_expression, mi_cmd_var_assign) (mi_cmd_var_update, mi_cmd_enable_pretty_printing) (mi_cmd_var_set_update_range): Constify 'command' parameter. * mi/mi-cmds.h (mi_cmd_argv_ftype): Constify 'command' parameter. * mi/mi-interp.c (mi_cmd_interpreter_exec): Constify 'command' parameter. * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_exec_next) (mi_cmd_exec_next_instruction, mi_cmd_exec_step) (mi_cmd_exec_step_instruction, mi_cmd_exec_finish) (mi_cmd_exec_return ,mi_cmd_exec_jump, mi_cmd_exec_continue) (mi_cmd_exec_interrupt, mi_cmd_exec_run, mi_cmd_target_detach) (mi_cmd_target_flash_erase, mi_cmd_thread_select) (mi_cmd_thread_list_ids, mi_cmd_thread_info) (mi_cmd_list_thread_groups, mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers) (mi_cmd_data_write_register_values) (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) (mi_cmd_data_read_memory_bytes, mi_cmd_data_write_memory) (mi_cmd_data_write_memory_bytes, mi_cmd_enable_timings) (mi_cmd_list_features, mi_cmd_list_target_features) (mi_cmd_add_inferior, mi_cmd_remove_inferior) (mi_cmd_trace_define_variable, mi_cmd_trace_list_variables) (mi_cmd_trace_find, mi_cmd_trace_save, mi_cmd_trace_start) (mi_cmd_trace_status, mi_cmd_trace_stop, mi_cmd_ada_task_info) (mi_cmd_trace_frame_collected): Constify 'command' parameter. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Constify 'command' parameter.
2017-04-05 20:21:34 +02:00
mi_cmd_break_commands (const char *command, char **argv, int argc)
{
Use counted_command_line everywhere Currently command lines are reference counted using shared_ptr only when attached to breakpoints. This patch changes gdb to use shared_ptr in commands as well. This allows for the removal of copy_command_lines. Note that the change to execute_user_command explicitly makes a new reference to the command line. This will be used in a later patch. This simplifies struct command_line based on the observation that a given command can have at most two child bodies: an "if" can have both "then" and "else" parts. Perhaps the names I've chosen for the replacements here are not very good -- your input requested. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * tracepoint.c (all_tracepoint_actions): Rename from all_tracepoint_actions_and_cleanup. Change return type. (actions_command, encode_actions_1, encode_actions) (trace_dump_actions, tdump_command): Update. * remote.c (remote_download_command_source): Update. * python/python.c (gdbpy_eval_from_control_command) (python_command, python_interactive_command): Update. * mi/mi-cmd-break.c (mi_cmd_break_commands): Update. * guile/guile.c (guile_command) (gdbscm_eval_from_control_command, guile_command): Update. * compile/compile.c (compile_code_command) (compile_print_command, compile_to_object): Update. * cli/cli-script.h (struct command_lines_deleter): New. (counted_command_line): New typedef. (struct command_line): Add constructor, destructor. <body_list>: Remove. <body_list_0, body_list_1>: New members. (command_line_up): Remove typedef. (read_command_lines, read_command_lines_1, get_command_line): Update. (copy_command_lines): Don't declare. * cli/cli-script.c (build_command_line): Use "new". (get_command_line): Return counted_command_line. (print_command_lines, execute_user_command) (execute_control_command_1, while_command, if_command): Update. (realloc_body_list): Remove. (process_next_line, recurse_read_control_structure): Update. (read_command_lines, read_command_lines_1): Return counted_command_line. (free_command_lines): Use "delete". (copy_command_lines): Remove. (define_command, document_command, show_user_1): Update. * cli/cli-decode.h (struct cmd_list_element) <user_commands>: Now a counted_command_line. * breakpoint.h (counted_command_line): Remove typedef. (breakpoint_set_commands): Update. * breakpoint.c (check_no_tracepoint_commands) (validate_commands_for_breakpoint): Update. (breakpoint_set_commands): Change commands to be a counted_command_line. (commands_command_1, update_dprintf_command_list) (create_tracepoint_from_upload): Update.
2018-04-17 07:13:18 +02:00
counted_command_line break_command;
char *endptr;
int bnum;
struct breakpoint *b;
if (argc < 1)
error (_("USAGE: %s <BKPT> [<COMMAND> [<COMMAND>...]]"), command);
bnum = strtol (argv[0], &endptr, 0);
if (endptr == argv[0])
error (_("breakpoint number argument \"%s\" is not a number."),
argv[0]);
else if (*endptr != '\0')
error (_("junk at the end of breakpoint number argument \"%s\"."),
argv[0]);
b = get_breakpoint (bnum);
if (b == NULL)
error (_("breakpoint %d not found."), bnum);
int count = 1;
auto reader
= [&] ()
{
const char *result = nullptr;
if (count < argc)
result = argv[count++];
return result;
};
if (is_tracepoint (b))
break_command = read_command_lines_1 (reader, 1,
[=] (const char *line)
{
validate_actionline (line, b);
});
Unify actions and commands * defs.h (read_command_lines, read_command_lines_1): New parameters validator and closure. * tracepoint.h (struct action_line): Remove. * breakpoint.h (struct breakpoint): Remove the 'actions' field. * defs.h (enum command_control_type): New value while_stepping_control. (struct command_line): Add comments. * breakpoint.c (breakoint_is_tracepoint): New. (breakpoint_set_commands): For tracepoints, verify the commands are permissible. (check_tracepoint_commands): New. (commands_command): Require that each new line is validated using check_tracepoint_command, if we set commands for a tracepoint. (create_tracepoint_from_upload): Likewise. (print_one_breakpoint_location): Remove the code to print actions specifically. (tracepoint_save_command): Relay to print_command_lines. * cli/cli-script.c (process_next_line): New parameters validator and closure. Handle 'while-stepping'. Call validator if not null. (read_command_lines, read_command_lines1): Likewise. (recurse_read_control_structure): New parameters validator and closure. Handle while_stepping_control. (print_command_lines): Handle while-stepping. (get_command_line, define_command, document_command): Adjust. * remote.c (remote_download_tracepoint): Adjust. * tracepoint.c (make_cleanup_free_actions, read_actions) (free_actions, do_free_actions_cleanup): Remove. (trace_actions_command): Use read_command_lines. (validate_actionline): Use error in one place. (encode_actions_1): New, extracted from... (encode_actions): ...this. Also use cleanups for exception safety. (trace_dump_command): Adjust. * mi/mi-cmd-break (mi_cmd_break_commands): Validate commands if it's tracepoint.
2010-03-23 22:32:28 +01:00
else
break_command = read_command_lines_1 (reader, 1, 0);
Unify actions and commands * defs.h (read_command_lines, read_command_lines_1): New parameters validator and closure. * tracepoint.h (struct action_line): Remove. * breakpoint.h (struct breakpoint): Remove the 'actions' field. * defs.h (enum command_control_type): New value while_stepping_control. (struct command_line): Add comments. * breakpoint.c (breakoint_is_tracepoint): New. (breakpoint_set_commands): For tracepoints, verify the commands are permissible. (check_tracepoint_commands): New. (commands_command): Require that each new line is validated using check_tracepoint_command, if we set commands for a tracepoint. (create_tracepoint_from_upload): Likewise. (print_one_breakpoint_location): Remove the code to print actions specifically. (tracepoint_save_command): Relay to print_command_lines. * cli/cli-script.c (process_next_line): New parameters validator and closure. Handle 'while-stepping'. Call validator if not null. (read_command_lines, read_command_lines1): Likewise. (recurse_read_control_structure): New parameters validator and closure. Handle while_stepping_control. (print_command_lines): Handle while-stepping. (get_command_line, define_command, document_command): Adjust. * remote.c (remote_download_tracepoint): Adjust. * tracepoint.c (make_cleanup_free_actions, read_actions) (free_actions, do_free_actions_cleanup): Remove. (trace_actions_command): Use read_command_lines. (validate_actionline): Use error in one place. (encode_actions_1): New, extracted from... (encode_actions): ...this. Also use cleanups for exception safety. (trace_dump_command): Adjust. * mi/mi-cmd-break (mi_cmd_break_commands): Validate commands if it's tracepoint.
2010-03-23 22:32:28 +01:00
2017-04-06 05:14:09 +02:00
breakpoint_set_commands (b, std::move (break_command));
}