X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fvarobj.c;h=6265b2fa1722b883bc8e21ee15b603b5ec7315b4;hb=0dc327459b19e6765c8fe80957f5c8620611628e;hp=ca43a8f0c19f23d3b4fd698a8cca5015457ed392;hpb=3fabc0163acbdffd9d77d7608604f737fc981399;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/varobj.c b/gdb/varobj.c index ca43a8f0c1..6265b2fa17 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -26,11 +26,11 @@ #include "gdb_regex.h" #include "varobj.h" -#include "vec.h" #include "gdbthread.h" #include "inferior.h" #include "varobj-iter.h" #include "parser-defs.h" +#include "gdbarch.h" #if HAVE_PYTHON #include "python/python.h" @@ -39,7 +39,7 @@ typedef int PyObject; #endif -/* Non-zero if we want to see trace of varobj level stuff. */ +/* See varobj.h. */ unsigned int varobjdebug = 0; static void @@ -309,20 +309,20 @@ varobj_create (const char *objname, } p = expression; - innermost_block.reset (INNERMOST_BLOCK_FOR_SYMBOLS - | INNERMOST_BLOCK_FOR_REGISTERS); + + innermost_block_tracker tracker (INNERMOST_BLOCK_FOR_SYMBOLS + | INNERMOST_BLOCK_FOR_REGISTERS); /* Wrap the call to parse expression, so we can return a sensible error. */ - TRY + try { - var->root->exp = parse_exp_1 (&p, pc, block, 0); + var->root->exp = parse_exp_1 (&p, pc, block, 0, &tracker); } - CATCH (except, RETURN_MASK_ERROR) + catch (const gdb_exception_error &except) { return NULL; } - END_CATCH /* Don't allow variables to be created for types. */ if (var->root->exp->elts[0].opcode == OP_TYPE @@ -336,7 +336,7 @@ varobj_create (const char *objname, var->format = variable_default_display (var.get ()); var->root->valid_block = - var->root->floating ? NULL : innermost_block.block (); + var->root->floating ? NULL : tracker.block (); var->name = expression; /* For a root var, the name and the expr are the same. */ var->path_expr = expression; @@ -363,11 +363,11 @@ varobj_create (const char *objname, /* 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(). */ - TRY + try { value = evaluate_expression (var->root->exp.get ()); } - CATCH (except, RETURN_MASK_ERROR) + catch (const gdb_exception_error &except) { /* Error getting the value. Try to at least get the right type. */ @@ -375,7 +375,6 @@ varobj_create (const char *objname, var->type = value_type (type_only_value); } - END_CATCH if (value != NULL) { @@ -760,7 +759,7 @@ update_dynamic_varobj_children (struct varobj *var, /* Release vitem->value so its lifetime is not bound to the execution of a command. */ if (item != NULL && item->value != NULL) - release_value (item->value).release (); + item->value = release_value (item->value).release (); } if (item == NULL) @@ -1033,17 +1032,16 @@ varobj_set_value (struct varobj *var, const char *expression) input_radix = 10; /* ALWAYS reset to decimal temporarily. */ expression_up exp = parse_exp_1 (&s, 0, 0, 0); - TRY + try { value = evaluate_expression (exp.get ()); } - CATCH (except, RETURN_MASK_ERROR) + catch (const gdb_exception_error &except) { /* We cannot proceed without a valid expression. */ return false; } - END_CATCH /* All types that are editable must also be changeable. */ gdb_assert (varobj_value_is_changeable_p (var)); @@ -1062,16 +1060,15 @@ varobj_set_value (struct varobj *var, const char *expression) /* The new value may be lazy. value_assign, or rather value_contents, will take care of this. */ - TRY + try { val = value_assign (var->value.get (), value); } - CATCH (except, RETURN_MASK_ERROR) + catch (const gdb_exception_error &except) { return false; } - END_CATCH /* 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 @@ -1127,7 +1124,7 @@ install_default_visualizer (struct varobj *var) } if (pretty_printer == Py_None) - pretty_printer.release (); + pretty_printer.reset (nullptr); install_visualizer (var->dynamic, NULL, pretty_printer.release ()); } @@ -1310,19 +1307,18 @@ install_new_value (struct varobj *var, struct value *value, bool initial) else { - TRY + try { value_fetch_lazy (value); } - CATCH (except, RETURN_MASK_ERROR) + catch (const gdb_exception_error &except) { /* 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; } - END_CATCH } } @@ -2138,14 +2134,13 @@ value_of_root_1 (struct varobj **var_handle) /* We need to catch errors here, because if evaluate expression fails we want to just return NULL. */ - TRY + try { new_val = evaluate_expression (var->root->exp.get ()); } - CATCH (except, RETURN_MASK_ERROR) + catch (const gdb_exception_error &except) { } - END_CATCH } return new_val;