Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
[simgrid.git] / src / mc / inspect / LocationList.cpp
index 7bfb61f..18a585d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -8,6 +8,7 @@
 #include "src/mc/inspect/mc_dwarf.hpp"
 
 #include "xbt/asserts.h"
+#include "xbt/log.h"
 #include "xbt/sysdep.h"
 
 #include <cstddef>
@@ -15,8 +16,9 @@
 #include <libunwind.h>
 #include <utility>
 
-namespace simgrid {
-namespace dwarf {
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(mc_dwarf);
+
+namespace simgrid::dwarf {
 
 /** Resolve a location expression */
 Location resolve(simgrid::dwarf::DwarfExpression const& expression, simgrid::mc::ObjectInformation* object_info,
@@ -73,9 +75,10 @@ LocationList location_list(const simgrid::mc::ObjectInformation& info, Dwarf_Att
 
     offset = dwarf_getlocations(&attr, offset, &base, &start, &end, &ops, &len);
 
-    if (offset == 0)
+    if (offset == -1)
+      XBT_WARN("Error while loading location list: %s", dwarf_errmsg(-1));
+    if (offset <= 0)
       break;
-    xbt_assert(offset != -1, "Error while loading location list");
 
     auto base_address = reinterpret_cast<std::uint64_t>(info.base_address());
 
@@ -91,5 +94,4 @@ LocationList location_list(const simgrid::mc::ObjectInformation& info, Dwarf_Att
 
   return locations;
 }
-} // namespace dwarf
-} // namespace simgrid
+} // namespace simgrid::dwarf