]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Recognize _ in attribute names
authorTom Tromey <tromey@adacore.com>
Fri, 7 Jun 2019 17:29:36 +0000 (11:29 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 14 Jun 2019 14:02:20 +0000 (08:02 -0600)
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.

gdb/ChangeLog
gdb/ada-lex.l
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/formatted_ref.exp

index cc0e9fd1d07e3c9846171df7732f7ae37cff9ed8..9fbfcfa9b7203b41b183f8114317d4f62b3a5381 100644 (file)
@@ -1,3 +1,7 @@
+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:
index 8ce7c3a99a9cb061d2a0e411074f242b95d5a3c7..35db478baaa30654ac1d6b78b0982565523dd97a 100644 (file)
@@ -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 */
 
index bd48c9212dc1f0caa6102033a110d403d7e14b70..9bfd570f48fb42dd6d1e1c423575b00f7f6af6b2 100644 (file)
@@ -1,3 +1,8 @@
+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:
index a0009106d65cc44c58628f67c8ec8e6eb6b4dd5b..9641af87d5e559057ade54dbb49d6a6a4bf8b709 100644 (file)
@@ -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
 }