This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
PATCH: p-exp.y uppercasing change
- To: gdb-patches at sources dot redhat dot com
- Subject: PATCH: p-exp.y uppercasing change
- From: Pierre Muller <muller at cerbere dot u-strasbg dot fr>
- Date: Fri, 09 Nov 2001 10:18:29 +0100
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.
This will be committed to both the 5.1 and the main branch.
This patch was first submitted as a RFA
http://sources.redhat.com/ml/gdb-patches/2001-11/msg00079.html
I got several remarks from Andrew, that I
used before applying that patch.
Thanks for your remarks, Andrew!
Changelog:
2001-11-06 Pierre Muller <muller@ics.u-strasbg.fr>
* p-exp.y (yylex): 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 -r1.6 p-exp.y
1302c1302
< /* second chance uppercased ! */
---
> /* second chance uppercased (as Free Pascal does). */
1305c1305
< for (i = 0;i <= namelen;i++)
---
> for (i = 0; i <= namelen; i++)
1307c1307
< if ((tmp[i]>='a' && tmp[i]<='z'))
---
> if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
1309,1311d1308
< /* I am not sure that copy_name gives excatly the same result ! */
< if ((tokstart[i]>='a' && tokstart[i]<='z'))
< tokstart[i] -= ('a'-'A');
1313,1316c1310,1350
< sym = lookup_symbol (tmp, expression_context_block,
< VAR_NAMESPACE,
< &is_a_field_of_this,
< (struct symtab **) NULL);
---
> 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,
> 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');
> }
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
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