1 /* Copyright (c) 2014-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
11 #include "mc_object_info.h"
12 #include "mc_private.h"
19 static void mc_variable_free_voidp(void *t)
21 delete *(simgrid::mc::Variable**)t;
24 static void mc_frame_free_voipd(void** p)
26 delete *(mc_frame_t**)p;
37 this->element_count = 0;
38 this->is_pointer_type = 0;
39 this->subtype = nullptr;
40 this->full_type = nullptr;
47 this->dwarf_offset = 0;
50 this->location_list = {0, nullptr};
51 this->address = nullptr;
52 this->start_scope = 0;
53 this->object_info = nullptr;
58 if (this->location_list.locations)
59 mc_dwarf_location_list_clear(&this->location_list);
67 this->low_pc = nullptr;
68 this->high_pc = nullptr;
69 this->frame_base = {0, nullptr};
70 this->variables = xbt_dynar_new(
71 sizeof(mc_variable_t), mc_variable_free_voidp);
73 this->scopes = xbt_dynar_new(
74 sizeof(mc_frame_t), (void_f_pvoid_t) mc_frame_free_voipd);
75 this->abstract_origin_id = 0;
76 this->object_info = nullptr;
81 mc_dwarf_location_list_clear(&(this->frame_base));
82 xbt_dynar_free(&(this->variables));
83 xbt_dynar_free(&(this->scopes));
88 mc_frame_t ObjectInformation::find_function(const void *ip) const
90 xbt_dynar_t dynar = this->functions_index;
91 mc_function_index_item_t base =
92 (mc_function_index_item_t) xbt_dynar_get_ptr(dynar, 0);
94 int j = xbt_dynar_length(dynar) - 1;
96 int k = i + ((j - i) / 2);
97 if (ip < base[k].low_pc) {
99 } else if (ip >= base[k].high_pc) {
102 return base[k].function;
108 mc_variable_t ObjectInformation::find_variable(const char* name) const
110 unsigned int cursor = 0;
111 mc_variable_t variable;
112 xbt_dynar_foreach(this->global_variables, cursor, variable)
113 if(variable->name == name)