From: Tom Tromey Date: Fri, 7 Jun 2019 17:29:36 +0000 (-0600) Subject: Recognize _ in attribute names X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4268ec187d401b9b132afa1a13c73e0026a53c5d;p=binutils-gdb.git 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 * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cc0e9fd1d07..9fbfcfa9b72 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2019-06-14 Tom Tromey + + * ada-lex.l: Allow "_" in attribute names. + 2019-06-14 Tom Tromey PR gdb/24653: 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/ChangeLog b/gdb/testsuite/ChangeLog index bd48c9212dc..9bfd570f48f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-06-14 Tom Tromey + + * gdb.ada/formatted_ref.exp (test_p_x_addr): Check + 'unchecked_access and 'unrestricted_access as well. + 2019-06-14 Tom Tromey PR ada/24539: 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 }