2000-02-23 01:25:43 +01:00
|
|
|
/* MI Command Set - breakpoint and watchpoint commands.
|
2011-01-01 16:34:07 +01:00
|
|
|
Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009, 2010, 2011
|
2009-01-03 06:58:08 +01:00
|
|
|
Free Software Foundation, Inc.
|
2000-02-23 07:19:22 +01:00
|
|
|
Contributed by Cygnus Solutions (a Red Hat company).
|
2000-02-23 01:25:43 +01:00
|
|
|
|
|
|
|
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
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2000-02-23 01:25:43 +01:00
|
|
|
(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
|
2007-08-23 20:08:50 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2000-02-23 01:25:43 +01:00
|
|
|
|
|
|
|
#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"
|
2000-02-23 01:25:43 +01:00
|
|
|
#include "mi-cmds.h"
|
|
|
|
#include "ui-out.h"
|
|
|
|
#include "mi-out.h"
|
|
|
|
#include "breakpoint.h"
|
|
|
|
#include "gdb_string.h"
|
|
|
|
#include "mi-getopt.h"
|
2001-07-28 21:48:15 +02:00
|
|
|
#include "gdb.h"
|
2008-02-01 17:24:47 +01:00
|
|
|
#include "exceptions.h"
|
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
|
|
|
#include "observer.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"
|
2000-02-23 01:25:43 +01:00
|
|
|
|
|
|
|
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. */
|
2000-02-23 01:25:43 +01:00
|
|
|
|
|
|
|
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)
|
2000-02-23 01:25:43 +01:00
|
|
|
{
|
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)
|
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
|
|
|
gdb_breakpoint_query (uiout, b->number, NULL);
|
2000-02-23 01:25:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
enum bp_type
|
|
|
|
{
|
|
|
|
REG_BP,
|
|
|
|
HW_BP,
|
|
|
|
REGEXP_BP
|
|
|
|
};
|
|
|
|
|
2007-12-14 19:15:47 +01:00
|
|
|
/* Implements the -break-insert command.
|
|
|
|
See the MI manual for the list of possible options. */
|
2000-02-23 01:25:43 +01:00
|
|
|
|
2008-06-25 17:15:42 +02:00
|
|
|
void
|
2000-02-23 01:25:43 +01:00
|
|
|
mi_cmd_break_insert (char *command, char **argv, int argc)
|
|
|
|
{
|
|
|
|
char *address = NULL;
|
2010-03-16 09:42:20 +01:00
|
|
|
int hardware = 0;
|
2000-02-23 01:25:43 +01:00
|
|
|
int temp_p = 0;
|
|
|
|
int thread = -1;
|
|
|
|
int ignore_count = 0;
|
|
|
|
char *condition = NULL;
|
2007-12-14 19:15:47 +01:00
|
|
|
int pending = 0;
|
2009-01-30 19:28:01 +01:00
|
|
|
int enabled = 1;
|
2010-03-23 22:41:55 +01:00
|
|
|
int tracepoint = 0;
|
2010-03-16 09:42:20 +01:00
|
|
|
struct cleanup *back_to;
|
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;
|
2009-01-30 19:28:01 +01:00
|
|
|
|
2000-02-23 01:25:43 +01:00
|
|
|
enum opt
|
|
|
|
{
|
2010-03-16 09:42:20 +01:00
|
|
|
HARDWARE_OPT, TEMP_OPT, CONDITION_OPT,
|
2010-03-23 22:41:55 +01:00
|
|
|
IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT,
|
|
|
|
TRACEPOINT_OPT,
|
2000-02-23 01:25:43 +01:00
|
|
|
};
|
|
|
|
static 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},
|
2007-12-14 19:15:47 +01:00
|
|
|
{"f", PENDING_OPT, 0},
|
2009-01-30 19:28:01 +01:00
|
|
|
{"d", DISABLE_OPT, 0},
|
2010-03-23 22:41:55 +01:00
|
|
|
{"a", TRACEPOINT_OPT, 0},
|
2007-01-03 20:01:25 +01:00
|
|
|
{ 0, 0, 0 }
|
2000-02-23 01:25:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Parse arguments. It could be -r or -h or -t, <location> or ``--''
|
|
|
|
to denote the end of the option list. */
|
|
|
|
int optind = 0;
|
|
|
|
char *optarg;
|
2010-05-17 22:49:39 +02:00
|
|
|
|
2000-02-23 01:25:43 +01:00
|
|
|
while (1)
|
|
|
|
{
|
2011-01-12 22:09:39 +01:00
|
|
|
int opt = mi_getopt ("-break-insert", argc, argv,
|
2011-01-06 01:57:05 +01:00
|
|
|
opts, &optind, &optarg);
|
2000-02-23 01:25:43 +01:00
|
|
|
if (opt < 0)
|
|
|
|
break;
|
|
|
|
switch ((enum opt) opt)
|
|
|
|
{
|
|
|
|
case TEMP_OPT:
|
|
|
|
temp_p = 1;
|
|
|
|
break;
|
|
|
|
case HARDWARE_OPT:
|
2010-03-16 09:42:20 +01:00
|
|
|
hardware = 1;
|
2000-02-23 01:25:43 +01:00
|
|
|
break;
|
|
|
|
case CONDITION_OPT:
|
|
|
|
condition = optarg;
|
|
|
|
break;
|
|
|
|
case IGNORE_COUNT_OPT:
|
|
|
|
ignore_count = atol (optarg);
|
|
|
|
break;
|
|
|
|
case THREAD_OPT:
|
|
|
|
thread = atol (optarg);
|
|
|
|
break;
|
2007-12-14 19:15:47 +01:00
|
|
|
case PENDING_OPT:
|
|
|
|
pending = 1;
|
|
|
|
break;
|
2009-01-30 19:28:01 +01:00
|
|
|
case DISABLE_OPT:
|
|
|
|
enabled = 0;
|
2010-03-23 22:41:55 +01:00
|
|
|
break;
|
|
|
|
case TRACEPOINT_OPT:
|
|
|
|
tracepoint = 1;
|
|
|
|
break;
|
2000-02-23 01:25:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (optind >= argc)
|
2011-01-12 22:09:39 +01:00
|
|
|
error (_("-break-insert: Missing <location>"));
|
2000-02-23 01:25:43 +01:00
|
|
|
if (optind < argc - 1)
|
2011-01-12 22:09:39 +01:00
|
|
|
error (_("-break-insert: Garbage following <location>"));
|
2000-02-23 01:25:43 +01:00
|
|
|
address = argv[optind];
|
|
|
|
|
|
|
|
/* Now we have what we need, let's insert the breakpoint! */
|
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_breakpoint_observers_installed)
|
|
|
|
{
|
|
|
|
observer_attach_breakpoint_created (breakpoint_notify);
|
|
|
|
mi_breakpoint_observers_installed = 1;
|
|
|
|
}
|
|
|
|
|
2010-03-16 09:42:20 +01:00
|
|
|
back_to = make_cleanup_restore_integer (&mi_can_breakpoint_notify);
|
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
|
|
|
mi_can_breakpoint_notify = 1;
|
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
|
|
|
|
|
|
|
/* 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 = (tracepoint
|
|
|
|
? (hardware ? bp_fast_tracepoint : bp_tracepoint)
|
|
|
|
: (hardware ? bp_hardware_breakpoint : bp_breakpoint));
|
|
|
|
|
2010-03-16 09:42:20 +01:00
|
|
|
create_breakpoint (get_current_arch (), address, condition, thread,
|
|
|
|
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,
|
2010-03-16 09:42:20 +01:00
|
|
|
ignore_count,
|
|
|
|
pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
|
2011-07-25 Pedro Alves <pedro@codesourcery.com>
Implement most breakpoint_ops methods for all breakpoint types,
and move the default handlings to the proper callbacks.
gdb/
* breakpoint.c (update_watchpoint): Always call the breakpoint's
works_in_software_mode method.
(insert_bp_location): Go through breakpoint_ops->insert_location
for software and hardware watchpoints.
(create_internal_breakpoint): Pass bkpt_breakpoint_ops as
breakpoint_ops.
(remove_breakpoint_1): Go through breakpoint_ops->remove_location
for software and hardware watchpoints.
(print_it_typical): Delete.
(print_bp_stop_message): Always call the breakpoint_ops->print_it
method.
(watchpoint_check): Adjust comment.
(bpstat_check_location): Simply always call the breakpoint's
breakpoint_hit method.
(bpstat_stop_status): Always call the breakpoint's check_status
method. Remove special cases for watchpoints and internal event
breakpoints from here (moved to the check_status implementations).
(print_one_breakpoint_location): Assume b->ops is never NULL.
Remove static tracepoint marker id printing from here (moved to
the print_one_detail callback implementation of tracepoints).
(init_bp_location): Assert OPS is never NULL.
(allocate_bp_location): Always call the breakpoint's
allocate_location method, and remove the default code from here.
(free_bp_location): Always call the location's dtor method, and
remove the default code from here.
(init_raw_breakpoint_without_location): Assert OPS is never NULL.
(set_raw_breakpoint_without_location): Add new breakpoint_ops
parameter. Pass it down.
(set_raw_breakpoint): Ditto.
(print_it_catch_fork): Adjust to take a bpstat as argument.
(catch_fork_breakpoint_ops): Install methods.
(print_it_catch_vfork): Adjust to take a bpstat as argument.
(catch_vfork_breakpoint_ops): Install methods.
(dtor_catch_syscall): Call the base dtor.
(print_it_catch_syscall): Adjust to take a bpstat as argument.
(catch_syscall_breakpoint_ops): Install methods.
(dtor_catch_exec): Call the base dtor.
(print_it_catch_exec): Adjust to take a bpstat as argument.
(catch_exec_breakpoint_ops): Install methods.
(hw_breakpoint_used_count, hw_watchpoint_used_count): Always call
the breakpoint's resources_needed method, and remove the default
code from here.
(set_momentary_breakpoint): Pass bkpt_breakpoint_ops as
breakpoint_ops.
(clone_momentary_breakpoint): Clone the original's ops.
(mention): Always call the breakpoint's print_mention method, and
remove the default code from here.
(create_breakpoint_sal): Adjust to pass the ops to
set_raw_breakpoint rather than setting it manually.
(create_breakpoint): Assert ops is never NULL. Adjust to pass the
ops to set_raw_breakpoint_without_location rather than setting it
manually.
(break_command_1): Pass bkpt_breakpoint_ops as breakpoint_ops.
(print_it_ranged_breakpoint): Adjust to take a bpstat as argument.
(ranged_breakpoint_ops): Install methods.
(break_range_command): Adjust to pass the ops to
set_raw_breakpoint rather than setting it manually.
(re_set_watchpoint, breakpoint_hit_watchpoint)
(check_status_watchpoint, resources_needed_watchpoint)
(works_in_software_mode_watchpoint, print_it_watchpoint)
(print_mention_watchpoint, print_recreate_watchpoint): New
functions.
(watchpoint_breakpoint_ops): Install new methods.
(print_it_masked_watchpoint): New function.
(masked_watchpoint_breakpoint_ops): Install new methods.
(watch_command_1): Adjust to pass the right breakpoint_ops to
set_raw_breakpoint_without_location rather than setting it
manually later. Record the current pspace.
(print_it_exception_catchpoint): Adjust to take a bpstat as
argument.
(gnu_v3_exception_catchpoint_ops): Install new methods.
(say_where): New function.
(null_re_set, null_check_status, null_works_in_software_mode)
(null_resources_needed, null_print_one_detail, bp_location_dtor):
New functions.
(bp_location_ops): New global.
(bkpt_dtor, bkpt_allocate_location, bkpt_re_set)
(bkpt_insert_location, bkpt_remove_location, bkpt_breakpoint_hit)
(bkpt_check_status, bkpt_resources_needed)
(bkpt_works_in_software_mode, bkpt_print_it, bkpt_print_mention)
(bkpt_print_recreate): New functions.
(bkpt_breakpoint_ops): New global.
(tracepoint_re_set, tracepoint_insert_location)
(tracepoint_remove_location, tracepoint_breakpoint_hit)
(tracepoint_check_status, tracepoint_works_in_software_mode)
(tracepoint_print_it, tracepoint_print_one_detail)
(tracepoint_print_mention, tracepoint_print_recreate): New
functions.
(tracepoint_breakpoint_ops): New global.
(delete_breakpoint): Always call the breakpoint's dtor method, and
remove the default handling from here.
(breakpoint_re_set_default): Make static.
(breakpoint_re_set_one): Always call the breakpoints re_set
method, and remove the default handling from here.
(trace_command, ftrace_command, strace_command)
(create_tracepoint_from_upload): Pass appropriate breakpoints_ops
to create_breakpoint.
(save_breakpoints): Always call the breakpoint's print_recreate
method, and remove the default handling from here.
* ada-lang.c (dtor_exception): Call the base dtor.
(re_set_exception): Call the base method.
(print_it_exception, print_it_catch_exception): Adjust to take a
bpstat as argument.
(catch_exception_breakpoint_ops): Install methods.
(print_it_catch_exception_unhandled): Adjust to take a bpstat as
argument.
(catch_exception_unhandled_breakpoint_ops): Install methods.
(print_it_catch_assert): Adjust to take a bpstat as argument.
(catch_assert_breakpoint_ops): Install methods.
* breakpoint.h (struct breakpoint_ops): Adjust the print_it method
to take a bpstat as argument.
(enum print_stop_action): Add describing comments to each enum
value.
(breakpoint_re_set_default): Delete declaration.
(null_re_set, null_works_in_software_mode, null_resources_needed)
(null_check_status, null_print_one_detail): Declare.
(bkpt_breakpoint_ops): Declare.
(bkpt_dtor, bkpt_allocate_location, bkpt_re_set)
(bkpt_insert_location, bkpt_remove_location, bkpt_breakpoint_hit)
(bkpt_check_status, bkpt_resources_needed)
(bkpt_works_in_software_mode, bkpt_print_it)
(null_print_one_detail, bkpt_print_mention, bkpt_print_recreate):
Declare.
* mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust to pass
bkpt_breakpoint_ops.
* python/py-breakpoint.c (bppy_init): Ditto.
2011-07-25 13:16:49 +02:00
|
|
|
&bkpt_breakpoint_ops, 0, enabled, 0);
|
2010-03-16 09:42:20 +01:00
|
|
|
do_cleanups (back_to);
|
|
|
|
|
2000-02-23 01:25:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
enum wp_type
|
|
|
|
{
|
|
|
|
REG_WP,
|
|
|
|
READ_WP,
|
|
|
|
ACCESS_WP
|
|
|
|
};
|
|
|
|
|
2010-03-23 22:48:14 +01:00
|
|
|
void
|
|
|
|
mi_cmd_break_passcount (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;
|
2010-03-23 22:48:14 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
observer_notify_tracepoint_modified (n);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
error (_("Cound not find tracepoint %d"), n);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-02-23 01:25:43 +01:00
|
|
|
/* 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. */
|
|
|
|
|
2008-06-25 17:15:42 +02:00
|
|
|
void
|
2000-02-23 01:25:43 +01:00
|
|
|
mi_cmd_break_watch (char *command, char **argv, int argc)
|
|
|
|
{
|
|
|
|
char *expr = NULL;
|
|
|
|
enum wp_type type = REG_WP;
|
|
|
|
enum opt
|
|
|
|
{
|
|
|
|
READ_OPT, ACCESS_OPT
|
|
|
|
};
|
|
|
|
static struct mi_opt opts[] =
|
|
|
|
{
|
|
|
|
{"r", READ_OPT, 0},
|
|
|
|
{"a", ACCESS_OPT, 0},
|
2007-01-03 20:01:25 +01:00
|
|
|
{ 0, 0, 0 }
|
2000-02-23 01:25:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Parse arguments. */
|
|
|
|
int optind = 0;
|
|
|
|
char *optarg;
|
2010-05-17 22:49:39 +02:00
|
|
|
|
2000-02-23 01:25:43 +01:00
|
|
|
while (1)
|
|
|
|
{
|
2011-01-12 22:09:39 +01:00
|
|
|
int opt = mi_getopt ("-break-watch", argc, argv,
|
2010-05-17 22:49:39 +02:00
|
|
|
opts, &optind, &optarg);
|
|
|
|
|
2000-02-23 01:25:43 +01:00
|
|
|
if (opt < 0)
|
|
|
|
break;
|
|
|
|
switch ((enum opt) opt)
|
|
|
|
{
|
|
|
|
case READ_OPT:
|
|
|
|
type = READ_WP;
|
|
|
|
break;
|
|
|
|
case ACCESS_OPT:
|
|
|
|
type = ACCESS_WP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (optind >= argc)
|
2011-01-12 22:09:39 +01:00
|
|
|
error (_("-break-watch: Missing <expression>"));
|
2000-02-23 01:25:43 +01:00
|
|
|
if (optind < argc - 1)
|
2011-01-12 22:09:39 +01:00
|
|
|
error (_("-break-watch: Garbage following <expression>"));
|
2000-02-23 01:25:43 +01:00
|
|
|
expr = argv[optind];
|
|
|
|
|
|
|
|
/* Now we have what we need, let's insert the watchpoint! */
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case REG_WP:
|
2010-11-11 15:11:56 +01:00
|
|
|
watch_command_wrapper (expr, FROM_TTY, 0);
|
2000-02-23 01:25:43 +01:00
|
|
|
break;
|
|
|
|
case READ_WP:
|
2010-11-11 15:11:56 +01:00
|
|
|
rwatch_command_wrapper (expr, FROM_TTY, 0);
|
2000-02-23 01:25:43 +01:00
|
|
|
break;
|
|
|
|
case ACCESS_WP:
|
2010-11-11 15:11:56 +01:00
|
|
|
awatch_command_wrapper (expr, FROM_TTY, 0);
|
2000-02-23 01:25:43 +01:00
|
|
|
break;
|
|
|
|
default:
|
2011-01-12 22:09:39 +01:00
|
|
|
error (_("-break-watch: Unknown watchpoint type."));
|
2000-02-23 01:25:43 +01:00
|
|
|
}
|
|
|
|
}
|
2009-08-03 14:39:01 +02:00
|
|
|
|
|
|
|
/* The mi_read_next_line consults these variable to return successive
|
|
|
|
command lines. While it would be clearer to use a closure pointer,
|
|
|
|
it is not expected that any future code will use read_command_lines_1,
|
|
|
|
therefore no point of overengineering. */
|
|
|
|
|
|
|
|
static char **mi_command_line_array;
|
|
|
|
static int mi_command_line_array_cnt;
|
|
|
|
static int mi_command_line_array_ptr;
|
|
|
|
|
|
|
|
static char *
|
2010-03-02 22:46:28 +01:00
|
|
|
mi_read_next_line (void)
|
2009-08-03 14:39:01 +02:00
|
|
|
{
|
|
|
|
if (mi_command_line_array_ptr == mi_command_line_array_cnt)
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return mi_command_line_array[mi_command_line_array_ptr++];
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
mi_cmd_break_commands (char *command, char **argv, int argc)
|
|
|
|
{
|
|
|
|
struct command_line *break_command;
|
|
|
|
char *endptr;
|
|
|
|
int bnum;
|
|
|
|
struct breakpoint *b;
|
|
|
|
|
|
|
|
if (argc < 1)
|
2011-01-11 16:10:03 +01:00
|
|
|
error (_("USAGE: %s <BKPT> [<COMMAND> [<COMMAND>...]]"), command);
|
2009-08-03 14:39:01 +02:00
|
|
|
|
|
|
|
bnum = strtol (argv[0], &endptr, 0);
|
|
|
|
if (endptr == argv[0])
|
2011-01-11 16:10:03 +01:00
|
|
|
error (_("breakpoint number argument \"%s\" is not a number."),
|
2009-08-03 14:39:01 +02:00
|
|
|
argv[0]);
|
|
|
|
else if (*endptr != '\0')
|
2011-01-11 16:10:03 +01:00
|
|
|
error (_("junk at the end of breakpoint number argument \"%s\"."),
|
2009-08-03 14:39:01 +02:00
|
|
|
argv[0]);
|
|
|
|
|
|
|
|
b = get_breakpoint (bnum);
|
|
|
|
if (b == NULL)
|
2011-01-11 16:10:03 +01:00
|
|
|
error (_("breakpoint %d not found."), bnum);
|
2009-08-03 14:39:01 +02:00
|
|
|
|
|
|
|
mi_command_line_array = argv;
|
|
|
|
mi_command_line_array_ptr = 1;
|
|
|
|
mi_command_line_array_cnt = argc;
|
|
|
|
|
2010-04-05 01:47:16 +02:00
|
|
|
if (is_tracepoint (b))
|
2010-03-23 22:32:28 +01:00
|
|
|
break_command = read_command_lines_1 (mi_read_next_line, 1,
|
|
|
|
check_tracepoint_command, b);
|
|
|
|
else
|
|
|
|
break_command = read_command_lines_1 (mi_read_next_line, 1, 0, 0);
|
|
|
|
|
2009-08-03 14:39:01 +02:00
|
|
|
breakpoint_set_commands (b, break_command);
|
|
|
|
}
|
|
|
|
|