- unsigned cursor1 = 0;
- mc_stack_frame_t stack_frame;
- xbt_dynar_t variables = xbt_dynar_new(sizeof(local_variable_t), local_variable_free_voidp);
-
- xbt_dynar_foreach(stack_frames,cursor1,stack_frame) {
-
- unsigned cursor2 = 0;
- dw_variable_t current_variable;
- xbt_dynar_foreach(stack_frame->frame->variables, cursor2, 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->frame = xbt_strdup(stack_frame->frame_name);
- 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,
- &(stack_frame->unw_cursor), (void*)stack_frame->frame_base, NULL);
+ unsigned cursor = 0;
+ dw_variable_t current_variable;
+ xbt_dynar_foreach(scope->variables, cursor, current_variable) {
+
+ if (!mc_valid_variable(current_variable, scope, (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) {
+ s_mc_location_t location;
+ mc_dwarf_resolve_locations(&location, ¤t_variable->locations,
+ current_variable->object_info,
+ &(stack_frame->unw_cursor),
+ (void *) stack_frame->frame_base,
+ NULL, process_index);
+
+ switch(mc_get_location_type(&location)) {
+ case MC_LOCATION_TYPE_ADDRESS:
+ new_var->address = location.memory_location;
+ break;
+ case MC_LOCATION_TYPE_REGISTER:
+ default:
+ xbt_die("Cannot handle non-address variable");