#include <mc/mc.h>
#include "mc/datatypes.h"
-#include "mc/mc_object_info.h"
-#include "mc/mc_private.h"
-#include "mc/mc_process.h"
+#include "src/mc/mc_object_info.h"
+#include "src/mc/mc_private.h"
-#include "mc/Type.hpp"
-#include "mc/ObjectInformation.hpp"
-#include "mc/Variable.hpp"
+#include "src/mc/Process.hpp"
+#include "src/mc/Type.hpp"
+#include "src/mc/ObjectInformation.hpp"
+#include "src/mc/Variable.hpp"
int test_some_array[4][5][6];
struct some_struct { int first; int second[4][5]; } test_some_struct;
simgrid::mc::Variable* var = find_local_variable(subprogram, variable);
assert(var);
- void* frame_base = mc_find_frame_base(subprogram, info, cursor);
- s_mc_location_t location;
+ void* frame_base = subprogram->frame_base(*cursor);
+ simgrid::dwarf::Location location = simgrid::dwarf::resolve(
+ var->location_list, info, cursor, frame_base, NULL, -1);
- mc_dwarf_resolve_locations(&location,
- &var->location_list, info, cursor, frame_base, NULL, -1);
-
- xbt_assert(mc_get_location_type(&location)==MC_LOCATION_TYPE_ADDRESS,
- "Unexpected location type for variable %s of %s", variable, function);
-
- xbt_assert(location.memory_location == address,
+ xbt_assert(location.in_memory(),
+ "Expected the variable %s of function %s to be in memory",
+ variable, function);
+ xbt_assert(location.address() == address,
"Bad resolution of local variable %s of %s", variable, function);
}
return variable;
}
-static simgrid::mc::Type* find_member(simgrid::mc::ObjectInformation* info, const char* name, simgrid::mc::Type* type)
+static simgrid::mc::Member* find_member(simgrid::mc::Type& type, const char* name)
{
- for (simgrid::mc::Type& member : type->members)
+ for (simgrid::mc::Member& member : type.members)
if(member.name == name)
return &member;
return nullptr;
i = process->binary_info->types.find(var->type_id);
xbt_assert(i != process->binary_info->types.end(), "Missing type");
type = &i->second;
- assert(find_member(process->binary_info.get(), "first", type)->offset() == 0);
- assert(find_member(process->binary_info.get(), "second", type)->offset()
+
+ assert(type);
+ assert(find_member(*type, "first")->offset() == 0);
+ assert(find_member(*type, "second")->offset()
== ((const char*)&test_some_struct.second) - (const char*)&test_some_struct);
unw_context_t context;