Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc_dwarf] Continue with a warning on error.
[simgrid.git] / src / mc / inspect / ObjectInformation.cpp
index c463bd304bb9b46eb2331cd93492959a88e476ac..e94f2552d4c133442f4f1815ba23a28b82518d79 100644 (file)
@@ -40,8 +40,10 @@ void* ObjectInformation::base_address() const
   return result;
 }
 
-Frame* ObjectInformation::find_function(const void* ip) const
+Frame* ObjectInformation::find_function(const void* ip)
 {
+  ensure_dwarf_loaded();
+
   /* This is implemented by binary search on a sorted array.
    *
    * We do quite a lot of those so we want this to be cache efficient.
@@ -64,8 +66,10 @@ Frame* ObjectInformation::find_function(const void* ip) const
              : nullptr;
 }
 
-const Variable* ObjectInformation::find_variable(const char* var_name) const
+const Variable* ObjectInformation::find_variable(const char* var_name)
 {
+  ensure_dwarf_loaded();
+
   auto pos = std::lower_bound(this->global_variables.begin(), this->global_variables.end(), var_name,
                               [](auto const& var, const char* name) { return var.name < name; });
   return (pos != this->global_variables.end() && pos->name == var_name) ? &(*pos) : nullptr;
@@ -172,7 +176,7 @@ void find_object_address(std::vector<xbt::VmMap> const& maps, ObjectInformation*
     else if (reg.prot == PROT_READ) {
       xbt_assert(not result->start_ro,
                  "Multiple read-only segments for %s, not supported. Compiling with the following may help: "
-                 "-Wl,-znorelro -Wl,-znoseparate-code",
+                 "-g -Wl,-znorelro -Wl,-znoseparate-code",
                  maps[i].pathname.c_str());
       result->start_ro = (char*)reg.start_addr;
       result->end_ro   = (char*)reg.end_addr;