From patchwork Fri Jun 14 14:04:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33114 Received: (qmail 62957 invoked by alias); 14 Jun 2019 14:04:53 -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 62917 invoked by uid 89); 14 Jun 2019 14:04:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit 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; Fri, 14 Jun 2019 14:04:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D9ACD560C1; Fri, 14 Jun 2019 10:04:49 -0400 (EDT) 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 oQKORGAgtFuH; Fri, 14 Jun 2019 10:04:49 -0400 (EDT) Received: from murgatroyd.Home (174-29-48-168.hlrn.qwest.net [174.29.48.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 860A656040; Fri, 14 Jun 2019 10:04:49 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Recognize _ in attribute names Date: Fri, 14 Jun 2019 08:04:44 -0600 Message-Id: <20190614140444.23228-1-tromey@adacore.com> MIME-Version: 1.0 Ada attribute names can contain "_", but the lexer currently does not allow this -- even though the "attributes" array lists some attributes spelled this way. This patch fixes the bug and adds test cases for the existing attributes. This was reviewed off-list by Joel. I'm checking it in. gdb/ChangeLog 2019-06-14 Tom Tromey * ada-lex.l: Allow "_" in attribute names. gdb/testsuite/ChangeLog 2019-06-14 Tom Tromey * gdb.ada/formatted_ref.exp (test_p_x_addr): Check 'unchecked_access and 'unrestricted_access as well. --- gdb/ChangeLog | 4 ++++ gdb/ada-lex.l | 2 +- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.ada/formatted_ref.exp | 18 ++++++++++-------- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index 8ce7c3a99a9..35db478baaa 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -216,7 +216,7 @@ false { return FALSEKEYWORD; } /* ATTRIBUTES */ -{TICK}[a-zA-Z][a-zA-Z]+ { BEGIN INITIAL; return processAttribute (yytext+1); } +{TICK}[a-zA-Z][a-zA-Z_]+ { BEGIN INITIAL; return processAttribute (yytext+1); } /* PUNCTUATION */ diff --git a/gdb/testsuite/gdb.ada/formatted_ref.exp b/gdb/testsuite/gdb.ada/formatted_ref.exp index a0009106d65..9641af87d5e 100644 --- a/gdb/testsuite/gdb.ada/formatted_ref.exp +++ b/gdb/testsuite/gdb.ada/formatted_ref.exp @@ -67,14 +67,16 @@ proc test_p_x { var val addr } { proc test_p_x_addr { var addr } { global gdb_prompt - set test "print/x $var'access" - gdb_test_multiple $test $test { - -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" { - pass $test - } - -re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" { - fail "$test (prints unexpected address)" - } + foreach attr {access unchecked_access unrestricted_access} { + set test "print/x $var'$attr" + gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" { + fail "$test (prints unexpected address)" + } + } } return 0 }