In order to allow GPC compiled programs to find fields of structures, I need to change p-exp.y so that the case is only modifed if the symbol is really found.
I also added a check for the standard GPC case which uses names in capitalized form (i.e. first char in uppercase, rest in lowercase).
Note: before this patch, it is impossible to get any field of a record (pascal structure) compiled with GPC.
Should I consider changing 5.1 branch also ?
Changelog:
2001-11-06 Pierre Muller muller@ics.u-strasbg.fr
* p-exp.y (): only change case of expression if symbol is found. Also check for GPC standard name form.
Index: p-exp.y =================================================================== RCS file: /cvs/src/src/gdb/p-exp.y,v retrieving revision 1.6 diff -u -r1.6 p-exp.y --- p-exp.y 2001/06/10 16:25:51 1.6 +++ p-exp.y 2001/11/06 15:27:02 @@ -1306,14 +1306,48 @@ { if ((tmp[i]>='a' && tmp[i]<='z')) tmp[i] -= ('a'-'A'); - /* I am not sure that copy_name gives excatly the same result ! */ + } + sym = lookup_symbol (tmp, expression_context_block, + VAR_NAMESPACE, + &is_a_field_of_this, + (struct symtab **) NULL); + if (sym) + for (i = 0;i <= namelen;i++) + { if ((tokstart[i]>='a' && tokstart[i]<='z')) tokstart[i] -= ('a'-'A'); + } + } + /* Third chance Capitalized (as GPC does) */ + if (!sym) + { + for (i = 0;i <= namelen;i++) + { + if (i==0) + { + if ((tmp[i]>='a' && tmp[i]<='z')) + tmp[i] -= ('a'-'A'); + } + else + if ((tmp[i]>='A' && tmp[i]<='Z')) + tmp[i] -= ('A'-'a'); } - sym = lookup_symbol (tmp, expression_context_block, + sym = lookup_symbol (tmp, expression_context_block, VAR_NAMESPACE, &is_a_field_of_this, (struct symtab **) NULL); + if (sym) + for (i = 0;i <= namelen;i++) + { + if (i==0) + { + if ((tokstart[i]>='a' && tokstart[i]<='z')) + tokstart[i] -= ('a'-'A'); + } + else + if ((tokstart[i]>='A' && tokstart[i]<='Z')) + tokstart[i] -= ('A'-'a'); + } } /* Call lookup_symtab, not lookup_partial_symtab, in case there are no psymtabs (coff, xcoff, or some future change to blow away the
Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99