aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-10-15 20:18:32 +0100
committerPedro Alves <palves@redhat.com>2014-10-15 20:18:32 +0100
commit34b7e8a6ad0a735ecc0a953c8b65846d4776c88e (patch)
tree31c70923029efc37d6c4e7e305ca331164b7035e /gdb/thread.c
parent5b834a0a5da717c7d1a8d539623e75f07a474e32 (diff)
downloadfsf-binutils-gdb-34b7e8a6ad0a735ecc0a953c8b65846d4776c88e.zip
fsf-binutils-gdb-34b7e8a6ad0a735ecc0a953c8b65846d4776c88e.tar.gz
fsf-binutils-gdb-34b7e8a6ad0a735ecc0a953c8b65846d4776c88e.tar.bz2
Make single-step breakpoints be per-thread
This patch finally makes each thread have its own set of single-step breakpoints. This paves the way to have multiple threads software single-stepping, though this patch doesn't flip that switch on yet. That'll be done on a subsequent patch. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * breakpoint.c (single_step_breakpoints): Delete global. (insert_single_step_breakpoint): Adjust to store the breakpoint pointer in the current thread. (single_step_breakpoints_inserted, remove_single_step_breakpoints) (cancel_single_step_breakpoints): Delete functions. (breakpoint_has_location_inserted_here): Make extern. (single_step_breakpoint_inserted_here_p): Adjust to walk the breakpoint list. * breakpoint.h (breakpoint_has_location_inserted_here): New declaration. (single_step_breakpoints_inserted, remove_single_step_breakpoints) (cancel_single_step_breakpoints): Remove declarations. * gdbthread.h (struct thread_control_state) <single_step_breakpoints>: New field. (delete_single_step_breakpoints) (thread_has_single_step_breakpoints_set) (thread_has_single_step_breakpoint_here): New declarations. * infrun.c (follow_exec): Also clear the single-step breakpoints. (singlestep_breakpoints_inserted_p, singlestep_ptid) (singlestep_pc): Delete globals. (infrun_thread_ptid_changed): Remove references to removed globals. (resume_cleanups): Delete the current thread's single-step breakpoints. (maybe_software_singlestep): Remove references to removed globals. (resume): Adjust to use thread_has_single_step_breakpoints_set and delete_single_step_breakpoints. (init_wait_for_inferior): Remove references to removed globals. (delete_thread_infrun_breakpoints): Delete the thread's single-step breakpoints too. (delete_just_stopped_threads_infrun_breakpoints): Don't delete single-step breakpoints here. (delete_stopped_threads_single_step_breakpoints): New function. (adjust_pc_after_break): Adjust to use thread_has_single_step_breakpoints_set. (handle_inferior_event): Remove references to removed globals. Use delete_stopped_threads_single_step_breakpoints. (handle_signal_stop): Adjust to per-thread single-step breakpoints. Swap test order to do cheaper tests first. (switch_back_to_stepped_thread): Extend debug output. Remove references to removed globals. * record-full.c (record_full_wait_1): Adjust to per-thread single-step breakpoints. * thread.c (delete_single_step_breakpoints) (thread_has_single_step_breakpoints_set) (thread_has_single_step_breakpoint_here): New functions. (clear_thread_inferior_resources): Also delete the thread's single-step breakpoints.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 82c6760..5a1d2e3 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -117,6 +117,15 @@ delete_exception_resume_breakpoint (struct thread_info *tp)
delete_thread_breakpoint (&tp->control.exception_resume_breakpoint);
}
+/* See gdbthread.h. */
+
+void
+delete_single_step_breakpoints (struct thread_info *tp)
+{
+ if (tp != NULL)
+ delete_thread_breakpoint (&tp->control.single_step_breakpoints);
+}
+
/* Delete the breakpoint pointed at by BP_P at the next stop, if
there's one. */
@@ -130,6 +139,27 @@ delete_at_next_stop (struct breakpoint **bp)
}
}
+/* See gdbthread.h. */
+
+int
+thread_has_single_step_breakpoints_set (struct thread_info *tp)
+{
+ return tp->control.single_step_breakpoints != NULL;
+}
+
+/* See gdbthread.h. */
+
+int
+thread_has_single_step_breakpoint_here (struct thread_info *tp,
+ struct address_space *aspace,
+ CORE_ADDR addr)
+{
+ struct breakpoint *ss_bps = tp->control.single_step_breakpoints;
+
+ return (ss_bps != NULL
+ && breakpoint_has_location_inserted_here (ss_bps, aspace, addr));
+}
+
static void
clear_thread_inferior_resources (struct thread_info *tp)
{
@@ -139,6 +169,7 @@ clear_thread_inferior_resources (struct thread_info *tp)
be stopped at the moment. */
delete_at_next_stop (&tp->control.step_resume_breakpoint);
delete_at_next_stop (&tp->control.exception_resume_breakpoint);
+ delete_at_next_stop (&tp->control.single_step_breakpoints);
delete_longjmp_breakpoint_at_next_stop (tp->num);