Patchwork [RFA,1/3,V4] Remember the case pattern that allowed finding a field of this.

login
register
mail settings
Submitter Pierre Muller
Date Feb. 4, 2015, 11:36 p.m.
Message ID <003001d040d3$7746f340$65d4d9c0$@muller@ics-cnrs.unistra.fr>
Download mbox | patch
Permalink /patch/4919/
State New
Headers show

Comments

Pierre Muller - Feb. 4, 2015, 11:36 p.m.
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.

gdb/ChangeLog entry:

2015-02-04  Pierre Muller  <muller@sourceware.org>
        * p-exp.y (yylex): Reorganize code to return the matched pattern
        for a field of this.
---
 gdb/p-exp.y | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index a1c78bf..101de09 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;
   }
 }