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->address = nullptr;
51 this->start_scope = 0;
52 this->object_info = nullptr;
60 this->low_pc = nullptr;
61 this->high_pc = nullptr;
62 this->variables = xbt_dynar_new(
63 sizeof(mc_variable_t), mc_variable_free_voidp);
65 this->scopes = xbt_dynar_new(
66 sizeof(mc_frame_t), (void_f_pvoid_t) mc_frame_free_voipd);
67 this->abstract_origin_id = 0;
68 this->object_info = nullptr;
73 xbt_dynar_free(&(this->variables));
74 xbt_dynar_free(&(this->scopes));
79 mc_frame_t ObjectInformation::find_function(const void *ip) const
81 xbt_dynar_t dynar = this->functions_index;
82 mc_function_index_item_t base =
83 (mc_function_index_item_t) xbt_dynar_get_ptr(dynar, 0);
85 int j = xbt_dynar_length(dynar) - 1;
87 int k = i + ((j - i) / 2);
88 if (ip < base[k].low_pc) {
90 } else if (ip >= base[k].high_pc) {
93 return base[k].function;
99 mc_variable_t ObjectInformation::find_variable(const char* name) const
101 unsigned int cursor = 0;
102 mc_variable_t variable;
103 xbt_dynar_foreach(this->global_variables, cursor, variable)
104 if(variable->name == name)