X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ce81107755533b85687d863b44b9163108ee6c66..218c42a20c7eaba87e20cfb3eaac5ad8e0d0f739:/teshsuite/mc/dwarf/dwarf.cpp diff --git a/teshsuite/mc/dwarf/dwarf.cpp b/teshsuite/mc/dwarf/dwarf.cpp index d110ac6606..383fbf562d 100644 --- a/teshsuite/mc/dwarf/dwarf.cpp +++ b/teshsuite/mc/dwarf/dwarf.cpp @@ -68,16 +68,14 @@ static void test_local_variable(simgrid::mc::ObjectInformation* info, const char 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; - - 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, + void* frame_base = subprogram->frame_base(*cursor); + simgrid::dwarf::Location location = simgrid::dwarf::resolve( + var->location_list, info, cursor, frame_base, NULL, -1); + + 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); } @@ -100,9 +98,9 @@ static simgrid::mc::Variable* test_global_variable(simgrid::mc::Process* process 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; @@ -146,8 +144,10 @@ int main(int argc, char** argv) 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;