* ax-gdb.c (gen_expr): Handle UNOP_CAST_TYPE, UNOP_MEMVAL_TYPE.
* breakpoint.c (watchpoint_exp_is_const): Handle UNOP_CAST_TYPE, UNOP_REINTERPRET_CAST, UNOP_DYNAMIC_CAST. * c-exp.y (exp): Emit UNOP_MEMVAL_TYPE, UNOP_CAST_TYPE. Update for changes to UNOP_REINTERPRET_CAST, UNOP_DYNAMIC_CAST. Use type_exp production where appropriate. * eval.c (evaluate_subexp_standard) <UNOP_CAST_TYPE>: New case. <UNOP_DYNAMIC_CAST, UNOP_REINTERPRET_CAST>: Update. <UNOP_MEMVAL_TYPE>: New case. (evaluate_subexp_for_address) <UNOP_MEMVAL_TYPE>: New case. (evaluate_subexp_for_sizeof) <UNOP_MEMVAL_TYPE>: New case. * expprint.c (print_subexp_standard) <UNOP_CAST_TYPE>: New case. <UNOP_MEMVAL_TYPE>: New case. (dump_subexp_body_standard) <UNOP_DYNAMIC_CAST, UNOP_REINTERPRET_CAST>: Update. <UNOP_CAST_TYPE, UNOP_MEMVAL_TYPE>: New cases. * parse.c (operator_length_standard) <UNOP_DYNAMIC_CAST, UNOP_REINTERPRET_CAST>: Update. <UNOP_CAST_TYPE, UNOP_MEMVAL_TYPE>: New cases. * stack.c (return_command): Also check for UNOP_CAST_TYPE. * std-operator.def (UNOP_CAST_TYPE, UNOP_MEMVAL_TYPE): New constants.
This commit is contained in:
parent
b1e0c0fa45
commit
9eaf670568
9 changed files with 178 additions and 37 deletions
42
gdb/ax-gdb.c
42
gdb/ax-gdb.c
|
@ -2076,6 +2076,23 @@ gen_expr (struct expression *exp, union exp_element **pc,
|
|||
}
|
||||
break;
|
||||
|
||||
case UNOP_CAST_TYPE:
|
||||
{
|
||||
int offset;
|
||||
struct value *val;
|
||||
struct type *type;
|
||||
|
||||
++*pc;
|
||||
offset = *pc - exp->elts;
|
||||
val = evaluate_subexp (NULL, exp, &offset, EVAL_AVOID_SIDE_EFFECTS);
|
||||
type = value_type (val);
|
||||
*pc = &exp->elts[offset];
|
||||
|
||||
gen_expr (exp, pc, ax, value);
|
||||
gen_cast (ax, value, type);
|
||||
}
|
||||
break;
|
||||
|
||||
case UNOP_MEMVAL:
|
||||
{
|
||||
struct type *type = check_typedef ((*pc)[1].type);
|
||||
|
@ -2094,6 +2111,31 @@ gen_expr (struct expression *exp, union exp_element **pc,
|
|||
}
|
||||
break;
|
||||
|
||||
case UNOP_MEMVAL_TYPE:
|
||||
{
|
||||
int offset;
|
||||
struct value *val;
|
||||
struct type *type;
|
||||
|
||||
++*pc;
|
||||
offset = *pc - exp->elts;
|
||||
val = evaluate_subexp (NULL, exp, &offset, EVAL_AVOID_SIDE_EFFECTS);
|
||||
type = value_type (val);
|
||||
*pc = &exp->elts[offset];
|
||||
|
||||
gen_expr (exp, pc, ax, value);
|
||||
|
||||
/* If we have an axs_rvalue or an axs_lvalue_memory, then we
|
||||
already have the right value on the stack. For
|
||||
axs_lvalue_register, we must convert. */
|
||||
if (value->kind == axs_lvalue_register)
|
||||
require_rvalue (ax, value);
|
||||
|
||||
value->type = type;
|
||||
value->kind = axs_lvalue_memory;
|
||||
}
|
||||
break;
|
||||
|
||||
case UNOP_PLUS:
|
||||
(*pc)++;
|
||||
/* + FOO is equivalent to 0 + FOO, which can be optimized. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue