+static void mc_fill_local_variables_values(mc_stack_frame_t stack_frame, dw_frame_t scope, xbt_dynar_t result) {
+ void* ip = (void*) stack_frame->ip;
+ if(ip < scope->low_pc || ip>= scope->high_pc)
+ return;
+
+ unsigned cursor = 0;
+ dw_variable_t current_variable;
+ xbt_dynar_foreach(scope->variables, cursor, current_variable){
+
+ if(!mc_valid_variable(current_variable, stack_frame->frame, (void*) stack_frame->ip))
+ continue;
+
+ int region_type;
+ if((long)stack_frame->ip > (long)mc_libsimgrid_info->start_exec)
+ region_type = 1;
+ else
+ region_type = 2;
+
+ local_variable_t new_var = xbt_new0(s_local_variable_t, 1);
+ new_var->subprogram = stack_frame->frame;
+ new_var->ip = stack_frame->ip;
+ new_var->name = xbt_strdup(current_variable->name);
+ new_var->type = current_variable->type;
+ new_var->region= region_type;
+
+ /* if(current_variable->address!=NULL) {
+ new_var->address = current_variable->address;
+ } else */
+ if(current_variable->locations.size != 0){
+ new_var->address = (void*) mc_dwarf_resolve_locations(¤t_variable->locations,
+ current_variable->object_info,
+ &(stack_frame->unw_cursor), (void*)stack_frame->frame_base, NULL);
+ }
+
+ xbt_dynar_push(result, &new_var);
+ }
+
+ // Recursive processing of nested scopes:
+ dw_frame_t nested_scope = NULL;
+ xbt_dynar_foreach(scope->scopes, cursor, nested_scope) {
+ mc_fill_local_variables_values(stack_frame, nested_scope, result);
+ }
+}
+