The Ada lexer allows whitespace between the apostrophe and the
attribute text, but processAttribute does not handle this. This patch
fixes the problem and introduces a regression test.
/* ATTRIBUTES */
-{TICK}[a-z][a-z_]+ { BEGIN INITIAL; return processAttribute (yytext+1); }
+{TICK}[a-z][a-z_]+ { BEGIN INITIAL; return processAttribute (yytext); }
/* PUNCTUATION */
static int
processAttribute (const char *str)
{
+ gdb_assert (*str == '\'');
+ ++str;
+ while (isspace (*str))
+ ++str;
+
for (const auto &item : attributes)
if (strcasecmp (str, item.name) == 0)
return item.code;
global gdb_prompt
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)"
+ foreach space {"" " "} {
+ set test "print/x $var'$space$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)"
+ }
}
}
}