From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3851 invoked by alias); 23 Aug 2011 20:36:35 -0000 Received: (qmail 3796 invoked by uid 22791); 23 Aug 2011 20:36:34 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Aug 2011 20:36:15 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7NKaFOr026781 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Aug 2011 16:36:15 -0400 Received: from host1.jankratochvil.net (ovpn-116-42.ams2.redhat.com [10.36.116.42]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7NKaCuI013148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 23 Aug 2011 16:36:14 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p7NKaClp004991 for ; Tue, 23 Aug 2011 22:36:12 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p7NKaCsR004990 for gdb-patches@sourceware.org; Tue, 23 Aug 2011 22:36:12 +0200 Date: Tue, 23 Aug 2011 20:36:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch 3/2] Do not bpstat_clear_actions on throw_exception - async fixes Message-ID: <20110823203612.GA4906@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-08/txt/msg00425.txt.bz2 Hi, while trying to fix the async mode from: Re: [patch 2/2] Do not bpstat_clear_actions on throw_exception #3 http://sourceware.org/ml/gdb-patches/2011-08/msg00424.html I have found some errors are now silent - suppressed - in the async mode. Fix it here. Not going to check in that `gdb_test_no_output "set target-async on"' part as I guess one should run the whole testsuite in async mode as Pedro did for: [WIP/FYI] fix remaining problems with target async http://sourceware.org/ml/gdb-patches/2011-06/msg00158.html Thanks, Jan gdb/ 2011-08-23 Jan Kratochvil * inf-loop.c (fetch_inferior_event_wrapper): Remove declaration. (fetch_inferior_event_error_cleanup): New function, with code from ... (inferior_event_handler): ... here of INF_REG_EVENT, drop the bpstat_clear_actions call, register it by make_cleanup instead, remove catch_errors. Add exception_print in INF_EXEC_COMPLETE. (fetch_inferior_event_wrapper): Remove. --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -30,7 +30,16 @@ #include "gdbthread.h" #include "continuations.h" -static int fetch_inferior_event_wrapper (gdb_client_data client_data); +/* Executed only if fetch_inferior_event throws an exception. */ + +static void +fetch_inferior_event_error_cleanup (void *unused) +{ + do_all_intermediate_continuations (1); + do_all_continuations (1); + async_enable_stdin (); + display_gdb_prompt (0); +} /* General function to handle events in the inferior. So far it just takes care of detecting errors reported by select() or poll(), @@ -47,19 +56,14 @@ inferior_event_handler (enum inferior_event_type event_type, switch (event_type) { case INF_REG_EVENT: - /* Use catch errors for now, until the inner layers of - fetch_inferior_event (i.e. readchar) can return meaningful - error status. If an error occurs while getting an event from - the target, just cancel the current command. */ - if (!catch_errors (fetch_inferior_event_wrapper, - client_data, "", RETURN_MASK_ALL)) - { - bpstat_clear_actions (); - do_all_intermediate_continuations (1); - do_all_continuations (1); - async_enable_stdin (); - display_gdb_prompt (0); - } + /* Catch exceptions for now by pushing the error case to + cleanup_if_error, until the inner layers of fetch_inferior_event (i.e. + readchar) can return meaningful error status. If an error occurs + while getting an event from the target, just cancel the current + command. */ + + make_cleanup (fetch_inferior_event_error_cleanup, NULL); + fetch_inferior_event (client_data); break; case INF_EXEC_COMPLETE: @@ -121,6 +125,7 @@ inferior_event_handler (enum inferior_event_type event_type, { bpstat_do_actions (); } + exception_print (gdb_stderr, e); if (!was_sync && exec_done_display_p @@ -147,10 +152,3 @@ inferior_event_handler (enum inferior_event_type event_type, discard_cleanups (cleanup_if_error); } - -static int -fetch_inferior_event_wrapper (gdb_client_data client_data) -{ - fetch_inferior_event (client_data); - return 1; -} --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -740,6 +740,7 @@ proc error_clears_commands_left {} { } gdb_test_no_output "end" "main commands 2c" + gdb_test_no_output "set target-async on" gdb_run_cmd gdb_test "" "\r\nhook-stop1\r\n.*\r\ncmd1\r\nUndefined command: \"errorcommandxy\"\\. Try \"help\"\\." "cmd1 error"