aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-05-04 07:58:00 +0000
committerTristan Gingold <gingold@adacore.com>2012-05-04 07:58:00 +0000
commit52b3699b0be907d005616a7f5542c4bbd44b1f7b (patch)
treee32560ddbb1f4eb27730f592be18933229682210 /gdb/printcmd.c
parenta1b80f44afb3c0417afb610dba1ef24ddb0e8d6e (diff)
downloadgdb-52b3699b0be907d005616a7f5542c4bbd44b1f7b.zip
gdb-52b3699b0be907d005616a7f5542c4bbd44b1f7b.tar.gz
gdb-52b3699b0be907d005616a7f5542c4bbd44b1f7b.tar.bz2
2012-05-04 Tristan Gingold <gingold@adacore.com>
* printcmd.c (set_command): Emit a warning if the expression is not an assignment. testsuite/ 2012-05-04 Tristan Gingold <gingold@adacore.com> * gdb.base/set-noassign.exp: New test.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index d441dfe..79e38f2 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1080,6 +1080,12 @@ set_command (char *exp, int from_tty)
struct cleanup *old_chain =
make_cleanup (free_current_contents, &expr);
+ if (expr->nelts >= 1
+ && expr->elts[0].opcode != BINOP_ASSIGN
+ && expr->elts[0].opcode != BINOP_ASSIGN_MODIFY
+ && expr->elts[0].opcode != BINOP_COMMA)
+ warning (_("Expression is not an assignment (and might have no effect)"));
+
evaluate_expression (expr);
do_cleanups (old_chain);
}