Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] C++ify Frame
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 20 Jul 2015 10:56:42 +0000 (12:56 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 21 Jul 2015 12:18:31 +0000 (14:18 +0200)
15 files changed:
src/mc/mc_checkpoint.cpp
src/mc/mc_compare.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_dwarf_expression.cpp
src/mc/mc_forward.h
src/mc/mc_hash.cpp
src/mc/mc_location.h
src/mc/mc_object_info.cpp
src/mc/mc_object_info.h
src/mc/mc_process.cpp
src/mc/mc_process.h
src/mc/mc_snapshot.h
src/mc/mc_unw.cpp
src/mc/mcer_ignore.cpp
teshsuite/mc/dwarf/dwarf.cpp

index 0717854..9d38793 100644 (file)
@@ -260,7 +260,7 @@ void MC_find_object_address(std::vector<simgrid::mc::VmMap> const& maps, mc_obje
  *  \param ip    Instruction pointer
  *  \return      true if the variable is valid
  * */
-static bool mc_valid_variable(mc_variable_t var, dw_frame_t scope,
+static bool mc_valid_variable(mc_variable_t var, mc_frame_t scope,
                               const void *ip)
 {
   // The variable is not yet valid:
@@ -271,7 +271,7 @@ static bool mc_valid_variable(mc_variable_t var, dw_frame_t scope,
 }
 
 static void mc_fill_local_variables_values(mc_stack_frame_t stack_frame,
-                                           dw_frame_t scope, int process_index,
+                                           mc_frame_t scope, int process_index,
                                            std::vector<s_local_variable>& result)
 {
   mc_process_t process = &mc_model_checker->process();
@@ -330,7 +330,7 @@ static void mc_fill_local_variables_values(mc_stack_frame_t stack_frame,
   }
 
   // Recursive processing of nested scopes:
-  dw_frame_t nested_scope = NULL;
+  mc_frame_t nested_scope = nullptr;
   xbt_dynar_foreach(scope->scopes, cursor, nested_scope) {
     mc_fill_local_variables_values(stack_frame, nested_scope, process_index, result);
   }
@@ -380,7 +380,7 @@ static std::vector<s_mc_stack_frame_t> MC_unwind_stack_frames(mc_unw_context_t s
 
       // TODO, use real addresses in frame_t instead of fixing it here
 
-      dw_frame_t frame = process->find_function(remote(ip));
+      mc_frame_t frame = process->find_function(remote(ip));
       stack_frame.frame = frame;
 
       if (frame) {
@@ -395,8 +395,8 @@ static std::vector<s_mc_stack_frame_t> MC_unwind_stack_frames(mc_unw_context_t s
       result.push_back(std::move(stack_frame));
 
       /* Stop before context switch with maestro */
-      if (frame != NULL && frame->name != NULL
-          && !strcmp(frame->name, "smx_ctx_sysv_wrapper"))
+      if (frame != nullptr &&
+          frame->name == "smx_ctx_sysv_wrapper")
         break;
 
       int ret = unw_step(&c);
index 5aca919..0314dfc 100644 (file)
@@ -353,9 +353,12 @@ static int compare_local_variables(int process_index,
           || current_var1->ip != current_var2->ip) {
         // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
         XBT_VERB
-            ("Different name of variable (%s - %s) or frame (%s - %s) or ip (%lu - %lu)",
-             current_var1->name.c_str(), current_var2->name.c_str(),
-             current_var1->subprogram->name, current_var2->subprogram->name,
+            ("Different name of variable (%s - %s) "
+             "or frame (%s - %s) or ip (%lu - %lu)",
+             current_var1->name.c_str(),
+             current_var2->name.c_str(),
+             current_var1->subprogram->name.c_str(),
+             current_var2->subprogram->name.c_str(),
              current_var1->ip, current_var2->ip);
         return 1;
       }
@@ -372,9 +375,12 @@ static int compare_local_variables(int process_index,
         // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
         XBT_TRACE3(mc, local_diff, -1, -1, current_var1->name);
         XBT_VERB
-            ("Local variable %s (%p - %p) in frame %s  is different between snapshots",
-             current_var1->name.c_str(), current_var1->address, current_var2->address,
-             current_var1->subprogram->name);
+            ("Local variable %s (%p - %p) in frame %s "
+             "is different between snapshots",
+             current_var1->name.c_str(),
+             current_var1->address,
+             current_var2->address,
+             current_var1->subprogram->name.c_str());
         return res;
       }
       cursor++;
index 7a7c6e5..976264c 100644 (file)
 #include "mc_object_info.h"
 #include "mc_private.h"
 
-static void mc_variable_free(mc_variable_t v);
-static void mc_variable_free_voidp(void *t);
+static void mc_variable_free_voidp(void *t)
+{
+  delete *(simgrid::mc::Variable**)t;
+}
+
+static void mc_frame_free(void* frame)
+{
+  delete (simgrid::mc::Frame*)frame;
+}
 
 static void MC_dwarf_register_global_variable(mc_object_info_t info, mc_variable_t variable);
-static void MC_register_variable(mc_object_info_t info, dw_frame_t frame, mc_variable_t variable);
-static void MC_dwarf_register_non_global_variable(mc_object_info_t info, dw_frame_t frame, mc_variable_t variable);
-static void MC_dwarf_register_variable(mc_object_info_t info, dw_frame_t frame, mc_variable_t variable);
+static void MC_register_variable(mc_object_info_t info, mc_frame_t frame, mc_variable_t variable);
+static void MC_dwarf_register_non_global_variable(mc_object_info_t info, mc_frame_t frame, mc_variable_t variable);
+static void MC_dwarf_register_variable(mc_object_info_t info, mc_frame_t frame, mc_variable_t variable);
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_dwarf, mc, "DWARF processing");
 
@@ -64,13 +71,13 @@ static uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit);
  *  \param frame containg frame if any
  */
 static void MC_dwarf_handle_die(mc_object_info_t info, Dwarf_Die * die,
-                                Dwarf_Die * unit, dw_frame_t frame,
+                                Dwarf_Die * unit, mc_frame_t frame,
                                 const char *ns);
 
 /** \brief Process a type DIE
  */
 static void MC_dwarf_handle_type_die(mc_object_info_t info, Dwarf_Die * die,
-                                     Dwarf_Die * unit, dw_frame_t frame,
+                                     Dwarf_Die * unit, mc_frame_t frame,
                                      const char *ns);
 
 /** \brief Calls MC_dwarf_handle_die on all childrend of the given die
@@ -81,7 +88,7 @@ static void MC_dwarf_handle_type_die(mc_object_info_t info, Dwarf_Die * die,
  *  \param frame containg frame if any
  */
 static void MC_dwarf_handle_children(mc_object_info_t info, Dwarf_Die * die,
-                                     Dwarf_Die * unit, dw_frame_t frame,
+                                     Dwarf_Die * unit, mc_frame_t frame,
                                      const char *ns);
 
 /** \brief Handle a variable (DW_TAG_variable or other)
@@ -92,7 +99,7 @@ static void MC_dwarf_handle_children(mc_object_info_t info, Dwarf_Die * die,
  *  \param frame containg frame if any
  */
 static void MC_dwarf_handle_variable_die(mc_object_info_t info, Dwarf_Die * die,
-                                         Dwarf_Die * unit, dw_frame_t frame,
+                                         Dwarf_Die * unit, mc_frame_t frame,
                                          const char *ns);
 
 /** \brief Get the DW_TAG_type of the DIE
@@ -601,7 +608,7 @@ static void MC_dwarf_add_members(mc_object_info_t info, Dwarf_Die * die,
  *  \return MC representation of the type
  */
 static mc_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die * die,
-                                      Dwarf_Die * unit, dw_frame_t frame,
+                                      Dwarf_Die * unit, mc_frame_t frame,
                                       const char *ns)
 {
 
@@ -685,7 +692,7 @@ static mc_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die * die,
 }
 
 static void MC_dwarf_handle_type_die(mc_object_info_t info, Dwarf_Die * die,
-                                     Dwarf_Die * unit, dw_frame_t frame,
+                                     Dwarf_Die * unit, mc_frame_t frame,
                                      const char *ns)
 {
   mc_type_t type = MC_dwarf_die_to_type(info, die, unit, frame, ns);
@@ -702,7 +709,7 @@ static void MC_dwarf_handle_type_die(mc_object_info_t info, Dwarf_Die * die,
 static int mc_anonymous_variable_index = 0;
 
 static mc_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die * die,
-                                        Dwarf_Die * unit, dw_frame_t frame,
+                                        Dwarf_Die * unit, mc_frame_t frame,
                                         const char *ns)
 {
   // Skip declarations:
@@ -812,7 +819,7 @@ static mc_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die * die,
 }
 
 static void MC_dwarf_handle_variable_die(mc_object_info_t info, Dwarf_Die * die,
-                                         Dwarf_Die * unit, dw_frame_t frame,
+                                         Dwarf_Die * unit, mc_frame_t frame,
                                          const char *ns)
 {
   mc_variable_t variable =
@@ -822,14 +829,8 @@ static void MC_dwarf_handle_variable_die(mc_object_info_t info, Dwarf_Die * die,
   MC_dwarf_register_variable(info, frame, variable);
 }
 
-static void mc_frame_free_voipd(dw_frame_t * p)
-{
-  mc_frame_free(*p);
-  *p = NULL;
-}
-
 static void MC_dwarf_handle_scope_die(mc_object_info_t info, Dwarf_Die * die,
-                                      Dwarf_Die * unit, dw_frame_t parent_frame,
+                                      Dwarf_Die * unit, mc_frame_t parent_frame,
                                       const char *ns)
 {
   // TODO, handle DW_TAG_type/DW_TAG_location for DW_TAG_with_stmt
@@ -844,7 +845,7 @@ static void MC_dwarf_handle_scope_die(mc_object_info_t info, Dwarf_Die * die,
   if (klass == mc_tag_scope)
     xbt_assert(parent_frame, "No parent scope for this scope");
 
-  dw_frame_t frame = xbt_new0(s_dw_frame_t, 1);
+  mc_frame_t frame = new simgrid::mc::Frame();
 
   frame->tag = tag;
   frame->id = dwarf_dieoffset(die);
@@ -852,8 +853,10 @@ static void MC_dwarf_handle_scope_die(mc_object_info_t info, Dwarf_Die * die,
 
   if (klass == mc_tag_subprogram) {
     const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
-    frame->name =
-        ns ? bprintf("%s::%s", ns, name) : xbt_strdup(name);
+    if(ns)
+      frame->name  = std::string(ns) + "::" + name;
+    else
+      frame->name = name;
   }
 
   frame->abstract_origin_id =
@@ -864,10 +867,6 @@ static void MC_dwarf_handle_scope_die(mc_object_info_t info, Dwarf_Die * die,
   // See DWARF4 spec 7.5
   void *base = info->base_address();
 
-  // Variables are filled in the (recursive) call of MC_dwarf_handle_children:
-  frame->variables =
-      xbt_dynar_new(sizeof(mc_variable_t), mc_variable_free_voidp);
-
   // TODO, support DW_AT_ranges
   uint64_t low_pc = MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc);
   frame->low_pc = low_pc ? ((char *) base) + low_pc : 0;
@@ -911,9 +910,6 @@ static void MC_dwarf_handle_scope_die(mc_object_info_t info, Dwarf_Die * die,
                                   &attr_frame_base);
   }
 
-  frame->scopes =
-      xbt_dynar_new(sizeof(dw_frame_t), (void_f_pvoid_t) mc_frame_free_voipd);
-
   // Register it:
   if (klass == mc_tag_subprogram) {
     char *key = bprintf("%" PRIx64, (uint64_t) frame->id);
@@ -928,7 +924,7 @@ static void MC_dwarf_handle_scope_die(mc_object_info_t info, Dwarf_Die * die,
 
 static void mc_dwarf_handle_namespace_die(mc_object_info_t info,
                                           Dwarf_Die * die, Dwarf_Die * unit,
-                                          dw_frame_t frame,
+                                          mc_frame_t frame,
                                           const char *ns)
 {
   const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
@@ -941,7 +937,7 @@ static void mc_dwarf_handle_namespace_die(mc_object_info_t info,
 }
 
 static void MC_dwarf_handle_children(mc_object_info_t info, Dwarf_Die * die,
-                                     Dwarf_Die * unit, dw_frame_t frame,
+                                     Dwarf_Die * unit, mc_frame_t frame,
                                      const char *ns)
 {
   // For each child DIE:
@@ -954,7 +950,7 @@ static void MC_dwarf_handle_children(mc_object_info_t info, Dwarf_Die * die,
 }
 
 static void MC_dwarf_handle_die(mc_object_info_t info, Dwarf_Die * die,
-                                Dwarf_Die * unit, dw_frame_t frame,
+                                Dwarf_Die * unit, mc_frame_t frame,
                                 const char *ns)
 {
   int tag = dwarf_tag(die);
@@ -1029,25 +1025,11 @@ void MC_dwarf_get_variables(mc_object_info_t info)
 
 /************************** Free functions *************************/
 
-void mc_frame_free(dw_frame_t frame)
-{
-  xbt_free(frame->name);
-  mc_dwarf_location_list_clear(&(frame->frame_base));
-  xbt_dynar_free(&(frame->variables));
-  xbt_dynar_free(&(frame->scopes));
-  xbt_free(frame);
-}
-
 static void dw_type_free(mc_type_t t)
 {
   delete t;
 }
 
-void mc_variable_free_voidp(void *t)
-{
-  delete *(simgrid::mc::Variable**)t;
-}
-
 // ***** object_info
 
 namespace simgrid {
@@ -1065,7 +1047,7 @@ ObjectInformation::ObjectInformation()
   this->end_rw = nullptr;
   this->start_ro = nullptr;
   this->end_ro = nullptr;
-  this->subprograms = xbt_dict_new_homogeneous((void (*)(void *)) mc_frame_free);
+  this->subprograms = xbt_dict_new_homogeneous(mc_frame_free);
   this->global_variables =
       xbt_dynar_new(sizeof(mc_variable_t), mc_variable_free_voidp);
   this->types = xbt_dict_new_homogeneous((void (*)(void *)) dw_type_free);
@@ -1133,7 +1115,7 @@ static void MC_make_functions_index(mc_object_info_t info)
   xbt_dynar_t index = xbt_dynar_new(sizeof(s_mc_function_index_item_t), NULL);
 
   // Populate the array:
-  dw_frame_t frame = NULL;
+  mc_frame_t frame = NULL;
   xbt_dict_cursor_t cursor;
   char *key;
   xbt_dict_foreach(info->subprograms, cursor, key, frame) {
@@ -1168,18 +1150,17 @@ static void MC_post_process_variables(mc_object_info_t info)
         info->types, variable->type_id.c_str());
 }
 
-static void mc_post_process_scope(mc_object_info_t info, dw_frame_t scope)
+static void mc_post_process_scope(mc_object_info_t info, mc_frame_t scope)
 {
 
   if (scope->tag == DW_TAG_inlined_subroutine) {
 
     // Attach correct namespaced name in inlined subroutine:
     char *key = bprintf("%" PRIx64, (uint64_t) scope->abstract_origin_id);
-    dw_frame_t abstract_origin = (dw_frame_t) xbt_dict_get_or_null(info->subprograms, key);
+    mc_frame_t abstract_origin = (mc_frame_t) xbt_dict_get_or_null(info->subprograms, key);
     xbt_assert(abstract_origin, "Could not lookup abstract origin %s", key);
     xbt_free(key);
-    scope->name = xbt_strdup(abstract_origin->name);
-
+    scope->name = abstract_origin->name;
   }
 
   // Direct:
@@ -1191,7 +1172,7 @@ static void mc_post_process_scope(mc_object_info_t info, dw_frame_t scope)
         info->types, variable->type_id.c_str());
 
   // Recursive post-processing of nested-scopes:
-  dw_frame_t nested_scope = nullptr;
+  mc_frame_t nested_scope = nullptr;
   xbt_dynar_foreach(scope->scopes, cursor, nested_scope)
       mc_post_process_scope(info, nested_scope);
 
@@ -1201,7 +1182,7 @@ static void MC_post_process_functions(mc_object_info_t info)
 {
   xbt_dict_cursor_t cursor;
   char *key;
-  dw_frame_t subprogram = NULL;
+  mc_frame_t subprogram = NULL;
   xbt_dict_foreach(info->subprograms, cursor, key, subprogram) {
     mc_post_process_scope(info, subprogram);
   }
@@ -1328,7 +1309,7 @@ void MC_dwarf_register_global_variable(mc_object_info_t info,
 }
 
 void MC_dwarf_register_non_global_variable(mc_object_info_t info,
-                                           dw_frame_t frame,
+                                           mc_frame_t frame,
                                            mc_variable_t variable)
 {
   xbt_assert(frame, "Frame is NULL");
@@ -1340,7 +1321,7 @@ void MC_dwarf_register_non_global_variable(mc_object_info_t info,
   // TODO, else ?
 }
 
-void MC_dwarf_register_variable(mc_object_info_t info, dw_frame_t frame,
+void MC_dwarf_register_variable(mc_object_info_t info, mc_frame_t frame,
                                 mc_variable_t variable)
 {
   if (variable->global)
index db02993..b96efb9 100644 (file)
@@ -506,7 +506,7 @@ void mc_dwarf_resolve_locations(mc_location_t location,
  *  \param frame
  *  \param unw_cursor
  */
-void *mc_find_frame_base(dw_frame_t frame, mc_object_info_t object_info,
+void *mc_find_frame_base(mc_frame_t frame, mc_object_info_t object_info,
                          unw_cursor_t * unw_cursor)
 {
   s_mc_location_t location;
index 2cc0c34..e144f46 100644 (file)
@@ -25,6 +25,7 @@ class Snapshot;
 class ObjectInformation;
 class Type;
 class Variable;
+class Frame;
 
 }
 }
@@ -37,6 +38,7 @@ typedef ::simgrid::mc::Snapshot s_mc_snapshot_t;
 typedef ::simgrid::mc::ObjectInformation s_mc_object_info_t;
 typedef ::simgrid::mc::Type s_mc_type_t;
 typedef ::simgrid::mc::Variable s_mc_variable_t;
+typedef ::simgrid::mc::Frame s_mc_frame_t;
 
 #else
 
@@ -48,12 +50,10 @@ typedef struct _s_mc_snapshot_t s_mc_snapshot_t;
 typedef struct _s_mc_object_info_t s_mc_object_info_t;
 typedef struct _s_mc_type_t s_mc_type_t;
 typedef struct _s_mc_variable_t s_mc_variable_t;
+typedef struct _s_mc_frame_t s_mc_frame_t;
 
 #endif
 
-typedef struct s_memory_map s_memory_map_t, *memory_map_t;
-typedef struct s_dw_frame s_dw_frame_t, *dw_frame_t;
-
 typedef s_mc_pages_store_t *mc_pages_store_t;
 typedef s_mc_model_checker_t *mc_model_checker_t;
 typedef s_mc_address_space_t *mc_address_space_t;
@@ -62,6 +62,9 @@ typedef s_mc_snapshot_t *mc_snapshot_t;
 typedef s_mc_object_info_t *mc_object_info_t;
 typedef s_mc_type_t *mc_type_t;
 typedef s_mc_variable_t *mc_variable_t;
+typedef s_mc_frame_t *mc_frame_t;
+
+typedef struct s_memory_map s_memory_map_t, *memory_map_t;
 
 SG_BEGIN_DECL()
 extern mc_model_checker_t mc_model_checker;
index 4b7f246..ea71646 100644 (file)
@@ -242,7 +242,7 @@ static void mc_hash_object_globals(hash_type * hash, mc_hashing_state * state,
 
 static void mc_hash_stack_frame(mc_hash_t * hash,
                                 mc_object_info_t info,
-                                unw_cursor_t * unw_cursor, dw_frame_t frame,
+                                unw_cursor_t * unw_cursor, mc_frame_t frame,
                                 char *frame_pointer, mc_hashing_state * state)
 {
 
index 1bafe6c..5d884da 100644 (file)
@@ -121,7 +121,7 @@ MC_SHOULD_BE_INTERNAL int mc_dwarf_execute_expression(
   size_t n, const Dwarf_Op* ops, mc_expression_state_t state);
 
 MC_SHOULD_BE_INTERNAL void* mc_find_frame_base(
-  dw_frame_t frame, mc_object_info_t object_info, unw_cursor_t* unw_cursor);
+  mc_frame_t frame, mc_object_info_t object_info, unw_cursor_t* unw_cursor);
 
 SG_END_DECL()
 
index b05c69e..e88aee0 100644 (file)
 namespace simgrid {
 namespace mc {
 
+// Free functions
+
+static void mc_variable_free_voidp(void *t)
+{
+  delete *(simgrid::mc::Variable**)t;
+}
+
+static void mc_frame_free_voipd(void** p)
+{
+  delete *(mc_frame_t**)p;
+  *p = nullptr;
+}
+
 // Type
 
 Type::Type()
@@ -46,9 +59,33 @@ Variable::~Variable()
     mc_dwarf_location_list_clear(&this->location_list);
 }
 
+// Frame
+
+Frame::Frame()
+{
+  this->tag = 0;
+  this->low_pc = nullptr;
+  this->high_pc = nullptr;
+  this->frame_base = {0, nullptr};
+  this->variables = xbt_dynar_new(
+    sizeof(mc_variable_t), mc_variable_free_voidp);
+  this->id = 0;
+  this->scopes = xbt_dynar_new(
+    sizeof(mc_frame_t), (void_f_pvoid_t) mc_frame_free_voipd);
+  this->abstract_origin_id = 0;
+  this->object_info = nullptr;
+}
+
+Frame::~Frame()
+{
+  mc_dwarf_location_list_clear(&(this->frame_base));
+  xbt_dynar_free(&(this->variables));
+  xbt_dynar_free(&(this->scopes));
+}
+
 // ObjectInformations
 
-dw_frame_t ObjectInformation::find_function(const void *ip) const
+mc_frame_t ObjectInformation::find_function(const void *ip) const
 {
   xbt_dynar_t dynar = this->functions_index;
   mc_function_index_item_t base =
index dbe815f..c44f0ba 100644 (file)
@@ -112,7 +112,7 @@ public:
   char *end_rw; // Read-write segment
   char *start_ro;
   char *end_ro; // read-only segment
-  xbt_dict_t subprograms; // xbt_dict_t<origin as hexadecimal string, dw_frame_t>
+  xbt_dict_t subprograms; // xbt_dict_t<origin as hexadecimal string, mc_frame_t>
   xbt_dynar_t global_variables; // xbt_dynar_t<mc_variable_t>
   xbt_dict_t types; // xbt_dict_t<origin as hexadecimal string, mc_type_t>
   xbt_dict_t full_types_by_name; // xbt_dict_t<name, mc_type_t> (full defined type only)
@@ -134,7 +134,7 @@ public:
 
   void* base_address() const;
 
-  dw_frame_t find_function(const void *ip) const;
+  mc_frame_t find_function(const void *ip) const;
   mc_variable_t find_variable(const char* name) const;
 
 };
@@ -178,27 +178,33 @@ public:
 
 };
 
-}
-}
+class Frame {
+public:
+  Frame();
+  ~Frame();
+  Frame(Frame const&) = delete;
+  Frame& operator=(Frame&) = delete;
 
-struct s_dw_frame{
   int tag;
-  char *name;
+  std::string name;
   void *low_pc;
   void *high_pc;
   s_mc_location_list_t frame_base;
   xbt_dynar_t /* <mc_variable_t> */ variables; /* Cannot use dict, there may be several variables with the same name (in different lexical blocks)*/
   unsigned long int id; /* DWARF offset of the subprogram */
-  xbt_dynar_t /* <dw_frame_t> */ scopes;
+  xbt_dynar_t /* <mc_frame_t> */ scopes;
   Dwarf_Off abstract_origin_id;
   mc_object_info_t object_info;
 };
 
+}
+}
+
+
+
 struct s_mc_function_index_item {
   void* low_pc, *high_pc;
-  dw_frame_t function;
+  mc_frame_t function;
 };
 
-XBT_INTERNAL void mc_frame_free(dw_frame_t freme);
-
 #endif
index 512cba0..fda88dd 100644 (file)
@@ -433,7 +433,7 @@ std::shared_ptr<ObjectInformation> Process::find_object_info_rw(remote_ptr<void>
   return nullptr;
 }
 
-dw_frame_t Process::find_function(remote_ptr<void> ip) const
+mc_frame_t Process::find_function(remote_ptr<void> ip) const
 {
   std::shared_ptr<s_mc_object_info_t> info = this->find_object_info_exec(ip);
   return info ? info->find_function((void*) ip.address()) : nullptr;
index 3b79fb4..3215c4f 100644 (file)
@@ -92,7 +92,7 @@ public:
   std::shared_ptr<s_mc_object_info_t> find_object_info(remote_ptr<void> addr) const;
   std::shared_ptr<s_mc_object_info_t> find_object_info_exec(remote_ptr<void> addr) const;
   std::shared_ptr<s_mc_object_info_t> find_object_info_rw(remote_ptr<void> addr) const;
-  dw_frame_t find_function(remote_ptr<void> ip) const;
+  mc_frame_t find_function(remote_ptr<void> ip) const;
   mc_variable_t find_variable(const char* name) const;
 
   // Heap access:
index d3c0542..2c97848 100644 (file)
@@ -104,13 +104,13 @@ typedef struct s_mc_stack_frame {
   /** Stack pointer */
   unw_word_t sp;
   unw_word_t frame_base;
-  dw_frame_t frame;
+  mc_frame_t frame;
   std::string frame_name;
   unw_cursor_t unw_cursor;
 } s_mc_stack_frame_t, *mc_stack_frame_t;
 
 typedef struct s_local_variable{
-  dw_frame_t subprogram;
+  mc_frame_t subprogram;
   unsigned long ip;
   std::string name;
   mc_type_t type;
index c408e2a..dc688ee 100644 (file)
@@ -164,12 +164,12 @@ static int get_proc_name(unw_addr_space_t as,
               void* arg)
 {
   mc_unw_context_t context = (mc_unw_context_t) arg;
-  dw_frame_t frame = context->process->find_function(remote(addr));
+  mc_frame_t frame = context->process->find_function(remote(addr));
   if (!frame)
     return - UNW_ENOINFO;
   *offp = (unw_word_t) frame->low_pc - addr;
 
-  strncpy(bufp, frame->name, buf_len);
+  strncpy(bufp, frame->name.c_str(), buf_len);
   if (bufp[buf_len - 1]) {
     bufp[buf_len - 1] = 0;
     return -UNW_ENOMEM;
index bd7e6a2..bb509d1 100644 (file)
@@ -142,8 +142,8 @@ void MCer_ignore_global_variable(const char *name)
 
 static void mc_ignore_local_variable_in_scope(const char *var_name,
                                               const char *subprogram_name,
-                                              dw_frame_t subprogram,
-                                              dw_frame_t scope);
+                                              mc_frame_t subprogram,
+                                              mc_frame_t scope);
 static void MC_ignore_local_variable_in_object(const char *var_name,
                                                const char *subprogram_name,
                                                mc_object_info_t info);
@@ -163,7 +163,7 @@ static void MC_ignore_local_variable_in_object(const char *var_name,
                                                mc_object_info_t info)
 {
   xbt_dict_cursor_t cursor2;
-  dw_frame_t frame;
+  mc_frame_t frame;
   char *key;
   xbt_dict_foreach(info->subprograms, cursor2, key, frame) {
     mc_ignore_local_variable_in_scope(var_name, subprogram_name, frame, frame);
@@ -183,14 +183,15 @@ static void MC_ignore_local_variable_in_object(const char *var_name,
  */
 static void mc_ignore_local_variable_in_scope(const char *var_name,
                                               const char *subprogram_name,
-                                              dw_frame_t subprogram,
-                                              dw_frame_t scope)
+                                              mc_frame_t subprogram,
+                                              mc_frame_t scope)
 {
   // Processing of direct variables:
 
   // If the current subprogram matches the given name:
-  if (!subprogram_name ||
-      (subprogram->name && strcmp(subprogram_name, subprogram->name) == 0)) {
+  if (subprogram_name == nullptr ||
+      (!subprogram->name.empty()
+        && subprogram->name == subprogram_name)) {
 
     // Try to find the variable and remove it:
     int start = 0;
@@ -221,11 +222,11 @@ static void mc_ignore_local_variable_in_scope(const char *var_name,
   }
   // And recursive processing in nested scopes:
   unsigned cursor = 0;
-  dw_frame_t nested_scope = NULL;
+  mc_frame_t nested_scope = NULL;
   xbt_dynar_foreach(scope->scopes, cursor, nested_scope) {
     // The new scope may be an inlined subroutine, in this case we want to use its
     // namespaced name in recursive calls:
-    dw_frame_t nested_subprogram =
+    mc_frame_t nested_subprogram =
         nested_scope->tag ==
         DW_TAG_inlined_subroutine ? nested_scope : subprogram;
 
index bf42cab..0412e2f 100644 (file)
@@ -31,27 +31,27 @@ static mc_type_t find_type_by_name(mc_object_info_t info, const char* name) {
   return NULL;
 }
 
-static dw_frame_t find_function_by_name(mc_object_info_t info, const char* name) {
+static mc_frame_t find_function_by_name(
+    mc_object_info_t info, const char* name)
+{
   xbt_dict_cursor_t cursor = 0;
-  dw_frame_t subprogram;
+  mc_frame_t subprogram;
   char* key;
-  xbt_dict_foreach(info->subprograms, cursor, key, subprogram){
-    if(!strcmp(name, subprogram->name))
+  xbt_dict_foreach(info->subprograms, cursor, key, subprogram)
+    if(subprogram->name == name)
       return subprogram;
-  }
-
-  return NULL;
+  return nullptr;
 }
 
 static mc_variable_t find_local_variable(
-    dw_frame_t frame, const char* argument_name) {
+    mc_frame_t frame, const char* argument_name) {
   unsigned int cursor = 0;
   mc_variable_t variable;
   xbt_dynar_foreach(frame->variables, cursor, variable)
     if(argument_name == variable->name)
       return variable;
 
-  dw_frame_t scope = nullptr;
+  mc_frame_t scope = nullptr;
   xbt_dynar_foreach(frame->scopes, cursor, scope) {
     variable = find_local_variable(scope, argument_name);
     if(variable)
@@ -62,7 +62,7 @@ static mc_variable_t find_local_variable(
 }
 
 static void test_local_variable(mc_object_info_t info, const char* function, const char* variable, void* address, unw_cursor_t* cursor) {
-  dw_frame_t subprogram = find_function_by_name(info, function);
+  mc_frame_t subprogram = find_function_by_name(info, function);
   assert(subprogram);
   // TODO, Lookup frame by IP and test against name instead