From patchwork Sat Nov 25 02:05:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 24524 Received: (qmail 24244 invoked by alias); 25 Nov 2017 02:05:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 24223 invoked by uid 89); 25 Nov 2017 02:05:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=sourcing, 5.45 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 25 Nov 2017 02:05:38 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4ACB51164B4; Fri, 24 Nov 2017 21:05:37 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id CIs80hNXGYaE; Fri, 24 Nov 2017 21:05:37 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id D67C21164B0; Fri, 24 Nov 2017 21:05:36 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 0707287442; Fri, 24 Nov 2017 18:05:35 -0800 (PST) Date: Fri, 24 Nov 2017 18:05:35 -0800 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org, Xavier Roirand Subject: Re: [RFA/doco] (Ada) provide the exception message when hitting an exception catchpoint Message-ID: <20171125020534.k4zk7ccpuwnzuspc@adacore.com> References: <1510953646-116765-1-git-send-email-brobecker@adacore.com> <3f9c312c-deba-f6b1-838e-d0cddf244752@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3f9c312c-deba-f6b1-838e-d0cddf244752@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) > +ERROR: tcl error sourcing /home/pedro/gdb/src/gdb/testsuite/gdb.ada/mi_catch_ex.exp. > +ERROR: can't read "exception_name(",exception-message="foo\.adb:[0-9]+ explicit raise)": variable isn't array > + while executing > +"mi_expect_stop "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"$exception_name(\",exception-message=\"$exception_message)?" "foo..." > + (procedure "continue_to_exception" line 17) > + invoked from within > +"continue_to_exception \ > + "CONSTRAINT_ERROR" "foo\\.adb:$decimal explicit raise" \ > + "continue until CE caught by all-exceptions catchpoint"" > + (file "/home/pedro/gdb/src/gdb/testsuite/gdb.ada/mi_catch_ex.exp" line 106) > + invoked from within > +"source /home/pedro/gdb/src/gdb/testsuite/gdb.ada/mi_catch_ex.exp" > + ("uplevel" body line 1) > + invoked from within > +"uplevel #0 source /home/pedro/gdb/src/gdb/testsuite/gdb.ada/mi_catch_ex.exp" > + invoked from within > +"catch "uplevel #0 source $test_file_name"" Grumpf. Sorry about that. I'm not sure why it was working for me before. I was able to reproduce on a different machine, but noticed another error in the process. Attached is a tentative patch. It gives me clean results (15 PASSes). Does it work for you? gdb/testsuite/ChangeLog: * gdb.ada/mi_catch_ex.exp (continue_to_exception): Adjust expected output in gdb_expect call to allow the exception message to be present as well. Fix syntax confusion to avoid TCL thinking that exception_name is an array. Thanks! From 3649f51b60ae1711a2c449f64a1887326ea066c7 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Fri, 24 Nov 2017 17:48:46 -0800 Subject: [PATCH] fix two issues in gdb.ada/mi_catch_ex.exp (re: "exception-message") The following patch introduced a new feature related to Ada exception catchpoints: commit e547c119d043f2ecffb70452020ab9150d083a91 Author: Joel Brobecker Date: Fri Nov 24 17:09:42 2017 -0500 Subject: (Ada) provide the exception message when hitting an exception catchpoint Unfortunately, the patch left 2 errors in gdb.ada/mi_catch_ex.exp, both inside the "continue_to_exception" function: 1. The exception message on the console can include the exception message, and thus this patch adjust the expected output in the corresponding gdb_expect call to allow it; to allow it. 2. There was a TCL syntax confusion in "$exception_name(..." that caused TCL to evaluate "exception_name as an array, rather than as a variable. This patch fixes this by escaping the '(' (and the corresponding closing parenthesis, for consistency). gdb/testsuite/ChangeLog: * gdb.ada/mi_catch_ex.exp (continue_to_exception): Adjust expected output in gdb_expect call to allow the exception message to be present as well. Fix syntax confusion to avoid TCL thinking that exception_name is an array. Tested on x86_64-linux, with: DejaGnu version 1.6 Expect version 5.45 Tcl version 8.6 --- gdb/testsuite/gdb.ada/mi_catch_ex.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex.exp b/gdb/testsuite/gdb.ada/mi_catch_ex.exp index 2ca3b6c38f..2440be56a9 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_ex.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_ex.exp @@ -87,7 +87,7 @@ proc continue_to_exception { exception_name exception_message test } { # Match console stream output. gdb_expect { - -re " $exception_name at $hex in foo " { + -re " $exception_name\( \\($exception_message\\)\)? at $hex in foo " { } timeout { fail "$test (timeout)" @@ -97,7 +97,7 @@ proc continue_to_exception { exception_name exception_message test } { # Now MI stream output. mi_expect_stop \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"$exception_name(\",exception-message=\"$exception_message)?" \ + "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"$exception_name\(\",exception-message=\"$exception_message\)?" \ "foo" "" ".*" ".*" \ ".*" \ $test -- 2.11.0