2006-02-16 Fred Fish <fnf@specifix.com>
* eval.c (evaluate_subexp_standard): For OP_TYPE, return a non lval value zero, of the appropriate type, when avoiding side effects. * typeprint.c (ptype_eval): Remove function and declaration. (ptype_command): Simplify to just a call to whatis_exp.
This commit is contained in:
parent
62f3a2ba52
commit
d843c49cbf
3 changed files with 18 additions and 47 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2006-02-16 Fred Fish <fnf@specifix.com>
|
||||||
|
|
||||||
|
* eval.c (evaluate_subexp_standard): For OP_TYPE, return
|
||||||
|
a non lval value zero, of the appropriate type, when avoiding
|
||||||
|
side effects.
|
||||||
|
* typeprint.c (ptype_eval): Remove function and declaration.
|
||||||
|
(ptype_command): Simplify to just a call to whatis_exp.
|
||||||
|
|
||||||
2006-02-15 Paul Brook <paul@codesourcery.com>
|
2006-02-15 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
* arm-tdep.c (arm_skip_prologue, thumb_get_next_pc, arm_get_next_pc):
|
* arm-tdep.c (arm_skip_prologue, thumb_get_next_pc, arm_get_next_pc):
|
||||||
|
|
|
@ -2086,6 +2086,14 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||||
return value_of_local ("self", 1);
|
return value_of_local ("self", 1);
|
||||||
|
|
||||||
case OP_TYPE:
|
case OP_TYPE:
|
||||||
|
/* The value is not supposed to be used. This is here to make it
|
||||||
|
easier to accommodate expressions that contain types. */
|
||||||
|
(*pos) += 2;
|
||||||
|
if (noside == EVAL_SKIP)
|
||||||
|
goto nosideret;
|
||||||
|
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
|
return allocate_value (exp->elts[pc + 1].type);
|
||||||
|
else
|
||||||
error (_("Attempt to use a type name as an expression"));
|
error (_("Attempt to use a type name as an expression"));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -45,8 +45,6 @@ extern void _initialize_typeprint (void);
|
||||||
|
|
||||||
static void ptype_command (char *, int);
|
static void ptype_command (char *, int);
|
||||||
|
|
||||||
static struct type *ptype_eval (struct expression *);
|
|
||||||
|
|
||||||
static void whatis_command (char *, int);
|
static void whatis_command (char *, int);
|
||||||
|
|
||||||
static void whatis_exp (char *, int);
|
static void whatis_exp (char *, int);
|
||||||
|
@ -182,56 +180,13 @@ whatis_command (char *exp, int from_tty)
|
||||||
whatis_exp (exp, -1);
|
whatis_exp (exp, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simple subroutine for ptype_command. */
|
|
||||||
|
|
||||||
static struct type *
|
|
||||||
ptype_eval (struct expression *exp)
|
|
||||||
{
|
|
||||||
if (exp->elts[0].opcode == OP_TYPE)
|
|
||||||
{
|
|
||||||
return (exp->elts[1].type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TYPENAME is either the name of a type, or an expression. */
|
/* TYPENAME is either the name of a type, or an expression. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ptype_command (char *typename, int from_tty)
|
ptype_command (char *typename, int from_tty)
|
||||||
{
|
{
|
||||||
struct type *type;
|
|
||||||
struct expression *expr;
|
|
||||||
struct cleanup *old_chain;
|
|
||||||
|
|
||||||
if (typename == NULL)
|
|
||||||
{
|
|
||||||
/* Print type of last thing in value history. */
|
|
||||||
whatis_exp (typename, 1);
|
whatis_exp (typename, 1);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
expr = parse_expression (typename);
|
|
||||||
old_chain = make_cleanup (free_current_contents, &expr);
|
|
||||||
type = ptype_eval (expr);
|
|
||||||
if (type != NULL)
|
|
||||||
{
|
|
||||||
/* User did "ptype <typename>" */
|
|
||||||
printf_filtered ("type = ");
|
|
||||||
type_print (type, "", gdb_stdout, 1);
|
|
||||||
printf_filtered ("\n");
|
|
||||||
do_cleanups (old_chain);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* User did "ptype <symbolname>" */
|
|
||||||
do_cleanups (old_chain);
|
|
||||||
whatis_exp (typename, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
|
/* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
|
||||||
Used to print data from type structures in a specified type. For example,
|
Used to print data from type structures in a specified type. For example,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue