Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Fix gdb.mi internal_error on killing inferior
@ 2009-05-20 20:28 Jan Kratochvil
  2009-05-20 20:43 ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2009-05-20 20:28 UTC (permalink / raw)
  To: gdb-patches

Hi,

currently GDB crashes on killing multithreaded inferior.  Just it will happen
only on quitting GDB because dejagnu already closed the communication with
GDB.

With the included testcase without the fix it will print:

(gdb) ^M
PASS: gdb.mi/mi-console.exp: finished step over hello
998-target-attach^M
~"A program is being debugged already.  Kill it? (y or n) "y^M
^M
&"Recursive internal problem.\n"^M
ERROR: Error testminating GDB.
testcase ../.././gdb/testsuite/gdb.mi/mi-console.exp completed in 1 seconds



Thanks,
Jan


gdb/
2009-05-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* inflow.c (terminal_ours_1): Return if INFERIOR_PTID is NULL_PTID.

Gdb/testsuite/
2009-05-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/mi-support.exp (mi_uncatched_gdb_exit): Explicitly terminate the
	inferior.

--- gdb/inflow.c	19 May 2009 10:08:19 -0000	1.50
+++ gdb/inflow.c	20 May 2009 20:00:30 -0000
@@ -361,6 +361,9 @@ terminal_ours_1 (int output_only)
   if (terminal_is_ours)
     return;
 
+  if (ptid_equal (inferior_ptid, null_ptid))
+    return;
+
   /* Checking inferior->run_terminal is necessary so that
      if GDB is running in the background, it won't block trying
      to do the ioctl()'s below.  Checking gdb_has_a_terminal
--- gdb/testsuite/lib/mi-support.exp	2 Apr 2009 15:43:10 -0000	1.83
+++ gdb/testsuite/lib/mi-support.exp	20 May 2009 20:00:31 -0000
@@ -61,6 +61,28 @@ proc mi_uncatched_gdb_exit {} {
 
     verbose "Quitting $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS"
 
+    # Test successful termination of the inferior.  It is an optional check,
+    # inferior would get also terminated by -gdb-exit or remote_close below.
+
+    if { [board_info host exists fileid] } {
+	send_gdb "998-target-attach\n";
+	gdb_expect 10 {
+	    -re "y or n" {
+		send_gdb "y\n";
+		exp_continue;
+	    }
+	    -re "Undefined command.*$gdb_prompt $" {
+		send_gdb "quit\n"
+		exp_continue;
+	    }
+	    -re "998\\^error,msg=\"Argument required \\(process-id to attach\\).\".*$gdb_prompt \r\n$" {
+	    }
+	    default {
+		perror "Error terminating the inferior."
+	    }
+	}
+    }
+
     if { [is_remote host] && [board_info host exists fileid] } {
 	send_gdb "999-gdb-exit\n";
 	gdb_expect 10 {


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

end of thread, other threads:[~2009-05-21 16:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-20 20:28 [patch] Fix gdb.mi internal_error on killing inferior Jan Kratochvil
2009-05-20 20:43 ` Pedro Alves
2009-05-20 21:36   ` Jan Kratochvil
2009-05-21  0:41     ` Pedro Alves
2009-05-21  8:44       ` Jan Kratochvil
2009-05-21 16:03         ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox