From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12183 invoked by alias); 17 Mar 2008 16:44:05 -0000 Received: (qmail 12173 invoked by uid 22791); 17 Mar 2008 16:44:04 -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; Mon, 17 Mar 2008 16:43:47 +0000 Received: (qmail 7750 invoked from network); 17 Mar 2008 16:43:44 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 17 Mar 2008 16:43:44 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: Stop breakpoint commands from poping the target Date: Mon, 17 Mar 2008 16:44:00 -0000 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) References: <200803140802.34377.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_/+p3HG+kWEiyAfd" Message-Id: <200803171643.43888.pedro@codesourcery.com> 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-03/txt/msg00233.txt.bz2 --Boundary-00=_/+p3HG+kWEiyAfd Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 2093 A Friday 14 March 2008 08:15:30, Vladimir Prus wrote: > Pedro Alves wrote: > > This patch goes on top of Vladimir's pending async fixes patch. > > > > commands.exp triggers the problem this patch addresses, in > > async mode. > > > > In that test, we have a watch on a local variable, and then we > > add a command to that watch to print the local variable's > > value. When the variable goes out of scope, gdb prints that, > > and also runs the associated commands with the watch. Since > > the variable is out of scope, and error is thrown. In sync > > targets, the exception just ends the breakpoints command > > processing, and goes on to proceed with the command loop. But in > > async mode, the exception ends up in > > inf-loop.c:inferior_event_handler/INF_REG_EVENT, which considers > > exceptions fatal, and pops the target. The fix is to catch the exception > > earlier. > > > > Imagine the following command list associated with a breakpoint: > > non_existing_command > > info target > > > > As and example, in sync mode, trying to execute > > non_existing_command causes an error that stops the > > interpreting of all subsequent commands, hence info target is > > never executed. The patch installs the same behaviour for > > async targets. > > > > commands.exp passes cleanly with the linux native async patch > > I'll post next. > > Heh, we seem to have a mid-flight collision here -- I've a local > patch moving the call to bpstat_do_actions into > inferior_event_handler. The call you modify, in > command_line_handler_continuation, runs for CLI only and it's > quite possible to have commands on breakpoints even if GDB uses > MI on the top level. > > But that only chances which line of code must be changed, while > this patch is still needed. One tweak though -- I think it's > better to use TRY_CATCH, not catch_exceptions -- it's just > fewer lines. > I have been using this instead now. Should I go ahead while you don't post your patch (if it looks ok)? Or is it coming out soon (, hopefully with a similar fix in)? I'm fine either way. -- Pedro Alves --Boundary-00=_/+p3HG+kWEiyAfd Content-Type: text/x-diff; charset="iso-8859-1"; name="bpstat_do_actions_dont_escape_exception.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bpstat_do_actions_dont_escape_exception.diff" Content-length: 1255 2008-03-17 Pedro Alves * top.c (command_line_handler_continuation): Wrap call to bpstat_do_actions in TRY_CATCH. --- gdb/top.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Index: src/gdb/top.c =================================================================== --- src.orig/gdb/top.c 2008-03-14 22:36:07.000000000 +0000 +++ src/gdb/top.c 2008-03-14 22:46:02.000000000 +0000 @@ -376,7 +376,12 @@ command_line_handler_continuation (struc long time_at_cmd_start = arg->data.longint; long space_at_cmd_start = arg->next->data.longint; - bpstat_do_actions (&stop_bpstat); + volatile struct gdb_exception exception; + TRY_CATCH (exception, RETURN_MASK_ALL) + { + /* Don't propagate errors to inferior_event_handler/INF_REG_EVENT. */ + bpstat_do_actions (&stop_bpstat); + } if (display_time) { @@ -539,7 +544,7 @@ execute_command (char *p, int from_tty) } } - /* Set things up for this function to be compete later, once the + /* Set things up for this function to be finished later, once the execution has completed, if we are doing an execution command, otherwise, just go ahead and finish. */ if (target_can_async_p () && target_executing) --Boundary-00=_/+p3HG+kWEiyAfd--