aboutsummaryrefslogtreecommitdiff
path: root/gdb
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
commit5b834a0a5da717c7d1a8d539623e75f07a474e32 (patch)
treed02c2842ce42a2e0d5c49b4b897398d11e0c27d0 /gdb
parenta1fd2fa5999a17bc94fa8348326bc75ddb93476c (diff)
downloadgdb-5b834a0a5da717c7d1a8d539623e75f07a474e32.zip
gdb-5b834a0a5da717c7d1a8d539623e75f07a474e32.tar.gz
gdb-5b834a0a5da717c7d1a8d539623e75f07a474e32.tar.bz2
thread.c: cleanup breakpoint deletion
A little refactoring to reduce duplicate code. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * thread.c (delete_thread_breakpoint): New function. (delete_step_resume_breakpoint) (delete_exception_resume_breakpoint): Use it. (delete_at_next_stop): New function. (clear_thread_inferior_resources): Use delete_at_next_stop.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/thread.c49
2 files changed, 37 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 98f7651..e7108ab 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2014-10-15 Pedro Alves <palves@redhat.com>
+ * thread.c (delete_thread_breakpoint): New function.
+ (delete_step_resume_breakpoint)
+ (delete_exception_resume_breakpoint): Use it.
+ (delete_at_next_stop): New function.
+ (clear_thread_inferior_resources): Use delete_at_next_stop.
+
+2014-10-15 Pedro Alves <palves@redhat.com>
+
* breakpoint.c (regular_breakpoint_inserted_here_p): Inline ...
(breakpoint_inserted_here_p): ... here. Remove special case for
software single-step breakpoints.
diff --git a/gdb/thread.c b/gdb/thread.c
index 25538d7..82c6760 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -91,23 +91,42 @@ inferior_thread (void)
return tp;
}
-void
-delete_step_resume_breakpoint (struct thread_info *tp)
+/* Delete the breakpoint pointed at by BP_P, if there's one. */
+
+static void
+delete_thread_breakpoint (struct breakpoint **bp_p)
{
- if (tp && tp->control.step_resume_breakpoint)
+ if (*bp_p != NULL)
{
- delete_breakpoint (tp->control.step_resume_breakpoint);
- tp->control.step_resume_breakpoint = NULL;
+ delete_breakpoint (*bp_p);
+ *bp_p = NULL;
}
}
void
+delete_step_resume_breakpoint (struct thread_info *tp)
+{
+ if (tp != NULL)
+ delete_thread_breakpoint (&tp->control.step_resume_breakpoint);
+}
+
+void
delete_exception_resume_breakpoint (struct thread_info *tp)
{
- if (tp && tp->control.exception_resume_breakpoint)
+ if (tp != NULL)
+ delete_thread_breakpoint (&tp->control.exception_resume_breakpoint);
+}
+
+/* Delete the breakpoint pointed at by BP_P at the next stop, if
+ there's one. */
+
+static void
+delete_at_next_stop (struct breakpoint **bp)
+{
+ if (*bp != NULL)
{
- delete_breakpoint (tp->control.exception_resume_breakpoint);
- tp->control.exception_resume_breakpoint = NULL;
+ (*bp)->disposition = disp_del_at_next_stop;
+ *bp = NULL;
}
}
@@ -118,18 +137,8 @@ clear_thread_inferior_resources (struct thread_info *tp)
but not any user-specified thread-specific breakpoints. We can not
delete the breakpoint straight-off, because the inferior might not
be stopped at the moment. */
- if (tp->control.step_resume_breakpoint)
- {
- tp->control.step_resume_breakpoint->disposition = disp_del_at_next_stop;
- tp->control.step_resume_breakpoint = NULL;
- }
-
- if (tp->control.exception_resume_breakpoint)
- {
- tp->control.exception_resume_breakpoint->disposition
- = disp_del_at_next_stop;
- tp->control.exception_resume_breakpoint = NULL;
- }
+ delete_at_next_stop (&tp->control.step_resume_breakpoint);
+ delete_at_next_stop (&tp->control.exception_resume_breakpoint);
delete_longjmp_breakpoint_at_next_stop (tp->num);