aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2002-11-19 12:44:43 +0000
committerPierre Muller <muller@sourceware.org>2002-11-19 12:44:43 +0000
commitfd0e9d45dd14af2106351eedf1f5133a5b7a75b8 (patch)
tree287a8b463f0b0e63fc3d85145e3bd162664821a7 /gdb
parent5dec9182230ea01d1dc8a2755719514909058959 (diff)
downloadfsf-binutils-gdb-fd0e9d45dd14af2106351eedf1f5133a5b7a75b8.zip
fsf-binutils-gdb-fd0e9d45dd14af2106351eedf1f5133a5b7a75b8.tar.gz
fsf-binutils-gdb-fd0e9d45dd14af2106351eedf1f5133a5b7a75b8.tar.bz2
2002-11-19 Pierre Muller <muller@ics.u-strasbg.fr>
* p-exp.y (typecast rule): Add automatic dereference of pascal classes if needed. (THIS): Set current_type. Automatically dereference pascal classes. (typebase rule): Add ^typebase recognition.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/p-exp.y38
2 files changed, 42 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 20277ed..190a3e0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2002-11-19 Pierre Muller <muller@ics.u-strasbg.fr>
+
+ * p-exp.y (typecast rule): Add automatic dereference of
+ pascal classes if needed.
+ (THIS): Set current_type.
+ Automatically dereference pascal classes.
+ (typebase rule): Add ^typebase recognition.
+
2002-11-18 Adam Fedor <fedor@gnu.org>
* expprint.c (print_subexp): Handle OP_OBJC_NSSTRING,
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index cf521af..f15c217 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -342,7 +342,15 @@ arglist :
;
exp : type '(' exp ')' %prec UNARY
- { write_exp_elt_opcode (UNOP_CAST);
+ { if (current_type)
+ {
+ /* Allow automatic dereference of classes. */
+ if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
+ && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS)
+ && (TYPE_CODE ($1) == TYPE_CODE_CLASS))
+ write_exp_elt_opcode (UNOP_IND);
+ }
+ write_exp_elt_opcode (UNOP_CAST);
write_exp_elt_type ($1);
write_exp_elt_opcode (UNOP_CAST);
current_type = $1; }
@@ -504,8 +512,28 @@ exp : STRING
/* Object pascal */
exp : THIS
- { write_exp_elt_opcode (OP_THIS);
- write_exp_elt_opcode (OP_THIS); }
+ {
+ struct value * this_val;
+ struct type * this_type;
+ write_exp_elt_opcode (OP_THIS);
+ write_exp_elt_opcode (OP_THIS);
+ /* we need type of this */
+ this_val = value_of_this (0);
+ if (this_val)
+ this_type = this_val->type;
+ else
+ this_type = NULL;
+ if (this_type)
+ {
+ if (TYPE_CODE (this_type) == TYPE_CODE_PTR)
+ {
+ this_type = TYPE_TARGET_TYPE (this_type);
+ write_exp_elt_opcode (UNOP_IND);
+ }
+ }
+
+ current_type = this_type;
+ }
;
/* end of object pascal. */
@@ -693,7 +721,9 @@ type : ptype
;
typebase /* Implements (approximately): (type-qualifier)* type-specifier */
- : TYPENAME
+ : '^' typebase
+ { $$ = lookup_pointer_type ($2); }
+ | TYPENAME
{ $$ = $1.type; }
| STRUCT name
{ $$ = lookup_struct (copy_name ($2),