Don't edit bogus sh_link on reading relocatable objects (Oracle fix)
[binutils-gdb.git] / gdb / varobj.c
index 085942c81d72a56337a6bb94ce9cee4346f30345..c448fc82d75b04a144c3757a63415b596cdb0370 100644 (file)
@@ -661,8 +661,7 @@ varobj_get_iterator (struct varobj *var)
     return py_varobj_get_iterator (var, var->dynamic->pretty_printer);
 #endif
 
-  gdb_assert_not_reached (_("\
-requested an iterator from a non-dynamic varobj"));
+  gdb_assert_not_reached ("requested an iterator from a non-dynamic varobj");
 }
 
 static bool
@@ -1844,10 +1843,12 @@ varobj::~varobj ()
     }
 #endif
 
+  /* This must be deleted before the root object, because Python-based
+     destructors need access to some components.  */
+  delete var->dynamic;
+
   if (is_root_p (var))
     delete var->root;
-
-  delete var->dynamic;
 }
 
 /* Return the type of the value that's stored in VAR,
@@ -2207,7 +2208,7 @@ varobj_value_get_print_value (struct value *value,
 
                          thevalue = std::string (s.get ());
                          len = thevalue.size ();
-                         gdbarch = get_type_arch (value_type (value));
+                         gdbarch = value_type (value)->arch ();
                          type = builtin_type (gdbarch)->builtin_char;
 
                          if (!string_print)