summaryrefslogtreecommitdiff
path: root/gdb/expression.h
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2012-03-21 15:16:19 +0000
committerJoel Brobecker <brobecker@gnat.com>2012-03-21 15:16:19 +0000
commit88a05594363f87bf8fa19b0832c3fa96a61cbcf6 (patch)
tree10eb1e4f0e11bc150dd54202ed2c9d9edf1db32c /gdb/expression.h
parent7be9989f3742c1a538e5736c86165e1aa03bc563 (diff)
downloadgdb-88a05594363f87bf8fa19b0832c3fa96a61cbcf6.tar.gz
SEGV during AX eval of OP_DOUBLE (unsupported)
To reproduce the problem, simply try the following with any program: (gdb) maintenance agent-eval 1.0 Critical error handler: process [...] terminated due to access violation (this is on Windows; on GNU/Linux, the libc copes better) The problem is quite simple: gen_expr is given an expression that contains an unrecognized operator (OP_DOUBLE in this case). When that happens, it tries to report an error with a string image of the operator in the error message. Conversion of the opcode into a string is done using op_string which, despite its name, probably is not what the author was looking for. This function returns NULL for a lot of the opcodes, thus triggering the crash. There is a function that corresponds to what we are looking for: expprint.c:op_name. It was static, though, so I made it non-static, and used it from ax-gdb.c:gen_expr. gdb/ChangeLog: * expression.h (op_name): Add declaration. * expprint.c (op_name): Remove declaration. Make non-static. * ax-gdb.c (gen_expr): Use op_name instead of op_string.
Diffstat (limited to 'gdb/expression.h')
-rw-r--r--gdb/expression.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/expression.h b/gdb/expression.h
index be260029985..ace58f2b476 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -137,6 +137,8 @@ extern struct value *evaluate_subexp_standard
extern void print_expression (struct expression *, struct ui_file *);
+extern char *op_name (struct expression *exp, enum exp_opcode opcode);
+
extern char *op_string (enum exp_opcode);
extern void dump_raw_expression (struct expression *,