diff options
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-var-invalidate.exp | 4 | ||||
-rw-r--r-- | gdb/varobj.c | 18 |
2 files changed, 7 insertions, 15 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp index 1b2c68d..3485156 100644 --- a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp +++ b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp @@ -75,8 +75,8 @@ mi_runto_main # Change format of floating variable immediately after reload reveals a # bug where gdb still uses a free'd pointer. mi_gdb_test "-var-set-format float_simple hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"\\\[-1\\\]\"" \ - "set format variable float_simple" + "\\^done,format=\"hexadecimal\",value=\"\\\[3\\\]\"" \ + "set format variable float_simple" # Check local variable is "invalid". mi_gdb_test "-var-update linteger" \ diff --git a/gdb/varobj.c b/gdb/varobj.c index 55a7bd9..d3df608 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -2359,29 +2359,21 @@ all_root_varobjs (gdb::function_view<void (struct varobj *var)> func) static void varobj_re_set_iter (struct varobj *var) { - /* Invalidated globals and floating var must be re-evaluated. */ - if (var->root->global || var->root->floating) + /* Invalidated global varobjs must be re-evaluated. */ + if (!var->root->is_valid && var->root->global) { struct varobj *tmp_var; /* Try to create a varobj with same expression. If we succeed - replace the old varobj, otherwise invalidate it. */ + and have a global replace the old varobj. */ tmp_var = varobj_create (nullptr, var->name.c_str (), (CORE_ADDR) 0, - var->root->floating - ? USE_SELECTED_FRAME : USE_CURRENT_FRAME); - if (tmp_var != nullptr) + USE_CURRENT_FRAME); + if (tmp_var != nullptr && tmp_var->root->global) { - gdb_assert (var->root->floating == tmp_var->root->floating); tmp_var->obj_name = var->obj_name; varobj_delete (var, 0); install_variable (tmp_var); } - else if (var->root->global) - { - /* Only invalidate globals as floating vars might still be valid in - some other frame. */ - var->root->is_valid = false; - } } } |