diff options
author | Pierre Muller <muller@ics.u-strasbg.fr> | 2015-04-21 22:10:08 +0200 |
---|---|---|
committer | Pierre Muller <muller@ics.u-strasbg.fr> | 2015-04-21 22:10:08 +0200 |
commit | 8aae434443df61440ff5228f5c8fe3e5d4a38798 (patch) | |
tree | 881bcf8df211db467af1d81f22a81d2dab0ff9ae /gdb/p-exp.y | |
parent | 819843c7029916120aa2929f80e0d7276177a7fb (diff) | |
download | gdb-8aae434443df61440ff5228f5c8fe3e5d4a38798.zip gdb-8aae434443df61440ff5228f5c8fe3e5d4a38798.tar.gz gdb-8aae434443df61440ff5228f5c8fe3e5d4a38798.tar.bz2 |
Fix pascal behavior for class fields with testcase
Problem reported as PR pascal/17815
Part 1/3: Remember the case pattern that allowed finding a field of this.
File gdb/p-exp.y modified
This is the fix in the pascal parser (p-exp.y),
to avoid the error that GDB does find normal variables
case insensitively, but not fields of this,
inside a class or object method.
Part 2/3: Add "class" option for pascal compiler
File gdb/testsuite/lib/pascal.exp
This part of the patch series is unchanged.
It adds class option to pascal compiler
which adds the required command line option to
accept pascal class types.
Part 3/3:
New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
Here is an updated version of this test, using Pedro's suggestions.
Test to check that PR 17815 is fixed.
Diffstat (limited to 'gdb/p-exp.y')
-rw-r--r-- | gdb/p-exp.y | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/p-exp.y b/gdb/p-exp.y index c214cf1..9e2dc82 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -1551,7 +1551,7 @@ yylex (void) int is_a_field = 0; int hextype; - + is_a_field_of_this.type = NULL; if (search_field && current_type) is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); if (is_a_field) @@ -1598,15 +1598,20 @@ yylex (void) VAR_DOMAIN, &is_a_field_of_this); } - if (is_a_field) + if (is_a_field || (is_a_field_of_this.type != NULL)) { tempbuf = (char *) realloc (tempbuf, namelen + 1); strncpy (tempbuf, tmp, namelen); tempbuf [namelen] = 0; yylval.sval.ptr = tempbuf; yylval.sval.length = namelen; + yylval.ssym.sym = NULL; free (uptokstart); - return FIELDNAME; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + if (is_a_field) + return FIELDNAME; + else + return NAME; } /* Call lookup_symtab, not lookup_partial_symtab, in case there are no psymtabs (coff, xcoff, or some future change to blow away the @@ -1739,7 +1744,6 @@ yylex (void) free(uptokstart); /* Any other kind of symbol. */ yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; return NAME; } } |