aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-12-15 18:35:13 -0700
committerTom Tromey <tom@tromey.com>2020-12-15 18:57:07 -0700
commitefd7ff149a42c865cac422e3bafdf386c91c5373 (patch)
tree1ad19dfafeaca30bc40c43adf55e826327ead802 /gdb/value.h
parent2adab65cc07f07a581d57b05dfbc100952fab748 (diff)
downloadgdb-efd7ff149a42c865cac422e3bafdf386c91c5373.zip
gdb-efd7ff149a42c865cac422e3bafdf386c91c5373.tar.gz
gdb-efd7ff149a42c865cac422e3bafdf386c91c5373.tar.bz2
Add expected type parameter to evaluate_expression
While working on the expression rewrite, I found a few spots that called the internal functions of the expression evaluator, just to pass in an expected type. This patch adds a parameter to evaluate_expression so that these functions can avoid this dependency. Regression tested on x86-64 Fedora 28. gdb/ChangeLog 2020-12-15 Tom Tromey <tom@tromey.com> * stap-probe.c (stap_probe::evaluate_argument): Use evaluate_expression. * dtrace-probe.c (dtrace_probe::evaluate_argument): Use evaluate_expression. * value.h (evaluate_expression): Add expect_type parameter. * objc-lang.c (print_object_command): Call evaluate_expression. * eval.c (evaluate_expression): Add expect_type parameter.
Diffstat (limited to 'gdb/value.h')
-rw-r--r--gdb/value.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/value.h b/gdb/value.h
index 25937f3..98012a5 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -905,7 +905,14 @@ extern int using_struct_return (struct gdbarch *gdbarch,
struct value *function,
struct type *value_type);
-extern struct value *evaluate_expression (struct expression *exp);
+/* Evaluate the expression EXP. If set, EXPECT_TYPE is passed to the
+ outermost operation's evaluation. This is ignored by most
+ operations, but may be used, e.g., to determine the type of an
+ otherwise untyped symbol. The caller should not assume that the
+ returned value has this type. */
+
+extern struct value *evaluate_expression (struct expression *exp,
+ struct type *expect_type = nullptr);
extern struct value *evaluate_type (struct expression *exp);