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

* Re: [patch] Fix gdb.mi internal_error on killing inferior
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2009-05-20 20:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Kratochvil

On Wednesday 20 May 2009 21:27:49, Jan Kratochvil wrote:
> 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
> 

Weird, I don't see this happening.  Why is it that we reach terminal_ours
with null_ptid?  And I think that if this legitimate, we should still
restore our process group, terminal settings and signal handlers.

> 
> 
> 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 {
> 



-- 
Pedro Alves


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

* Re: [patch] Fix gdb.mi internal_error on killing inferior
  2009-05-20 20:43 ` Pedro Alves
@ 2009-05-20 21:36   ` Jan Kratochvil
  2009-05-21  0:41     ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2009-05-20 21:36 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Wed, 20 May 2009 22:43:17 +0200, Pedro Alves wrote:
> Weird, I don't see this happening.

Another reproducer + a backtrace below:
	echo -e '#include <unistd.h>\nint main(void){pause();return 0;}'|gcc -Wall -o pauset -x c -pthread -;echo -e '-gdb-set target-async 1\n-exec-run &\n-target-attach\ny' >cmd;../gdb -nx -i=mi ./pauset <./cmd


> And I think that if this legitimate, we should still
> restore our process group, terminal settings and signal handlers.

That looks right.


Regression tested on x86_64-unknown-linux-gnu (incomplete due to the
gdb.mi/*.exp ERRORs from elsewhere).


Thanks,
Jan



#0  internal_error (file=0xcad6af "inferior.c", line=42, string=0xcad690 "%s: Assertion `%s' failed.") at utils.c:995
#1  0x00000000004884ea in current_inferior () at inferior.c:42
#2  0x0000000000489112 in terminal_ours_1 (output_only=0) at inflow.c:369
#3  0x00000000004890f1 in terminal_ours () at inflow.c:349
#4  0x0000000000576abf in linux_nat_terminal_ours () at linux-nat.c:4400
#5  0x00000000005a9573 in mi_thread_exit (t=0x3472810, silent=0) at .././gdb/mi/mi-interp.c:304
#6  0x0000000000476349 in observer_thread_exit_notification_stub (data=0x5a954c, args_data=0x7fffffffc600) at observer.inc:344
#7  0x0000000000475c06 in generic_observer_notify (subject=0x1c0e530, args=0x7fffffffc600) at observer.c:166
#8  0x00000000004763e4 in observer_notify_thread_exit (t=0x3472810, silent=0) at observer.inc:369
#9  0x000000000063021a in delete_thread_1 (ptid={pid = 23878, lwp = 23878, tid = 0}, silent=0) at thread.c:270
#10 0x000000000063025a in delete_thread (ptid={pid = 23878, lwp = 23878, tid = 0}) at thread.c:282
#11 0x00000000004886ed in delete_thread_of_inferior (tp=0x3472810, data=0x7fffffffc740) at inferior.c:119
#12 0x000000000063037b in iterate_over_threads (callback=0x488655 <delete_thread_of_inferior>, data=0x7fffffffc740) at thread.c:339
#13 0x0000000000488770 in delete_inferior_1 (pid=23878, silent=0) at inferior.c:145
#14 0x00000000004887ca in delete_inferior (pid=23878) at inferior.c:162
#15 0x0000000000658a3d in generic_mourn_inferior () at target.c:2492
#16 0x00000000006fc7cf in inf_ptrace_mourn_inferior (ops=0x1b48fe0) at inf-ptrace.c:206
#17 0x00000000005735f6 in linux_nat_mourn_inferior (ops=0x1b48fe0) at linux-nat.c:3221
#18 0x0000000000657d5f in target_mourn_inferior () at target.c:1941
#19 0x0000000000573599 in linux_nat_kill (ops=0x1b48fe0) at linux-nat.c:3211
#20 0x0000000000654984 in target_kill () at target.c:268
#21 0x0000000000621299 in attach_command (args=0x0, from_tty=0) at infcmd.c:2261
#22 0x000000000059abe1 in do_cfunc (c=0x1b8b910, args=0x0, from_tty=0) at .././gdb/cli/cli-decode.c:67
#23 0x000000000059dc49 in cmd_func (cmd=0x1b8b910, args=0x0, from_tty=0) at .././gdb/cli/cli-decode.c:1734
#24 0x0000000000479979 in execute_command (p=0x3472537 "", from_tty=0) at top.c:441
#25 0x00000000005ac7d3 in mi_execute_cli_command (cmd=0xcdae16 "attach", args_p=1, args=0x34723f0 "") at .././gdb/mi/mi-main.c:1411
#26 0x00000000005ac6bd in mi_cmd_execute (parse=0x3471fc0) at .././gdb/mi/mi-main.c:1371
#27 0x00000000005abf5f in captured_mi_execute_command (uiout=0x1bb5080, data=0x3471fc0) at .././gdb/mi/mi-main.c:1172
#28 0x000000000063326f in catch_exception (uiout=0x1bb5080, func=0x5abe8d <captured_mi_execute_command>, func_args=0x3471fc0, mask=6) at exceptions.c:462
#29 0x00000000005ac1e5 in mi_execute_command (cmd=0x3471f30 "-target-attach", from_tty=1) at .././gdb/mi/mi-main.c:1266
#30 0x00000000005a948c in mi_execute_command_wrapper (cmd=0x3471f30 "-target-attach") at .././gdb/mi/mi-interp.c:251
#31 0x000000000063ba9c in gdb_readline2 (client_data=0x0) at event-top.c:820
#32 0x000000000063b0b7 in stdin_event_handler (error=0, client_data=0x0) at event-top.c:433
#33 0x000000000063974c in handle_file_event (data={ptr = 0x0, integer = 0}) at event-loop.c:812
#34 0x0000000000638e47 in process_event () at event-loop.c:394
#35 0x0000000000638eec in gdb_do_one_event (data=0x0) at event-loop.c:447
#36 0x000000000063343c in catch_errors (func=0x638e55 <gdb_do_one_event>, func_args=0x0, errstring=0xd05528 "", mask=6) at exceptions.c:510
#37 0x0000000000638f4a in start_event_loop () at event-loop.c:483
#38 0x00000000005a94fb in mi_command_loop (mi_version=2) at .././gdb/mi/mi-interp.c:281
#39 0x00000000005a94ac in mi2_command_loop () at .././gdb/mi/mi-interp.c:263
#40 0x0000000000633a45 in current_interp_command_loop () at interps.c:288
#41 0x0000000000471647 in captured_command_loop (data=0x0) at .././gdb/main.c:226
#42 0x000000000063343c in catch_errors (func=0x471636 <captured_command_loop>, func_args=0x0, errstring=0xca7647 "", mask=6) at exceptions.c:510
#43 0x00000000004726bc in captured_main (data=0x7fffffffd120) at .././gdb/main.c:902
#44 0x000000000063343c in catch_errors (func=0x47167b <captured_main>, func_args=0x7fffffffd120, errstring=0xca7647 "", mask=6) at exceptions.c:510
#45 0x00000000004726f2 in gdb_main (args=0x7fffffffd120) at .././gdb/main.c:911
#46 0x0000000000471356 in main (argc=4, argv=0x7fffffffd228) at gdb.c:33



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

	* target.c (generic_mourn_inferior): Remove variables `ptid' and `pid'.
	Call delete_inferior on active INFERIOR_PTID.
	* inferior.c (delete_inferior_1): Clear INFERIOR_PTID if this function
	has just deleted it.

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

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

--- gdb/target.c	19 May 2009 00:23:49 -0000	1.208
+++ gdb/target.c	20 May 2009 21:12:37 -0000
@@ -2481,16 +2481,10 @@ find_target_beneath (struct target_ops *
 void
 generic_mourn_inferior (void)
 {
-  ptid_t ptid;
+  if (!ptid_equal (inferior_ptid, null_ptid))
+    delete_inferior (ptid_get_pid (inferior_ptid));
 
-  ptid = inferior_ptid;
-  inferior_ptid = null_ptid;
-
-  if (!ptid_equal (ptid, null_ptid))
-    {
-      int pid = ptid_get_pid (ptid);
-      delete_inferior (pid);
-    }
+  gdb_assert (ptid_equal (inferior_ptid, null_ptid));
 
   breakpoint_init_inferior (inf_exited);
   registers_changed ();
--- gdb/inferior.c	18 May 2009 00:58:37 -0000	1.8
+++ gdb/inferior.c	20 May 2009 21:08:54 -0000
@@ -153,6 +153,9 @@ delete_inferior_1 (int pid, int silent)
   else
     inferior_list = inf->next;
 
+  if (ptid_get_pid (inferior_ptid) == pid)
+    inferior_ptid = null_ptid;
+
   free_inferior (inf);
 }
 
--- 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

* Re: [patch] Fix gdb.mi internal_error on killing inferior
  2009-05-20 21:36   ` Jan Kratochvil
@ 2009-05-21  0:41     ` Pedro Alves
  2009-05-21  8:44       ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2009-05-21  0:41 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

On Wednesday 20 May 2009 22:34:41, Jan Kratochvil wrote:
> On Wed, 20 May 2009 22:43:17 +0200, Pedro Alves wrote:
> > Weird, I don't see this happening.
> 
> Another reproducer + a backtrace below:
> 	echo -e '#include <unistd.h>\nint main(void){pause();return 0;}'|gcc -Wall -o pauset -x c -pthread -;echo -e '-gdb-set target-async 1\n-exec-run &\n-target-attach\ny' >cmd;../gdb -nx -i=mi ./pauset <./cmd
> 

Thanks.  This one is tripping on 10 year old FIXMEs.  You've started
the target in the background (-exec-run &), meaning that
GDB shouldn't try to set the inferior's terminal modes, yet,
attach->kill ended up calling target_terminal_ours, and
terminal_ours_1 claims that the target got the terminal.

This patches fixes your test above for me.  I'm running
the full testsuite on {sync|async}/{remote|native}, after
having run a few smoke test .exp's and seeing no problem.
Does it work for you?

-- 
Pedro Alves

2009-05-21  Pedro Alves  <pedro@codesourcery.com>

	* linux-nat.c (linux_nat_terminal_inferior)
	(linux_nat_terminal_ours): Don't check sync_execution.
	* remote.c (remote_terminal_inferior, remote_terminal_ours):
	Don't check sync_execution.  Update comments.
	* target.c (target_terminal_inferior): New.
	* target.h (target_terminal_inferior): Delete macro, and declare
	as function.
	* event-top.c (async_disable_stdin): Make idempotent.  Don't give
	the target the terminal here.
	* inflow.c (terminal_ours_1): Don't return early without setting
	`terminal_is_ours'.

---
 gdb/event-top.c |   13 +++++--------
 gdb/inflow.c    |    5 ++---
 gdb/linux-nat.c |   10 +---------
 gdb/remote.c    |   22 ++++++----------------
 gdb/target.c    |   12 ++++++++++++
 gdb/target.h    |    3 +--
 6 files changed, 27 insertions(+), 38 deletions(-)

Index: src/gdb/linux-nat.c
===================================================================
--- src.orig/gdb/linux-nat.c	2009-05-21 00:56:59.000000000 +0100
+++ src/gdb/linux-nat.c	2009-05-21 01:18:04.000000000 +0100
@@ -4366,14 +4366,9 @@ linux_nat_terminal_inferior (void)
       return;
     }
 
-  /* GDB should never give the terminal to the inferior, if the
-     inferior is running in the background (run&, continue&, etc.).
-     This check can be removed when the common code is fixed.  */
-  if (!sync_execution)
-    return;
-
   terminal_inferior ();
 
+  /* Calls to target_terminal_*() are meant to be idempotent.  */
   if (!async_terminal_is_ours)
     return;
 
@@ -4399,9 +4394,6 @@ linux_nat_terminal_ours (void)
      but claiming it sure should.  */
   terminal_ours ();
 
-  if (!sync_execution)
-    return;
-
   if (async_terminal_is_ours)
     return;
 
Index: src/gdb/remote.c
===================================================================
--- src.orig/gdb/remote.c	2009-05-21 00:56:59.000000000 +0100
+++ src/gdb/remote.c	2009-05-21 01:16:00.000000000 +0100
@@ -4078,19 +4078,12 @@ remote_terminal_inferior (void)
     /* Nothing to do.  */
     return;
 
-  /* FIXME: cagney/1999-09-27: Shouldn't need to test for
-     sync_execution here.  This function should only be called when
-     GDB is resuming the inferior in the forground.  A background
-     resume (``run&'') should leave GDB in control of the terminal and
-     consequently should not call this code.  */
-  if (!sync_execution)
-    return;
-  /* FIXME: cagney/1999-09-27: Closely related to the above.  Make
-     calls target_terminal_*() idenpotent. The event-loop GDB talking
-     to an asynchronous target with a synchronous command calls this
-     function from both event-top.c and infrun.c/infcmd.c.  Once GDB
-     stops trying to transfer the terminal to the target when it
-     shouldn't this guard can go away.  */
+  /* FIXME: cagney/1999-09-27: Make calls to target_terminal_*()
+     idempotent.  The event-loop GDB talking to an asynchronous target
+     with a synchronous command calls this function from both
+     event-top.c and infrun.c/infcmd.c.  Once GDB stops trying to
+     transfer the terminal to the target when it shouldn't this guard
+     can go away.  */
   if (!remote_async_terminal_ours_p)
     return;
   delete_file_handler (input_fd);
@@ -4109,9 +4102,6 @@ remote_terminal_ours (void)
     return;
 
   /* See FIXME in remote_terminal_inferior.  */
-  if (!sync_execution)
-    return;
-  /* See FIXME in remote_terminal_inferior.  */
   if (remote_async_terminal_ours_p)
     return;
   cleanup_sigint_signal_handler (NULL);
Index: src/gdb/target.c
===================================================================
--- src.orig/gdb/target.c	2009-05-21 00:56:59.000000000 +0100
+++ src/gdb/target.c	2009-05-21 00:57:28.000000000 +0100
@@ -301,6 +301,18 @@ target_create_inferior (char *exec_file,
 		  "could not find a target to create inferior");
 }
 
+void
+target_terminal_inferior (void)
+{
+  /* A background resume (``run&'') should leave GDB in control of the
+     terminal.  */
+  if (target_is_async_p () && !sync_execution)
+    return;
+
+  /* If GDB is resuming the inferior in the foreground, install
+     inferior's terminal modes.  */
+  (*current_target.to_terminal_inferior) ();
+}
 
 static int
 nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
Index: src/gdb/target.h
===================================================================
--- src.orig/gdb/target.h	2009-05-21 00:56:59.000000000 +0100
+++ src/gdb/target.h	2009-05-21 00:57:28.000000000 +0100
@@ -754,8 +754,7 @@ extern void print_section_info (struct t
 /* Put the inferior's terminal settings into effect.
    This is preparation for starting or resuming the inferior.  */
 
-#define target_terminal_inferior() \
-     (*current_target.to_terminal_inferior) ()
+extern void target_terminal_inferior (void);
 
 /* Put some of our terminal settings into effect,
    enough to get proper results from our output,
Index: src/gdb/event-top.c
===================================================================
--- src.orig/gdb/event-top.c	2009-05-21 00:56:59.000000000 +0100
+++ src/gdb/event-top.c	2009-05-21 00:57:28.000000000 +0100
@@ -458,14 +458,11 @@ async_enable_stdin (void)
 void
 async_disable_stdin (void)
 {
-  sync_execution = 1;
-  push_prompt ("", "", "");
-  /* FIXME: cagney/1999-09-27: At present this call is technically
-     redundant since infcmd.c and infrun.c both already call
-     target_terminal_inferior().  As the terminal handling (in
-     sync/async mode) is refined, the duplicate calls can be
-     eliminated (Here or in infcmd.c/infrun.c). */
-  target_terminal_inferior ();
+  if (!sync_execution)
+    {
+      sync_execution = 1;
+      push_prompt ("", "", "");
+    }
 }
 \f
 
Index: src/gdb/inflow.c
===================================================================
--- src.orig/gdb/inflow.c	2009-05-21 00:57:55.000000000 +0100
+++ src/gdb/inflow.c	2009-05-21 00:57:56.000000000 +0100
@@ -361,6 +361,8 @@ terminal_ours_1 (int output_only)
   if (terminal_is_ours)
     return;
 
+  terminal_is_ours = 1;
+
   /* 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
@@ -371,7 +373,6 @@ terminal_ours_1 (int output_only)
   if (inf->terminal_info->run_terminal != NULL || gdb_has_a_terminal () == 0)
     return;
 
-  if (!terminal_is_ours)
     {
 #ifdef SIGTTOU
       /* Ignore this signal since it will happen when we try to set the
@@ -380,8 +381,6 @@ terminal_ours_1 (int output_only)
 #endif
       int result;
 
-      terminal_is_ours = 1;
-
 #ifdef SIGTTOU
       if (job_control)
 	osigttou = (void (*)()) signal (SIGTTOU, SIG_IGN);


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

* Re: [patch] Fix gdb.mi internal_error on killing inferior
  2009-05-21  0:41     ` Pedro Alves
@ 2009-05-21  8:44       ` Jan Kratochvil
  2009-05-21 16:03         ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2009-05-21  8:44 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Thu, 21 May 2009 02:42:10 +0200, Pedro Alves wrote:
> This patches fixes your test above for me.  I'm running
> the full testsuite on {sync|async}/{remote|native}, after
> having run a few smoke test .exp's and seeing no problem.
> Does it work for you?

Yes, it fixes the problem I did see.  No regressions on my system.


Thanks,
Jan


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

* Re: [patch] Fix gdb.mi internal_error on killing inferior
  2009-05-21  8:44       ` Jan Kratochvil
@ 2009-05-21 16:03         ` Pedro Alves
  0 siblings, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2009-05-21 16:03 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

On Thursday 21 May 2009 09:42:35, Jan Kratochvil wrote:
> On Thu, 21 May 2009 02:42:10 +0200, Pedro Alves wrote:
> > This patches fixes your test above for me.  I'm running
> > the full testsuite on {sync|async}/{remote|native}, after
> > having run a few smoke test .exp's and seeing no problem.
> > Does it work for you?
> 
> Yes, it fixes the problem I did see.  No regressions on my system.

Great, many thanks.  I've checked it in.  My testing looked good too.
With the spurious prompt fixed, running the whole testsuite in async
mode gives the same results as it used to before these breakages.

-- 
Pedro Alves


^ 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