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] Fix normal_stop latent bug


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

commit fe7266674110f34eacf2e9d2b308f76d33ce50ed
Author: Pedro Alves <palves@redhat.com>
Date:   Thu Mar 7 16:35:06 2019 +0000

    Fix normal_stop latent bug
    
    TARGET_WAITKIND_NO_RESUMED doesn't have an associated event thread, so
    we shouldn't be referring to inferior_thread() assuming it points to
    one.
    
    This was caught on the multi-target branch, where we always switch to
    no-thread-selected whenever we start handling an event, exactly to
    catch places that incorrectly use "inferior_ptid/inferior_thread()"
    without switching to the right event thread / target.
    
    Here, on the branch, we assert in inferior_thread() because
    TARGET_WAITKIND_NO_RESUMED doesn't have an associated event thread, so
    inferior_ptid is still null_ptid.
    
    gdb/ChangeLog:
    2019-03-07  Pedro Alves  <palves@redhat.com>
    
    	* infrun.c (normal_stop): Also check for
    	TARGET_WAITKIND_NO_RESUMED before referring to inferior_thread().

Diff:
---
 gdb/ChangeLog | 5 +++++
 gdb/infrun.c  | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d3d6e5b..5614e78 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-07  Pedro Alves  <palves@redhat.com>
+
+	* infrun.c (normal_stop): Also check for
+	TARGET_WAITKIND_NO_RESUMED before referring to inferior_thread().
+
 2019-03-07  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* f-lang.c (value_from_host_double): Moved to...
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 61467be..33e5d43 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8146,7 +8146,8 @@ normal_stop (void)
   if (target_has_execution)
     {
       if (last.kind != TARGET_WAITKIND_SIGNALLED
-	  && last.kind != TARGET_WAITKIND_EXITED)
+	  && last.kind != TARGET_WAITKIND_EXITED
+	  && last.kind != TARGET_WAITKIND_NO_RESUMED)
 	/* Delete the breakpoint we stopped at, if it wants to be deleted.
 	   Delete any breakpoint that is to be deleted at the next stop.  */
 	breakpoint_auto_delete (inferior_thread ()->control.stop_bpstat);


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