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/gdb-8.1-branch] Fix GDB hang with remote after error from resume


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

commit a09f837ae221977eec50cc2ded12bd765b3b634a
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date:   Fri Jan 12 18:59:40 2018 +0000

    Fix GDB hang with remote after error from resume
    
    Since this commit --
    
      Fix PR18360 - internal error when using "interrupt -a"
      (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=c65d6b55)
    
    -- the testsuite shows long delays on s390 with native-gdbserver when
    executing certain tests, such as watchpoints.exp.  These hangs have been
    discussed before in the context of buildbot problems, see here:
    
      https://sourceware.org/ml/gdb-patches/2017-12/msg00413.html
    
    The problem can easily be triggered by stopping on a breakpoint, then
    setting impossible watchpoints, and finally doing "continue".  Then, after
    having set the step-over state (in keep_going_pass_signal in infrun.c),
    GDB tries to insert breakpoints and watchpoints into the inferior.  This
    fails, and the "continue" command is aborted.  But the step-over state is
    not cleared in this case, which causes future step-over attempts to be
    skipped since GDB thinks that "we already have an in-line step-over
    operation ongoing" (see start_step_over in infrun.c).  Thus the next
    "continue" just goes on to wait for events from the remote, which will
    never occur.
    
    The problem can also be reproduced on amd64 with native-gdbserver, using
    the following change to watchpoints.exp:
    
     -- >8 --
     --- a/gdb/testsuite/gdb.base/watchpoints.exp
     +++ b/gdb/testsuite/gdb.base/watchpoints.exp
     @@ -61,2 +61,3 @@ with_test_prefix "before inferior start" {
          gdb_test "watch ival3" ".*" ""
     +    gdb_test "watch *(char \[256\] *) main"
    
     -- >8 --
    
    To fix the hang, this patch clears the step-over info when
    insert_breakpoints has failed.  Of course, with native-gdbserver the
    watchpoints.exp test case still causes many FAILs on s390, because
    gdbserver does not support watchpoints for that target.  This is a
    separate issue.
    
    gdb/ChangeLog:
    2018-01-12  Andreas Arnez  <arnez@linux.vnet.ibm.com>
    
    	* infrun.c (keep_going_pass_signal): Clear step-over info when
    	insert_breakpoints fails.

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

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d9c5bfd..167aaf8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-12  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+	* infrun.c (keep_going_pass_signal): Clear step-over info when
+	insert_breakpoints fails.
+
 2018-01-12  Joel Brobecker  <brobecker@adacore.com>
 
 	* version.in: Set GDB version number to 8.0.91.DATE-git.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 7d6aa7d..e1d1123 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7778,6 +7778,7 @@ keep_going_pass_signal (struct execution_control_state *ecs)
 	{
 	  exception_print (gdb_stderr, e);
 	  stop_waiting (ecs);
+	  clear_step_over_info ();
 	  return;
 	}
       END_CATCH


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