public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix GDB hang with remote after error from resume
@ 2018-01-10 16:56 Andreas Arnez
  2018-01-12 19:11 ` [pushed + testcase] " Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Arnez @ 2018-01-10 16:56 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pedro Alves

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:

	* infrun.c (keep_going_pass_signal): Clear step-over info when
	insert_breakpoints fails.
---
 gdb/infrun.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 7e8d8da..720443b 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7751,6 +7751,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
-- 
2.5.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-01-15 20:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-10 16:56 [PATCH] Fix GDB hang with remote after error from resume Andreas Arnez
2018-01-12 19:11 ` [pushed + testcase] " Pedro Alves
2018-01-15 14:43   ` Andreas Arnez
2018-01-15 14:53     ` Yao Qi
2018-01-15 15:22       ` Andreas Arnez
2018-01-15 16:10         ` Yao Qi
2018-01-15 17:37       ` Edjunior Machado
2018-01-15 18:17         ` Pedro Alves
2018-01-15 20:11           ` Sergio Durigan Junior
2018-01-15 15:18     ` Sergio Durigan Junior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).