#include "top.h"
#include "wrapper.h"
-#include "gdb-events.h"
#include "mi/mi-common.h"
/* Prototypes for local functions. */
-static void until_break_command_continuation (struct continuation_arg *arg,
- int error);
-
static void catch_command_1 (char *, int, int);
static void enable_delete_command (char *, int);
}
}
breakpoints_changed ();
- breakpoint_modify_event (b->number);
+ observer_notify_breakpoint_modified (b->number);
return;
}
free_command_lines (&b->commands);
b->commands = l;
breakpoints_changed ();
- breakpoint_modify_event (b->number);
+ observer_notify_breakpoint_modified (b->number);
return;
}
error (_("No breakpoint number %d."), bnum);
list after it finishes execution. */
b->commands = copy_command_lines (cmd->body_list[0]);
breakpoints_changed ();
- breakpoint_modify_event (b->number);
+ observer_notify_breakpoint_modified (b->number);
return simple_control;
}
error (_("No breakpoint number %d."), bnum);
if (!is_hardware_watchpoint (bpt))
continue;
- if (bpt->enable_state != bp_enabled)
+ if (!breakpoint_enabled (bpt))
continue;
if (bpt->disposition == disp_del_at_next_stop)
annotate_catchpoint (b->number);
printf_filtered (_("\nCatchpoint %d (forked process %d), "),
b->number,
- b->forked_inferior_pid);
+ ptid_get_pid (b->forked_inferior_pid));
return PRINT_SRC_AND_LOC;
break;
annotate_catchpoint (b->number);
printf_filtered (_("\nCatchpoint %d (vforked process %d), "),
b->number,
- b->forked_inferior_pid);
+ ptid_get_pid (b->forked_inferior_pid));
return PRINT_SRC_AND_LOC;
break;
/* If we've gotten confused in the unwinder, we might have
returned a frame that can't describe this variable. */
if (within_current_scope
- && block_function (b->exp_valid_block) != get_frame_function (fr))
+ && (block_linkage_function (b->exp_valid_block)
+ != get_frame_function (fr)))
within_current_scope = 0;
/* in_function_epilogue_p() returns a non-zero value if we're still
return 0;
if ((b->type == bp_catch_fork)
- && !inferior_has_forked (PIDGET (inferior_ptid),
+ && !inferior_has_forked (inferior_ptid,
&b->forked_inferior_pid))
return 0;
if ((b->type == bp_catch_vfork)
- && !inferior_has_vforked (PIDGET (inferior_ptid),
+ && !inferior_has_vforked (inferior_ptid,
&b->forked_inferior_pid))
return 0;
if ((b->type == bp_catch_exec)
- && !inferior_has_execd (PIDGET (inferior_ptid), &b->exec_pathname))
+ && !inferior_has_execd (inferior_ptid, &b->exec_pathname))
return 0;
return 1;
if (addressprint)
ui_out_field_skip (uiout, "addr");
annotate_field (5);
- if (b->forked_inferior_pid != 0)
+ if (!ptid_equal (b->forked_inferior_pid, null_ptid))
{
ui_out_text (uiout, "process ");
- ui_out_field_int (uiout, "what", b->forked_inferior_pid);
+ ui_out_field_int (uiout, "what",
+ ptid_get_pid (b->forked_inferior_pid));
ui_out_spaces (uiout, 1);
}
break;
b->frame_id = null_frame_id;
b->dll_pathname = NULL;
b->triggered_dll_pathname = NULL;
- b->forked_inferior_pid = 0;
+ b->forked_inferior_pid = null_ptid;
b->exec_pathname = NULL;
b->ops = NULL;
b->condition_not_parsed = 0;
static void
create_longjmp_breakpoint (char *func_name)
{
- struct breakpoint *b;
struct minimal_symbol *m;
if ((m = lookup_minimal_symbol_text (func_name, NULL)) == NULL)
void
set_longjmp_breakpoint (void)
{
- struct breakpoint *b;
-
if (gdbarch_get_longjmp_target_p (current_gdbarch))
{
create_longjmp_breakpoint ("longjmp");
b->addr_string = NULL;
b->enable_state = bp_enabled;
b->disposition = tempflag ? disp_del : disp_donttouch;
- b->forked_inferior_pid = 0;
+ b->forked_inferior_pid = null_ptid;
update_global_location_list (1);
ALL_BREAKPOINTS (b)
{
- if (b->type == bp_hardware_breakpoint && b->enable_state == bp_enabled)
+ if (b->type == bp_hardware_breakpoint && breakpoint_enabled (b))
i++;
}
/* FIXME: This is misplaced; mention() is called by things (like
hitting a watchpoint) other than breakpoint creation. It should
be possible to clean this up and at the same time replace the
- random calls to breakpoint_changed with this hook, as has already
- been done for deprecated_delete_breakpoint_hook and so on. */
- if (deprecated_create_breakpoint_hook)
- deprecated_create_breakpoint_hook (b);
- breakpoint_create_event (b->number);
+ random calls to breakpoint_changed with this hook. */
+ observer_notify_breakpoint_created (b->number);
if (b->ops != NULL && b->ops->print_mention != NULL)
b->ops->print_mention (b);
bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab);
if (bv != NULL)
{
- sym = block_function (b);
+ sym = block_linkage_function (b);
if (sym != NULL)
{
fixup_symbol_section (sym, sal->symtab->objfile);
/* Helper routines for the until_command routine in infcmd.c. Here
because it uses the mechanisms of breakpoints. */
+struct until_break_command_continuation_args
+{
+ struct breakpoint *breakpoint;
+ struct breakpoint *breakpoint2;
+};
+
/* This function is called by fetch_inferior_event via the
cmd_continuation pointer, to complete the until command. It takes
care of cleaning up the temporary breakpoints set up by the until
command. */
static void
-until_break_command_continuation (struct continuation_arg *arg, int error)
+until_break_command_continuation (void *arg)
{
- delete_breakpoint ((struct breakpoint *)(arg->data.pointer));
- if (arg->next)
- delete_breakpoint ((struct breakpoint *)(arg->next->data.pointer));
+ struct until_break_command_continuation_args *a = arg;
+
+ delete_breakpoint (a->breakpoint);
+ if (a->breakpoint2)
+ delete_breakpoint (a->breakpoint2);
}
void
struct breakpoint *breakpoint;
struct breakpoint *breakpoint2 = NULL;
struct cleanup *old_chain;
- struct continuation_arg *arg1;
- struct continuation_arg *arg2;
-
clear_proceed_status ();
deleted when the target stops. Otherwise, we're already stopped and
delete breakpoints via cleanup chain. */
- if (target_can_async_p () && target_executing)
+ if (target_can_async_p () && is_running (inferior_ptid))
{
- arg1 =
- (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
- arg1->next = NULL;
- arg1->data.pointer = breakpoint;
+ struct until_break_command_continuation_args *args;
+ args = xmalloc (sizeof (*args));
- if (breakpoint2)
- {
- arg2 = (struct continuation_arg *)
- xmalloc ( sizeof (struct continuation_arg));
- arg2->next = NULL;
- arg2->data.pointer = breakpoint2;
- arg1->next = arg2;
- }
+ args->breakpoint = breakpoint;
+ args->breakpoint2 = breakpoint2;
discard_cleanups (old_chain);
- add_continuation (until_break_command_continuation, arg1);
+ add_continuation (until_break_command_continuation, args,
+ xfree);
}
else
do_cleanups (old_chain);
update_global_location_list (inserting);
}
+/* Clear BPT from a BPS. */
+static void
+bpstat_remove_breakpoint (bpstat bps, struct breakpoint *bpt)
+{
+ bpstat bs;
+ for (bs = bps; bs; bs = bs->next)
+ if (bs->breakpoint_at && bs->breakpoint_at->owner == bpt)
+ {
+ bs->breakpoint_at = NULL;
+ bs->old_val = NULL;
+ /* bs->commands will be freed later. */
+ }
+}
+
+/* Callback for iterate_over_threads. */
+static int
+bpstat_remove_breakpoint_callback (struct thread_info *th, void *data)
+{
+ struct breakpoint *bpt = data;
+ bpstat_remove_breakpoint (th->stop_bpstat, bpt);
+ return 0;
+}
+
/* Delete a breakpoint and clean up all traces of it in the data
structures. */
delete_breakpoint (struct breakpoint *bpt)
{
struct breakpoint *b;
- bpstat bs;
struct bp_location *loc, *next;
gdb_assert (bpt != NULL);
if (bpt->type == bp_none)
return;
- if (deprecated_delete_breakpoint_hook)
- deprecated_delete_breakpoint_hook (bpt);
- breakpoint_delete_event (bpt->number);
+ observer_notify_breakpoint_deleted (bpt->number);
if (breakpoint_chain == bpt)
breakpoint_chain = bpt->next;
bpstat_do_actions (&stop_bpstat);
in event-top.c won't do anything, and temporary breakpoints
with commands won't work. */
- for (bs = stop_bpstat; bs; bs = bs->next)
- if (bs->breakpoint_at && bs->breakpoint_at->owner == bpt)
- {
- bs->breakpoint_at = NULL;
- bs->old_val = NULL;
- /* bs->commands will be freed later. */
- }
+
+ /* Clear the current context. */
+ bpstat_remove_breakpoint (stop_bpstat, bpt);
+ /* And from all threads. */
+ iterate_over_threads (bpstat_remove_breakpoint_callback, bpt);
/* Now that breakpoint is removed from breakpoint
list, update the global location list. This
count, bptnum);
}
breakpoints_changed ();
- breakpoint_modify_event (b->number);
+ observer_notify_breakpoint_modified (b->number);
return;
}
update_global_location_list (0);
- if (deprecated_modify_breakpoint_hook)
- deprecated_modify_breakpoint_hook (bpt);
- breakpoint_modify_event (bpt->number);
+ observer_notify_breakpoint_modified (bpt->number);
}
static void
update_global_location_list (1);
breakpoints_changed ();
- if (deprecated_modify_breakpoint_hook)
- deprecated_modify_breakpoint_hook (bpt);
- breakpoint_modify_event (bpt->number);
+ observer_notify_breakpoint_modified (bpt->number);
}