aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 58e39c7..235f2de 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1375,8 +1375,14 @@ set_command (const char *exp, int from_tty)
{
expression_up expr = parse_expression (exp);
- if (expr->nelts >= 1)
- switch (expr->elts[0].opcode)
+ enum exp_opcode opcode = OP_NULL;
+ if (expr->op != nullptr)
+ opcode = expr->op->opcode ();
+ else if (expr->nelts >= 1)
+ opcode = expr->elts[0].opcode;
+
+ if (opcode != OP_NULL)
+ switch (opcode)
{
case UNOP_PREINCREMENT:
case UNOP_POSTINCREMENT: