From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31742 invoked by alias); 17 May 2008 11:57:13 -0000 Received: (qmail 31734 invoked by uid 22791); 17 May 2008 11:57:12 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 17 May 2008 11:56:53 +0000 Received: (qmail 1766 invoked from network); 17 May 2008 11:56:51 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 17 May 2008 11:56:51 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [remote.c] kill kill_kludge Date: Sat, 17 May 2008 16:22:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_FgsLI88eOmzR0hd" Message-Id: <200805171256.53676.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-05/txt/msg00529.txt.bz2 --Boundary-00=_FgsLI88eOmzR0hd Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1931 Hi, kill_kludge in remote.c is no longer needed. handle_inferior_event is no longer calling target_kill on a TARGET_WAITKIND_SIGNALLED. case TARGET_WAITKIND_SIGNALLED: if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SIGNALLED\n"); stop_print_frame = 0; stop_signal = ecs->ws.value.sig; target_terminal_ours (); /* Must do this before mourn anyway */ /* Note: By definition of TARGET_WAITKIND_SIGNALLED, we shouldn't reach here unless the inferior is dead. However, for years target_kill() was called here, which hints that fatal signals aren't really fatal on some systems. If that's true, then some changes may be needed. */ target_mourn_inferior (); print_stop_reason (SIGNAL_EXITED, stop_signal); singlestep_breakpoints_inserted_p = 0; stop_stepping (ecs); return; Because of that, the kill_kludge introduces a bug in this sequence: target remote :9999 signal 9 (inferior exits signaled, kill_kludge is step, but target_kill isn't called) (restart stub) target remote :9999 (kill_kludge isn't cleared) kill (kill_kludge is set, so 'k' is not sent to the stub... static void remote_kill (void) { /* For some mysterious reason, wait_for_inferior calls kill instead of mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */ if (kill_kludge) { kill_kludge = 0; target_mourn_inferior (); return; } /* Use catch_errors so the user can quit from gdb even when we aren't on speaking terms with the remote system. */ catch_errors ((catch_errors_ftype *) putpkt, "k", "", RETURN_MASK_ERROR); /* Don't wait for it to die. I'm not really sure it matters whether we do or not. For the existing stubs, kill is a noop. */ target_mourn_inferior (); } -- Pedro Alves --Boundary-00=_FgsLI88eOmzR0hd Content-Type: text/x-diff; charset="utf-8"; name="kill_kill_kludge.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kill_kill_kludge.diff" Content-length: 2371 2008-05-17 Pedro Alves * remote.c (kill_kludge): Delete. (remote_wait, remote_async_wait): Don't set it. (remote_kill, remote_async_kill): Don't do anything with it. --- gdb/remote.c | 24 ------------------------ 1 file changed, 24 deletions(-) Index: src/gdb/remote.c =================================================================== --- src.orig/gdb/remote.c 2008-05-17 12:40:39.000000000 +0100 +++ src/gdb/remote.c 2008-05-17 12:41:36.000000000 +0100 @@ -3320,10 +3320,6 @@ remote_async_terminal_ours (void) remote_async_terminal_ours_p = 1; } -/* If nonzero, ignore the next kill. */ - -int kill_kludge; - void remote_console_output (char *msg) { @@ -3527,7 +3523,6 @@ Packet: '%s'\n"), status->kind = TARGET_WAITKIND_SIGNALLED; status->value.sig = (enum target_signal) (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))); - kill_kludge = 1; goto got_status; case 'O': /* Console output. */ @@ -3754,7 +3749,6 @@ Packet: '%s'\n"), status->kind = TARGET_WAITKIND_SIGNALLED; status->value.sig = (enum target_signal) (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))); - kill_kludge = 1; goto got_status; case 'O': /* Console output. */ @@ -5272,15 +5266,6 @@ getpkt_sane (char **buf, long *sizeof_bu static void remote_kill (void) { - /* For some mysterious reason, wait_for_inferior calls kill instead of - mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */ - if (kill_kludge) - { - kill_kludge = 0; - target_mourn_inferior (); - return; - } - /* Use catch_errors so the user can quit from gdb even when we aren't on speaking terms with the remote system. */ catch_errors ((catch_errors_ftype *) putpkt, "k", "", RETURN_MASK_ERROR); @@ -5298,15 +5283,6 @@ remote_async_kill (void) if (target_is_async_p ()) serial_async (remote_desc, NULL, 0); - /* For some mysterious reason, wait_for_inferior calls kill instead of - mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */ - if (kill_kludge) - { - kill_kludge = 0; - target_mourn_inferior (); - return; - } - /* Use catch_errors so the user can quit from gdb even when we aren't on speaking terms with the remote system. */ catch_errors ((catch_errors_ftype *) putpkt, "k", "", RETURN_MASK_ERROR); --Boundary-00=_FgsLI88eOmzR0hd--