public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Recognize _ in attribute names
Date: Fri, 14 Jun 2019 14:05:00 -0000	[thread overview]
Message-ID: <20190614140537.67442.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4268ec187d401b9b132afa1a13c73e0026a53c5d

commit 4268ec187d401b9b132afa1a13c73e0026a53c5d
Author: Tom Tromey <tromey@adacore.com>
Date:   Fri Jun 7 11:29:36 2019 -0600

    Recognize _ in attribute names
    
    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  <tromey@adacore.com>
    
    	* ada-lex.l: Allow "_" in attribute names.
    
    gdb/testsuite/ChangeLog
    2019-06-14  Tom Tromey  <tromey@adacore.com>
    
    	* gdb.ada/formatted_ref.exp (test_p_x_addr): Check
    	'unchecked_access and 'unrestricted_access as well.

Diff:
---
 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/ChangeLog b/gdb/ChangeLog
index cc0e9fd..9fbfcfa 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2019-06-14  Tom Tromey  <tromey@adacore.com>
 
+	* ada-lex.l: Allow "_" in attribute names.
+
+2019-06-14  Tom Tromey  <tromey@adacore.com>
+
 	PR gdb/24653:
 	* regcache.c (registers_changed): Don't call alloca.
 	* top.c (execute_command): Don't call alloca.
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 8ce7c3a..35db478 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/ChangeLog b/gdb/testsuite/ChangeLog
index bd48c92..9bfd570 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2019-06-14  Tom Tromey  <tromey@adacore.com>
 
+	* gdb.ada/formatted_ref.exp (test_p_x_addr): Check
+	'unchecked_access and 'unrestricted_access as well.
+
+2019-06-14  Tom Tromey  <tromey@adacore.com>
+
 	PR ada/24539:
 	* gdb.ada/vla.exp: Update tests.
 	* gdb.ada/vla/vla.adb (Record_Type): Use No_Component_Reordering
diff --git a/gdb/testsuite/gdb.ada/formatted_ref.exp b/gdb/testsuite/gdb.ada/formatted_ref.exp
index a000910..9641af8 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
 }


                 reply	other threads:[~2019-06-14 14:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190614140537.67442.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).