aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-07-09 22:30:46 +0000
committerPedro Alves <palves@redhat.com>2008-07-09 22:30:46 +0000
commita474d7c2a38f227e95b863f621856ecf1570cc02 (patch)
tree6ff46cd9a8cdd0f4d4e79782c71d86cdce37edfd /gdb/breakpoint.c
parentad52ddc6a45640f008b6f7e713090c79c9cf2947 (diff)
downloadgdb-a474d7c2a38f227e95b863f621856ecf1570cc02.zip
gdb-a474d7c2a38f227e95b863f621856ecf1570cc02.tar.gz
gdb-a474d7c2a38f227e95b863f621856ecf1570cc02.tar.bz2
Per-thread commands.
* gdbthread.h: Remove unneeded forward declarations. Include "inferior.h". (struct thread_info): Add continuations, intermediate_continuations, proceed_to_finish, step_over_calls, stop_step, step_multi and stop_signal members. (save_infrun_state): Add continuations, intermediate_continuations, proceed_to_finish, step_over_calls, stop_step, step_multi, stop_signal and stop_bpstat parameters. (load_infrun_state): Add continuations, intermediate_continuations, proceed_to_finish, step_over_calls, stop_step, step_multi, stop_signal and stop_bpstat parameters. * thread.c (load_infrun_state): In non-stop mode, load continuations, intermediate_continuations, proceed_to_finish, step_over_calls, stop_step, step_multi and stop_signal. (save_infrun_state): Store continuations, intermediate_continuations, proceed_to_finish, step_over_calls, stop_step, step_multi, stop_signal and stop_bpstat. (save_infrun_state): Store continuations, intermediate_continuations, proceed_to_finish, step_over_calls, stop_step, step_multi, stop_signal and stop_bpstat. (free_thread): Clear The thread's stop_bpstat. * inferior.h (context_switch_to): Declare. * infrun.c (ecss): New global. (context_switch): Context switch continuations, intermediate_continuations, proceed_to_finish, step_over_calls, stop_step, step_multi, stop_signal and stop_bpstat. (wait_for_inferior): Use global ecss. (async_ecss, async_ecs): Delete. (fetch_inferior_event): Use global ecss. (context_switch_to): New. * top.c (execute_command): In non-stop, only check if the current thread is running, in all-stop, check if there's any thread running. * breakpoint.c (bpstat_remove_breakpoint): New. (bpstat_remove_breakpoint_callback): New. (delete_breakpoint): Clear the stop_bpstats of all threads. * mi/mi-main.c (mi_cmd_execute): In non-stop, only check if the current thread is running, in all-stop, check if there's any thread running. * Makefile.in (gdbthread_h): Depend on $(inferior_h).
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 3020de2..ed99ca7 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7168,6 +7168,29 @@ update_global_location_list_nothrow (int inserting)
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. */
@@ -7175,7 +7198,6 @@ void
delete_breakpoint (struct breakpoint *bpt)
{
struct breakpoint *b;
- bpstat bs;
struct bp_location *loc, *next;
gdb_assert (bpt != NULL);
@@ -7239,13 +7261,11 @@ delete_breakpoint (struct breakpoint *bpt)
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