#include "expression.h"
#include "frame.h"
#include "language.h"
-#include "wrapper.h"
#include "gdbcmd.h"
#include "block.h"
#include "valprint.h"
char *p;
enum varobj_languages lang;
struct value *value = NULL;
+ volatile struct gdb_exception except;
/* Parse and evaluate the expression, filling in as much of the
variable's data as possible. */
innermost_block = NULL;
/* Wrap the call to parse expression, so we can
return a sensible error. */
- if (!gdb_parse_exp_1 (&p, block, 0, &var->root->exp))
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ var->root->exp = parse_exp_1 (&p, block, 0);
+ }
+
+ if (except.reason < 0)
{
do_cleanups (old_chain);
return NULL;
/* We definitely need to catch errors here.
If evaluate_expression succeeds we got the value we wanted.
But if it fails, we still go on with a call to evaluate_type(). */
- if (!gdb_evaluate_expression (var->root->exp, &value))
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ value = evaluate_expression (var->root->exp);
+ }
+
+ if (except.reason < 0)
{
/* Error getting the value. Try to at least get the
right type. */
struct value *value;
int saved_input_radix = input_radix;
char *s = expression;
+ volatile struct gdb_exception except;
gdb_assert (varobj_editable_p (var));
input_radix = 10; /* ALWAYS reset to decimal temporarily. */
exp = parse_exp_1 (&s, 0, 0);
- if (!gdb_evaluate_expression (exp, &value))
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ value = evaluate_expression (exp);
+ }
+
+ if (except.reason < 0)
{
/* We cannot proceed without a valid expression. */
xfree (exp);
array's content. */
value = coerce_array (value);
- /* The new value may be lazy. gdb_value_assign, or
- rather value_contents, will take care of this.
- If fetching of the new value will fail, gdb_value_assign
- with catch the exception. */
- if (!gdb_value_assign (var->value, value, &val))
+ /* The new value may be lazy. value_assign, or
+ rather value_contents, will take care of this. */
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ val = value_assign (var->value, value);
+ }
+
+ if (except.reason < 0)
return 0;
-
+
/* If the value has changed, record it, so that next -var-update can
report this change. If a variable had a value of '1', we've set it
to '333' and then set again to '1', when -var-update will report this
explicitly asked to compare the new value with the old one. */
intentionally_not_fetched = 1;
}
- else if (!gdb_value_fetch_lazy (value))
+ else
{
- /* Set the value to NULL, so that for the next -var-update,
- we don't try to compare the new value with this value,
- that we couldn't even read. */
- value = NULL;
+ volatile struct gdb_exception except;
+
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ value_fetch_lazy (value);
+ }
+
+ if (except.reason < 0)
+ {
+ /* Set the value to NULL, so that for the next -var-update,
+ we don't try to compare the new value with this value,
+ that we couldn't even read. */
+ value = NULL;
+ }
}
}
{
if (value && *value)
{
- int success = gdb_value_ind (*value, value);
+ volatile struct gdb_exception except;
- if (!success)
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ *value = value_ind (*value);
+ }
+
+ if (except.reason < 0)
*value = NULL;
}
*type = target_type;
struct type *type = get_value_type (parent);
char *parent_expression = NULL;
int was_ptr;
+ volatile struct gdb_exception except;
if (cname)
*cname = NULL;
{
int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
- gdb_value_subscript (value, real_index, cvalue);
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ *cvalue = value_subscript (value, real_index);
+ }
}
if (ctype)
if (cvalue && value)
{
- int success = gdb_value_ind (value, cvalue);
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ *cvalue = value_ind (value);
+ }
- if (!success)
+ if (except.reason < 0)
*cvalue = NULL;
}
if (within_scope)
{
+ volatile struct gdb_exception except;
+
/* We need to catch errors here, because if evaluate
expression fails we want to just return NULL. */
- gdb_evaluate_expression (var->root->exp, &new_val);
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ new_val = evaluate_expression (var->root->exp);
+ }
+
return new_val;
}