Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix DW_OP_addr to translate address into virtual address space
[simgrid.git] / testsuite / mc / dwarf.c
index c6b1fe5..c935a12 100644 (file)
@@ -38,9 +38,10 @@ static dw_variable_t find_global_variable_by_name(mc_object_info_t info, const c
 }
 
 static dw_frame_t find_function_by_name(mc_object_info_t info, const char* name) {
-  unsigned int cursor = 0;
+  xbt_dict_cursor_t cursor = 0;
   dw_frame_t subprogram;
-  xbt_dynar_foreach(info->subprograms, cursor, subprogram){
+  char* key;
+  xbt_dict_foreach(info->subprograms, cursor, key, subprogram){
     if(!strcmp(name, subprogram->name))
       return subprogram;
   }
@@ -67,8 +68,8 @@ static void test_local_variable(mc_object_info_t info, const char* function, con
   dw_variable_t var = find_local_variable(subprogram, variable);
   assert(var);
 
-  void* frame_base = mc_find_frame_base(subprogram, cursor);
-  xbt_assert((void*)mc_dwarf_resolve_locations(&var->locations, cursor, frame_base, NULL) == address,
+  void* frame_base = mc_find_frame_base(subprogram, info, cursor);
+  xbt_assert((void*)mc_dwarf_resolve_locations(&var->locations, info, cursor, frame_base, NULL) == address,
     "Bad resolution of local variable %s of %s", variable, function);
 
 }
@@ -101,6 +102,10 @@ int some_local_variable = 0;
 
 typedef struct foo {int i;} s_foo;
 
+static void test_type_by_name(s_foo my_foo) {
+  assert(xbt_dict_get_or_null(mc_binary_info->full_types_by_name, "struct foo"));
+}
+
 int main(int argc, char** argv) {
 
   // xbt_init(&argc, argv);
@@ -131,8 +136,7 @@ int main(int argc, char** argv) {
   test_local_variable(mc_binary_info, "main", "argc", &argc, &cursor);
 
   s_foo my_foo;
-
-  assert(xbt_dict_get_or_null(mc_binary_info->full_types_by_name, "struct foo"));
+  test_type_by_name(my_foo);
 
   _exit(0);
 }