aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-01-04 21:59:10 +0000
committerDaniel Jacobowitz <drow@false.org>2007-01-04 21:59:10 +0000
commit5e572bb44adb067e5d4daf50169243b610954061 (patch)
tree0483aa01f18e2d862a4e83a31ac70b9e9cf715b0 /gdb/eval.c
parent74a44383f0a7ceb4976b51dbf0a8709df34b8e24 (diff)
downloadgdb-5e572bb44adb067e5d4daf50169243b610954061.zip
gdb-5e572bb44adb067e5d4daf50169243b610954061.tar.gz
gdb-5e572bb44adb067e5d4daf50169243b610954061.tar.bz2
* Makefile.in (eval.o): Update dependencies.
* eval.c: Include "ui-out.h" and "exceptions.h". (evaluate_subexp_standard): Use TRY_CATCH around value_of_variable. Use value_zero if an error occurs when avoiding side effects. * varobj.c (c_value_of_root): Initialize new_val. * gdb.mi/mi-var-cmd.exp: Add tests for unreadable varobjs.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 1a3d72a..4954e9f 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -37,6 +37,8 @@
#include "block.h"
#include "parser-defs.h"
#include "cp-support.h"
+#include "ui-out.h"
+#include "exceptions.h"
#include "gdb_assert.h"
@@ -469,8 +471,26 @@ evaluate_subexp_standard (struct type *expect_type,
value_rtti_target_type () if we are dealing with a pointer
or reference to a base class and print object is on. */
- return value_of_variable (exp->elts[pc + 2].symbol,
- exp->elts[pc + 1].block);
+ {
+ volatile struct gdb_exception except;
+ struct value *ret = NULL;
+
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ ret = value_of_variable (exp->elts[pc + 2].symbol,
+ exp->elts[pc + 1].block);
+ }
+
+ if (except.reason < 0)
+ {
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol), not_lval);
+ else
+ throw_exception (except);
+ }
+
+ return ret;
+ }
case OP_LAST:
(*pos) += 2;