mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 08:38:10 +08:00
Introduce expression::first_opcode
This adds a new helper method, expression::first_opcode, that extracts the outermost opcode of an expression. This simplifies some patches in the expression rewrite series. Note that this patch requires the earlier patch to avoid manual dissection of OP_TYPE operations. 2020-12-15 Tom Tromey <tom@tromey.com> * varobj.c (varobj_create): Use first_opcode. * value.c (init_if_undefined_command): Use first_opcode. * typeprint.c (whatis_exp): Use first_opcode. * tracepoint.c (validate_actionline): Use first_opcode. (encode_actions_1): Use first_opcode. * stack.c (return_command): Use first_opcode. * expression.h (struct expression) <first_opcode>: New method. * eval.c (parse_and_eval_type): Use first_opcode. * dtrace-probe.c (dtrace_process_dof_probe): Use first_opcode.
This commit is contained in:
@ -687,7 +687,7 @@ validate_actionline (const char *line, struct breakpoint *b)
|
||||
expression_up exp = parse_exp_1 (&p, loc->address,
|
||||
block_for_pc (loc->address), 1);
|
||||
|
||||
if (exp->elts[0].opcode == OP_VAR_VALUE)
|
||||
if (exp->first_opcode () == OP_VAR_VALUE)
|
||||
{
|
||||
if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_CONST)
|
||||
{
|
||||
@ -1383,7 +1383,7 @@ encode_actions_1 (struct command_line *action,
|
||||
block_for_pc (tloc->address),
|
||||
1);
|
||||
|
||||
switch (exp->elts[0].opcode)
|
||||
switch (exp->first_opcode ())
|
||||
{
|
||||
case OP_REGISTER:
|
||||
{
|
||||
|
Reference in New Issue
Block a user