This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] More assert checks on reinsert breakpoint


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8376a3cbf73ca8b623db1daa8f9c49fb83ac54bd

commit 8376a3cbf73ca8b623db1daa8f9c49fb83ac54bd
Author: Yao Qi <yao.qi@linaro.org>
Date:   Fri Jun 17 10:25:12 2016 +0100

    More assert checks on reinsert breakpoint
    
    This patch adds more asserts, so the incorrect or sub-optimal
    reinsert breakpoints manipulations (from the tests in the following
    patches) can trigger them.
    
    gdb/gdbserver:
    
    2016-06-17  Yao Qi  <yao.qi@linaro.org>
    
    	* linux-low.c (linux_resume_one_lwp_throw): Assert
    	has_reinsert_breakpoints returns false.
    	* mem-break.c (delete_disabled_breakpoints): Assert
    	bp type isn't reinsert_breakpoint.

Diff:
---
 gdb/gdbserver/ChangeLog   | 7 +++++++
 gdb/gdbserver/linux-low.c | 6 ++++++
 gdb/gdbserver/mem-break.c | 7 ++++++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 70f64ff..c7a9595 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,12 @@
 2016-06-17  Yao Qi  <yao.qi@linaro.org>
 
+	* linux-low.c (linux_resume_one_lwp_throw): Assert
+	has_reinsert_breakpoints returns false.
+	* mem-break.c (delete_disabled_breakpoints): Assert
+	bp type isn't reinsert_breakpoint.
+
+2016-06-17  Yao Qi  <yao.qi@linaro.org>
+
 	* linux-low.c (maybe_hw_step): New function.
 	(linux_resume_one_lwp_throw): Call maybe_hw_step.
 	(finish_step_over): Switch current_thread to lwp temporarily,
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 77c296c..5f025b5 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4237,6 +4237,12 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp,
 
       step = maybe_hw_step (thread);
     }
+  else
+    {
+      /* If the thread isn't doing step-over, there shouldn't be any
+	 reinsert breakpoints.  */
+      gdb_assert (!has_reinsert_breakpoints (proc));
+    }
 
   if (fast_tp_collecting == 1)
     {
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 3313459..c27e803 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -1740,7 +1740,12 @@ delete_disabled_breakpoints (void)
     {
       next = bp->next;
       if (bp->raw->inserted < 0)
-	delete_breakpoint_1 (proc, bp);
+	{
+	  /* If reinsert_breakpoints become disabled, that means the
+	     manipulations (insertion and removal) of them are wrong.  */
+	  gdb_assert (bp->type != reinsert_breakpoint);
+	  delete_breakpoint_1 (proc, bp);
+	}
     }
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]