src/mc/AddressSpace.hpp
src/mc/AddressSpace.cpp
src/mc/mc_forward.h
+ src/mc/mc_forward.hpp
src/mc/mc_process.h
src/mc/mc_process.cpp
src/mc/mc_unw.h
#include <stdint.h>
-#include "mc_forward.h"
+#include "mc_forward.hpp"
namespace simgrid {
namespace mc {
#include <simgrid_config.h>
#include <xbt/dict.h>
-#include "mc_forward.h"
+#include "mc_forward.hpp"
#include "mc_process.h"
#include "PageStore.hpp"
#include "mc_protocol.h"
#include <boost/unordered_set.hpp>
#include "mc_mmu.h"
-#include "mc_forward.h"
+#include "mc_forward.hpp"
namespace simgrid {
namespace mc {
RegionSnapshot sparse_region(RegionType region_type,
void *start_addr, void* permanent_addr, size_t size)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
xbt_assert((((uintptr_t)start_addr) & (xbt_pagesize-1)) == 0,
"Not at the beginning of a page");
private:
RegionType region_type_;
StorageType storage_type_;
- mc_object_info_t object_info_;
+ simgrid::mc::ObjectInformation* object_info_;
/** @brief Virtual address of the region in the simulated process */
void *start_addr_;
return privatized_regions_;
}
- mc_object_info_t object_info() const { return object_info_; }
- void object_info(mc_object_info_t info) { object_info_ = info; }
+ simgrid::mc::ObjectInformation* object_info() const { return object_info_; }
+ void object_info(simgrid::mc::ObjectInformation* info) { object_info_ = info; }
// Other getters
static void MC_snapshot_add_region(int index, mc_snapshot_t snapshot,
simgrid::mc::RegionType type,
- mc_object_info_t object_info,
+ simgrid::mc::ObjectInformation* object_info,
void *start_addr, void* permanent_addr, size_t size)
{
if (type == simgrid::mc::RegionType::Data)
return;
}
-static void MC_get_memory_regions(mc_process_t process, mc_snapshot_t snapshot)
+static void MC_get_memory_regions(simgrid::mc::Process* process, mc_snapshot_t snapshot)
{
const size_t n = process->object_infos.size();
snapshot->snapshot_regions.resize(n + 1);
* `dl_iterate_phdr` would be more robust but would not work in cross-process.
* */
void MC_find_object_address(
- std::vector<simgrid::mc::VmMap> const& maps, mc_object_info_t result)
+ std::vector<simgrid::mc::VmMap> const& maps, simgrid::mc::ObjectInformation* result)
{
const char* file_name = xbt_strdup(result->file_name.c_str());
const char *name = basename(file_name);
* \param ip Instruction pointer
* \return true if the variable is valid
* */
-static bool mc_valid_variable(mc_variable_t var, mc_frame_t scope,
+static bool mc_valid_variable(simgrid::mc::Variable* var, simgrid::mc::Frame* scope,
const void *ip)
{
// The variable is not yet valid:
}
static void mc_fill_local_variables_values(mc_stack_frame_t stack_frame,
- mc_frame_t scope, int process_index,
+ simgrid::mc::Frame* scope, int process_index,
std::vector<s_local_variable>& result)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
void *ip = (void *) stack_frame->ip;
if (ip < scope->low_pc || ip >= scope->high_pc)
static std::vector<s_mc_stack_frame_t> MC_unwind_stack_frames(mc_unw_context_t stack_context)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
std::vector<s_mc_stack_frame_t> result;
unw_cursor_t c;
// TODO, use real addresses in frame_t instead of fixing it here
- mc_frame_t frame = process->find_function(remote(ip));
+ simgrid::mc::Frame* frame = process->find_function(remote(ip));
stack_frame.frame = frame;
if (frame) {
{
XBT_DEBUG("Taking snapshot %i", num_state);
- mc_process_t mc_process = &mc_model_checker->process();
+ simgrid::mc::Process* mc_process = &mc_model_checker->process();
mc_snapshot_t snapshot = new simgrid::mc::Snapshot();
int process_index,
void* real_area1, mc_snapshot_t snapshot1, mc_mem_region_t region1,
void* real_area2, mc_snapshot_t snapshot2, mc_mem_region_t region2,
- mc_type_t type, int pointer_level)
+ simgrid::mc::Type* type, int pointer_level)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
- mc_type_t subtype, subsubtype;
+ simgrid::mc::Type* subtype;
+ simgrid::mc::Type* subsubtype;
int elm_size, i, res;
top:
return 0;
}
-static int compare_global_variables(mc_object_info_t object_info,
+static int compare_global_variables(simgrid::mc::ObjectInformation* object_info,
int process_index,
mc_mem_region_t r1,
mc_mem_region_t r2, mc_snapshot_t snapshot1,
|| (char *) current_var.address > (char *) object_info->end_rw)
continue;
- mc_type_t bvariable_type = current_var.type;
+ simgrid::mc::Type* bvariable_type = current_var.type;
int res =
compare_areas_with_type(state, process_index,
(char *) current_var.address, snapshot1, r1,
}
// TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
- mc_type_t subtype = current_var1->type;
+ simgrid::mc::Type* subtype = current_var1->type;
res =
compare_areas_with_type(state, process_index,
current_var1->address, snapshot1, mc_get_snapshot_region(current_var1->address, snapshot1, process_index),
int snapshot_compare(void *state1, void *state2)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
mc_snapshot_t s1, s2;
int num1, num2;
std::vector<s_mc_heap_ignore_region_t>* to_ignore1;
std::vector<s_mc_heap_ignore_region_t>* to_ignore2;
s_heap_area_t *equals_to1, *equals_to2;
- mc_type_t *types1, *types2;
+ simgrid::mc::Type **types1;
+ simgrid::mc::Type **types2;
size_t available;
};
state->types1 = (simgrid::mc::Type**)
realloc(state->types1,
state->heaplimit * MAX_FRAGMENT_PER_BLOCK *
- sizeof(type_name *));
+ sizeof(simgrid::mc::Type*));
state->equals_to2 = (s_heap_area_t*)
realloc(state->equals_to2,
state->heaplimit * MAX_FRAGMENT_PER_BLOCK *
state->types2 = (simgrid::mc::Type**)
realloc(state->types2,
state->heaplimit * MAX_FRAGMENT_PER_BLOCK *
- sizeof(type_name *));
+ sizeof(simgrid::mc::Type*));
state->available = state->heaplimit;
}
int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
struct s_mc_diff *state = mc_diff_info;
/* Start comparison */
xbt_dynar_t previous, int size,
int check_ignore)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
int i = 0;
const void *addr_pointed1, *addr_pointed2;
const void *real_area1, const void *real_area2,
mc_snapshot_t snapshot1,
mc_snapshot_t snapshot2,
- xbt_dynar_t previous, mc_type_t type,
+ xbt_dynar_t previous, simgrid::mc::Type* type,
int area_size, int check_ignore,
int pointer_level)
{
return 0;
}
- mc_type_t subtype, subsubtype;
+ simgrid::mc::Type *subtype, *subsubtype;
int res, elm_size;
const void *addr_pointed1, *addr_pointed2;
for(simgrid::mc::Type& member : type->members) {
// TODO, optimize this? (for the offset case)
void *real_member1 =
- mc_member_resolve(real_area1, type, &member, (mc_address_space_t) snapshot1, process_index);
+ mc_member_resolve(real_area1, type, &member, (simgrid::mc::AddressSpace*) snapshot1, process_index);
void *real_member2 =
- mc_member_resolve(real_area2, type, &member, (mc_address_space_t) snapshot2, process_index);
+ mc_member_resolve(real_area2, type, &member, (simgrid::mc::AddressSpace*) snapshot2, process_index);
res =
compare_heap_area_with_type(state, process_index, real_member1, real_member2,
snapshot1, snapshot2,
* @param area_size
* @return DWARF type ID for given offset
*/
-static mc_type_t get_offset_type(void *real_base_address, mc_type_t type,
+static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::Type* type,
int offset, int area_size,
mc_snapshot_t snapshot, int process_index)
{
*/
int compare_heap_area(int process_index, const void *area1, const void *area2, mc_snapshot_t snapshot1,
mc_snapshot_t snapshot2, xbt_dynar_t previous,
- mc_type_t type, int pointer_level)
+ simgrid::mc::Type* type, int pointer_level)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
struct s_mc_diff *state = mc_diff_info;
int type_size = -1;
int offset1 = 0, offset2 = 0;
int new_size1 = -1, new_size2 = -1;
- mc_type_t new_type1 = NULL, new_type2 = NULL;
+ simgrid::mc::Type *new_type1 = NULL, *new_type2 = NULL;
int match_pairs = 0;
* \param unit the DIE of the compile unit of the current DIE
* \param frame containg frame if any
*/
-static void MC_dwarf_handle_die(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t frame,
+static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* 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, mc_frame_t frame,
+static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns);
/** \brief Calls MC_dwarf_handle_die on all childrend of the given die
* \param unit the DIE of the compile unit of the current DIE
* \param frame containg frame if any
*/
-static void MC_dwarf_handle_children(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t frame,
+static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns);
/** \brief Handle a variable (DW_TAG_variable or other)
* \param unit the DIE of the compile unit of the current 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, mc_frame_t frame,
+static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns);
/** \brief Get the DW_TAG_type of the DIE
return a.address < b.address;
}
-// ***** mc_type_t
+// ***** simgrid::mc::Type*
/** \brief Initialize the location of a member of a type
* (DW_AT_data_member_location of a DW_TAG_member).
* \param member the member of the type
* \param child DIE of the member (DW_TAG_member)
*/
-static void MC_dwarf_fill_member_location(mc_type_t type, mc_type_t member,
+static void MC_dwarf_fill_member_location(simgrid::mc::Type* type, simgrid::mc::Type* member,
Dwarf_Die * child)
{
if (dwarf_hasattr(child, DW_AT_data_bit_offset)) {
* \param unit DIE of the compilation unit containing the type DIE
* \param type the type
*/
-static void MC_dwarf_add_members(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_type_t type)
+static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Type* type)
{
int res;
Dwarf_Die child;
* \return MC representation of the type
*/
static simgrid::mc::Type MC_dwarf_die_to_type(
- mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t frame,
+ simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns)
{
return std::move(type);
}
-static void MC_dwarf_handle_type_die(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t frame,
+static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns)
{
simgrid::mc::Type type = MC_dwarf_die_to_type(info, die, unit, frame, ns);
static int mc_anonymous_variable_index = 0;
static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
- mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t frame,
+ simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns)
{
// Skip declarations:
return std::move(variable);
}
-static void MC_dwarf_handle_variable_die(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t frame,
+static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns)
{
std::unique_ptr<simgrid::mc::Variable> variable =
xbt_die("No frame for this local variable");
}
-static void MC_dwarf_handle_scope_die(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t parent_frame,
+static void MC_dwarf_handle_scope_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* parent_frame,
const char *ns)
{
// TODO, handle DW_TAG_type/DW_TAG_location for DW_TAG_with_stmt
parent_frame->scopes.push_back(std::move(frame));
}
-static void mc_dwarf_handle_namespace_die(mc_object_info_t info,
+static void mc_dwarf_handle_namespace_die(simgrid::mc::ObjectInformation* info,
Dwarf_Die * die, Dwarf_Die * unit,
- mc_frame_t frame,
+ simgrid::mc::Frame* frame,
const char *ns)
{
const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
xbt_free(new_ns);
}
-static void MC_dwarf_handle_children(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t frame,
+static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns)
{
// For each child DIE:
}
}
-static void MC_dwarf_handle_die(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, mc_frame_t frame,
+static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
+ Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns)
{
int tag = dwarf_tag(die);
* Read the DWARf information of the EFFL object and populate the
* lists of types, variables, functions.
*/
-void MC_dwarf_get_variables(mc_object_info_t info)
+void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
{
int fd = open(info->file_name.c_str(), O_RDONLY);
if (fd < 0)
return 1;
}
-static void MC_make_functions_index(mc_object_info_t info)
+static void MC_make_functions_index(simgrid::mc::ObjectInformation* info)
{
info->functions_index.clear();
});
}
-static void MC_post_process_variables(mc_object_info_t info)
+static void MC_post_process_variables(simgrid::mc::ObjectInformation* info)
{
// Someone needs this to be sorted but who?
std::sort(info->global_variables.begin(), info->global_variables.end(),
}
}
-static void mc_post_process_scope(mc_object_info_t info, mc_frame_t scope)
+static void mc_post_process_scope(simgrid::mc::ObjectInformation* info, simgrid::mc::Frame* scope)
{
if (scope->tag == DW_TAG_inlined_subroutine) {
/** \brief Fill/lookup the "subtype" field.
*/
-static void MC_resolve_subtype(mc_object_info_t info, mc_type_t type)
+static void MC_resolve_subtype(simgrid::mc::ObjectInformation* info, simgrid::mc::Type* type)
{
if (!type->type_id)
return;
type->subtype = *subtype;
}
-static void MC_post_process_types(mc_object_info_t info)
+static void MC_post_process_types(simgrid::mc::ObjectInformation* info)
{
// Lookup "subtype" field:
for(auto& i : info->types) {
}
/** \brief Finds informations about a given shared object/executable */
-std::shared_ptr<s_mc_object_info_t> MC_find_object_info(
+std::shared_ptr<simgrid::mc::ObjectInformation> MC_find_object_info(
std::vector<simgrid::mc::VmMap> const& maps, const char *name, int executable)
{
- std::shared_ptr<s_mc_object_info_t> result =
- std::make_shared<s_mc_object_info_t>();
+ std::shared_ptr<simgrid::mc::ObjectInformation> result =
+ std::make_shared<simgrid::mc::ObjectInformation>();
if (executable)
result->flags |= MC_OBJECT_INFO_EXECUTABLE;
result->file_name = name;
/*************************************************************************/
-void MC_post_process_object_info(mc_process_t process, mc_object_info_t info)
+void MC_post_process_object_info(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info)
{
for (auto& i : info->types) {
- mc_type_t type = &(i.second);
- mc_type_t subtype = type;
+ simgrid::mc::Type* type = &(i.second);
+ simgrid::mc::Type* subtype = type;
while (subtype->type == DW_TAG_typedef || subtype->type == DW_TAG_volatile_type
|| subtype->type == DW_TAG_const_type) {
if (subtype->subtype)
*/
void mc_dwarf_resolve_location(mc_location_t location,
simgrid::mc::DwarfExpression* expression,
- mc_object_info_t object_info,
+ simgrid::mc::ObjectInformation* object_info,
unw_cursor_t * c,
void *frame_pointer_address,
- mc_address_space_t address_space, int process_index)
+ simgrid::mc::AddressSpace* address_space, int process_index)
{
s_mc_expression_state_t state;
memset(&state, 0, sizeof(s_mc_expression_state_t));
void mc_dwarf_resolve_locations(mc_location_t location,
simgrid::mc::LocationList* locations,
- mc_object_info_t object_info,
+ simgrid::mc::ObjectInformation* object_info,
unw_cursor_t * c,
void *frame_pointer_address,
- mc_address_space_t address_space,
+ simgrid::mc::AddressSpace* address_space,
int process_index)
{
* \param frame
* \param unw_cursor
*/
-void *mc_find_frame_base(mc_frame_t frame, mc_object_info_t object_info,
+void *mc_find_frame_base(simgrid::mc::Frame* frame, simgrid::mc::ObjectInformation* object_info,
unw_cursor_t * unw_cursor)
{
s_mc_location_t location;
}
void mc_dwarf_location_list_init(
- simgrid::mc::LocationList* list, mc_object_info_t info,
+ simgrid::mc::LocationList* list, simgrid::mc::ObjectInformation* info,
Dwarf_Die * die, Dwarf_Attribute * attr)
{
list->clear();
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+/** \file mc_forward.h
+ *
+ * Define type names for pointers of MC objects for the C code
+ */
+
#ifndef SIMGRID_MC_FORWARD_H
#define SIMGRID_MC_FORWARD_H
-#include <xbt/misc.h>
-#include <mc/datatypes.h>
-
#ifdef __cplusplus
-#define MC_OVERRIDE
-
-namespace simgrid {
-namespace mc {
-
-class PageStore;
-class ModelChecker;
-class AddressSpace;
-class Process;
-class Snapshot;
-class ObjectInformation;
-class Type;
-class Variable;
-class Frame;
-
-}
-}
-
-typedef ::simgrid::mc::ModelChecker s_mc_model_checker_t;
-typedef ::simgrid::mc::PageStore s_mc_pages_store_t;
-typedef ::simgrid::mc::AddressSpace s_mc_address_space_t;
-typedef ::simgrid::mc::Process s_mc_process_t;
-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;
+// If we're in C++, we give the real definition:
+#include "mc_forward.hpp"
+typedef simgrid::mc::Snapshot *mc_snapshot_t;
+typedef simgrid::mc::Type *mc_type_t;
#else
-typedef struct _s_mc_model_checker s_mc_model_checker_t;
-typedef struct _s_mc_pages_store s_mc_pages_store_t;
-typedef struct _s_mc_address_space_t s_mc_address_space_t;
-typedef struct _s_mc_process_t s_mc_process_t;
-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;
+// Otherwise we use dummy opaque structs:
+typedef struct _mc_snapshot_t *mc_snapshot_t;
+typedef struct _s_mc_type_t *mc_type_t;
#endif
-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;
-typedef s_mc_process_t *mc_process_t;
-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;
-
-SG_BEGIN_DECL()
-extern mc_model_checker_t mc_model_checker;
-SG_END_DECL()
-
#endif
--- /dev/null
+/* Copyright (c) 2007-2014. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+/** \file mc_forward.hpp
+ *
+ * Forward definitions for MC types
+ */
+
+#ifndef SIMGRID_MC_FORWARD_HPP
+#define SIMGRID_MC_FORWARD_HPP
+
+#define MC_OVERRIDE
+
+namespace simgrid {
+namespace mc {
+
+class PageStore;
+class ModelChecker;
+class AddressSpace;
+class Process;
+class Snapshot;
+class ObjectInformation;
+class Type;
+class Variable;
+class Frame;
+
+}
+}
+
+// TODO, try to get rid of the global ModelChecker variable
+extern simgrid::mc::ModelChecker* mc_model_checker;
+
+#endif
* \param type type of the variable
* */
static void mc_hash_value(hash_type * hash, mc_hashing_state * state,
- mc_object_info_t info, const void *address,
- mc_type_t type)
+ simgrid::mc::ObjectInformation* info, const void *address,
+ simgrid::mc::Type* type)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
top:
switch (type->type) {
return;
long element_count = type->element_count;
- mc_type_t subtype = type->subtype;
+ simgrid::mc::Type* subtype = type->subtype;
if (subtype == NULL) {
XBT_DEBUG("Hash array without subtype");
return;
return;
unsigned int cursor = 0;
- mc_type_t member;
+ simgrid::mc::Type* member;
xbt_dynar_foreach(type->members, cursor, member) {
XBT_DEBUG("Hash struct member %s", member->name);
if (type->subtype == NULL)
}
static void mc_hash_object_globals(hash_type * hash, mc_hashing_state * state,
- mc_object_info_t info)
+ simgrid::mc::ObjectInformation* info)
{
unsigned int cursor = 0;
- mc_variable_t variable;
+ simgrid::mc::Variable* variable;
xbt_dynar_foreach(info->global_variables, cursor, variable) {
XBT_DEBUG("Hash global variable %s", variable->name);
continue;
}
- mc_type_t type = variable->type;
+ simgrid::mc::Type* type = variable->type;
if (type == NULL) {
// Nothing
continue;
}
static void mc_hash_stack_frame(mc_hash_t * hash,
- mc_object_info_t info,
- unw_cursor_t * unw_cursor, mc_frame_t frame,
+ simgrid::mc::ObjectInformation* info,
+ unw_cursor_t * unw_cursor, simgrid::mc::Frame* frame,
char *frame_pointer, mc_hashing_state * state)
{
// return; // TEMP
unsigned int cursor = 0;
- mc_variable_t variable;
+ simgrid::mc::Variable* variable;
xbt_dynar_foreach(frame->variables, cursor, variable) {
if (variable->type_id == NULL) {
variable->object_info, unw_cursor,
frame_pointer, NULL);
- mc_type_t type = variable->type;
+ simgrid::mc::Type* type = variable->type;
if (type == NULL) {
XBT_DEBUG("Hash local variable %s without loctypeation", variable->name);
continue;
hash_update(*hash, stack_frame.ip);
- mc_object_info_t info;
+ simgrid::mc::ObjectInformation* info;
if (stack_frame.ip >= (unw_word_t) libsimgrid_info->start_exec
&& stack_frame.ip < (unw_word_t) libsimgrid_info->end_exec)
info = libsimgrid_info;
#include <simgrid_config.h>
#include "mc_base.h"
-#include "mc_forward.h"
+#include "mc_forward.hpp"
#include "AddressSpace.hpp"
namespace simgrid {
XBT_INTERNAL void mc_dwarf_resolve_location(
mc_location_t location, simgrid::mc::DwarfExpression* expression,
- mc_object_info_t object_info, unw_cursor_t* c,
- void* frame_pointer_address, mc_address_space_t address_space,
+ simgrid::mc::ObjectInformation* object_info, unw_cursor_t* c,
+ void* frame_pointer_address, simgrid::mc::AddressSpace* address_space,
int process_index);
MC_SHOULD_BE_INTERNAL void mc_dwarf_resolve_locations(
mc_location_t location, simgrid::mc::LocationList* locations,
- mc_object_info_t object_info, unw_cursor_t* c,
- void* frame_pointer_address, mc_address_space_t address_space,
+ simgrid::mc::ObjectInformation* object_info, unw_cursor_t* c,
+ void* frame_pointer_address, simgrid::mc::AddressSpace* address_space,
int process_index);
XBT_INTERNAL void mc_dwarf_location_list_init(
- simgrid::mc::LocationList*, mc_object_info_t info, Dwarf_Die* die,
+ simgrid::mc::LocationList*, simgrid::mc::ObjectInformation* info, Dwarf_Die* die,
Dwarf_Attribute* attr);
#define MC_EXPRESSION_STACK_SIZE 64
unw_cursor_t* cursor;
void* frame_base;
- mc_address_space_t address_space;
- mc_object_info_t object_info;
+ simgrid::mc::AddressSpace* address_space;
+ simgrid::mc::ObjectInformation* object_info;
int process_index;
} s_mc_expression_state_t, *mc_expression_state_t;
size_t n, const Dwarf_Op* ops, mc_expression_state_t state);
MC_SHOULD_BE_INTERNAL void* mc_find_frame_base(
- mc_frame_t frame, mc_object_info_t object_info, unw_cursor_t* unw_cursor);
+ simgrid::mc::Frame* frame, simgrid::mc::ObjectInformation* object_info, unw_cursor_t* unw_cursor);
SG_END_DECL()
* @param snapshot Snapshot (or NULL)
* @return Process address of the given member of the 'object' struct/class
*/
-void *mc_member_resolve(const void *base, mc_type_t type, mc_type_t member,
- mc_address_space_t address_space, int process_index)
+void *mc_member_resolve(const void *base, simgrid::mc::Type* type, simgrid::mc::Type* member,
+ simgrid::mc::AddressSpace* address_space, int process_index)
{
// TODO, get rid of this?
if (!member->has_offset_location())
#include <sys/types.h>
+#include <xbt/base.h>
+
#include <simgrid_config.h>
-#include "mc_forward.h"
+#include "mc_forward.hpp"
namespace simgrid {
namespace mc {
extern "C" {
XBT_INTERNAL void MC_find_object_address(
- std::vector<simgrid::mc::VmMap> const& maps, mc_object_info_t result);
+ std::vector<simgrid::mc::VmMap> const& maps, simgrid::mc::ObjectInformation* result);
}
}
/* Find a function by instruction pointer */
-mc_frame_t ObjectInformation::find_function(const void *ip) const
+simgrid::mc::Frame* ObjectInformation::find_function(const void *ip) const
{
/* This is implemented by binary search on a sorted array.
*
#include <elfutils/libdw.h>
-#include "mc_forward.h"
+#include "mc_forward.hpp"
#include "mc_location.h"
#include "mc_process.h"
#include "../smpi/private.h"
// Location (for members) is either of:
simgrid::mc::DwarfExpression location_expression;
- mc_type_t subtype; // DW_AT_type
- mc_type_t full_type; // The same (but more complete) type
+ simgrid::mc::Type* subtype; // DW_AT_type
+ simgrid::mc::Type* full_type; // The same (but more complete) type
bool has_offset_location() const
{
int global;
std::string name;
std::uint64_t type_id;
- mc_type_t type;
+ simgrid::mc::Type* type;
// Use either of:
simgrid::mc::LocationList location_list;
void* address;
size_t start_scope;
- mc_object_info_t object_info;
+ simgrid::mc::ObjectInformation* object_info;
};
class Frame {
unsigned long int id; /* DWARF offset of the subprogram */
std::vector<Frame> scopes;
Dwarf_Off abstract_origin_id;
- mc_object_info_t object_info;
+ simgrid::mc::ObjectInformation* object_info;
};
/** An entry in the functions index
*/
struct FunctionIndexEntry {
void* low_pc;
- mc_frame_t function;
+ simgrid::mc::Frame* function;
};
/** Information about an (ELF) executable/sharedobject
void* base_address() const;
- mc_frame_t find_function(const void *ip) const;
+ simgrid::mc::Frame* find_function(const void *ip) const;
// TODO, should be simgrid::mc::Variable*
simgrid::mc::Variable* find_variable(const char* name) const;
}
-XBT_INTERNAL std::shared_ptr<s_mc_object_info_t> MC_find_object_info(
+XBT_INTERNAL std::shared_ptr<simgrid::mc::ObjectInformation> MC_find_object_info(
std::vector<simgrid::mc::VmMap> const& maps, const char* name, int executable);
-XBT_INTERNAL void MC_post_process_object_info(mc_process_t process, mc_object_info_t info);
+XBT_INTERNAL void MC_post_process_object_info(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info);
-XBT_INTERNAL void MC_dwarf_get_variables(mc_object_info_t info);
-XBT_INTERNAL void MC_dwarf_get_variables_libdw(mc_object_info_t info);
+XBT_INTERNAL void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info);
+XBT_INTERNAL void MC_dwarf_get_variables_libdw(simgrid::mc::ObjectInformation* info);
XBT_INTERNAL const char* MC_dwarf_attrname(int attr);
XBT_INTERNAL const char* MC_dwarf_tagname(int tag);
XBT_INTERNAL void* mc_member_resolve(
- const void* base, mc_type_t type, mc_type_t member,
- mc_address_space_t snapshot, int process_index);
+ const void* base, simgrid::mc::Type* type, simgrid::mc::Type* member,
+ simgrid::mc::AddressSpace* snapshot, int process_index);
#endif
* @param page_count Number of pages of the region
* @param pagenos
*/
-void mc_restore_page_snapshot_region(mc_process_t process,
+void mc_restore_page_snapshot_region(simgrid::mc::Process* process,
void* start_addr, simgrid::mc::PerPageCopy const& pages_copy)
{
for (size_t i = 0; i != pages_copy.page_count(); ++i) {
// ***** High level API
-void mc_region_restore_sparse(mc_process_t process, mc_mem_region_t reg)
+void mc_region_restore_sparse(simgrid::mc::Process* process, mc_mem_region_t reg)
{
xbt_assert(((reg->permanent_address().address()) & (xbt_pagesize-1)) == 0,
"Not at the beginning of a page");
}
// Read std_heap (is a struct mdesc*):
- mc_variable_t std_heap_var = process->find_variable("__mmalloc_default_mdp");
+ simgrid::mc::Variable* std_heap_var = process->find_variable("__mmalloc_default_mdp");
if (!std_heap_var)
xbt_die("No heap information in the target process");
if(!std_heap_var->address)
}
}
- std::shared_ptr<s_mc_object_info_t> info =
+ std::shared_ptr<simgrid::mc::ObjectInformation> info =
MC_find_object_info(this->memory_map_, pathname, is_executable);
this->object_infos.push_back(info);
if (is_executable)
XBT_DEBUG("Get debug information done !");
}
-std::shared_ptr<s_mc_object_info_t> Process::find_object_info(remote_ptr<void> addr) const
+std::shared_ptr<simgrid::mc::ObjectInformation> Process::find_object_info(remote_ptr<void> addr) const
{
for (auto const& object_info : this->object_infos) {
if (addr.address() >= (std::uint64_t)object_info->start
return nullptr;
}
-mc_frame_t Process::find_function(remote_ptr<void> ip) const
+simgrid::mc::Frame* Process::find_function(remote_ptr<void> ip) const
{
- std::shared_ptr<s_mc_object_info_t> info = this->find_object_info_exec(ip);
+ std::shared_ptr<simgrid::mc::ObjectInformation> info = this->find_object_info_exec(ip);
return info ? info->find_function((void*) ip.address()) : nullptr;
}
/** Find (one occurence of) the named variable definition
*/
-mc_variable_t Process::find_variable(const char* name) const
+simgrid::mc::Variable* Process::find_variable(const char* name) const
{
// First lookup the variable in the executable shared object.
// A global variable used directly by the executable code from a library
// is reinstanciated in the executable memory .data/.bss.
// We need to look up the variable in the execvutable first.
if (this->binary_info) {
- std::shared_ptr<s_mc_object_info_t> const& info = this->binary_info;
- mc_variable_t var = info->find_variable(name);
+ std::shared_ptr<simgrid::mc::ObjectInformation> const& info = this->binary_info;
+ simgrid::mc::Variable* var = info->find_variable(name);
if (var)
return var;
}
- for (std::shared_ptr<s_mc_object_info_t> const& info : this->object_infos) {
- mc_variable_t var = info->find_variable(name);
+ for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info : this->object_infos) {
+ simgrid::mc::Variable* var = info->find_variable(name);
if (var)
return var;
}
void Process::read_variable(const char* name, void* target, size_t size) const
{
- mc_variable_t var = this->find_variable(name);
+ simgrid::mc::Variable* var = this->find_variable(name);
if (!var->address)
xbt_die("No simple location for this variable");
if (!var->type->full_type)
AddressSpace::ReadMode mode) const
{
if (process_index != simgrid::mc::ProcessIndexDisabled) {
- std::shared_ptr<s_mc_object_info_t> const& info =
+ std::shared_ptr<simgrid::mc::ObjectInformation> const& info =
this->find_object_info_rw((void*)address.address());
// Segment overlap is not handled.
if (info.get() && info.get()->privatized()) {
#include "simix/popping_private.h"
#include "simix/smx_private.h"
-#include "mc_forward.h"
+#include "mc_forward.hpp"
#include "mc_base.h"
#include "mc_mmalloc.h" // std_heap
#include "mc_memory_map.h"
void clear_bytes(remote_ptr<void> address, size_t len);
// Debug information:
- 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;
- mc_frame_t find_function(remote_ptr<void> ip) const;
- mc_variable_t find_variable(const char* name) const;
+ std::shared_ptr<simgrid::mc::ObjectInformation> find_object_info(remote_ptr<void> addr) const;
+ std::shared_ptr<simgrid::mc::ObjectInformation> find_object_info_exec(remote_ptr<void> addr) const;
+ std::shared_ptr<simgrid::mc::ObjectInformation> find_object_info_rw(remote_ptr<void> addr) const;
+ simgrid::mc::Frame* find_function(remote_ptr<void> ip) const;
+ simgrid::mc::Variable* find_variable(const char* name) const;
// Heap access:
xbt_mheap_t get_heap()
std::vector<IgnoredRegion> ignored_regions_;
public: // object info
- // TODO, make private (first, objectify mc_object_info_t)
- std::vector<std::shared_ptr<s_mc_object_info_t>> object_infos;
- std::shared_ptr<s_mc_object_info_t> libsimgrid_info;
- std::shared_ptr<s_mc_object_info_t> binary_info;
+ // TODO, make private (first, objectify simgrid::mc::ObjectInformation*)
+ std::vector<std::shared_ptr<simgrid::mc::ObjectInformation>> object_infos;
+ std::shared_ptr<simgrid::mc::ObjectInformation> libsimgrid_info;
+ std::shared_ptr<simgrid::mc::ObjectInformation> binary_info;
public: // Copies of MCed SMX data structures
/** Copy of `simix_global->process_list`
/** Full-featured MC-aware libunwind address space for the process
*
* This address space is using a mc_unw_context_t
- * (with mc_process_t/mc_address_space_t and unw_context_t).
+ * (with simgrid::mc::Process* / simgrid::mc::AddressSpace*
+ * and unw_context_t).
*/
unw_addr_space_t unw_addr_space;
#include <simgrid_config.h>
#include <xbt/dict.h>
-#include "mc_forward.h"
+#include "mc_forward.hpp"
#include "mc_state.h"
SG_BEGIN_DECL()
struct mc_symbol_pointer_callback
{
- mc_process_t process;
+ simgrid::mc::Process* process;
void* value;
};
{
XBT_DEBUG("Shuting down model-checker");
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
int status = process->status();
if (process->running()) {
XBT_DEBUG("Killing process");
}
}
-void s_mc_server::resume(mc_process_t process)
+void s_mc_server::resume(simgrid::mc::Process* process)
{
int res = process->send_message(MC_MESSAGE_CONTINUE);
if (res)
}
}
-void MC_server_wait_client(mc_process_t process)
+void MC_server_wait_client(simgrid::mc::Process* process)
{
mc_server->resume(process);
while (mc_model_checker->process().running()) {
}
}
-void MC_server_simcall_handle(mc_process_t process, unsigned long pid, int value)
+void MC_server_simcall_handle(simgrid::mc::Process* process, unsigned long pid, int value)
{
s_mc_simcall_handle_message m;
memset(&m, 0, sizeof(m));
extern mc_server_t mc_server;
-XBT_INTERNAL void MC_server_wait_client(mc_process_t process);
-XBT_INTERNAL void MC_server_simcall_handle(mc_process_t process, unsigned long pid, int value);
+XBT_INTERNAL void MC_server_wait_client(simgrid::mc::Process* process);
+XBT_INTERNAL void MC_server_simcall_handle(simgrid::mc::Process* process, unsigned long pid, int value);
XBT_INTERNAL void MC_server_loop(mc_server_t server);
void start();
void shutdown();
void exit();
- void resume(mc_process_t process);
+ void resume(simgrid::mc::Process* process);
void loop();
bool handle_events();
protected:
* @param remote_swag Address of the process SWAG in the remote list
*/
static void MC_process_refresh_simix_process_list(
- mc_process_t process,
+ simgrid::mc::Process* process,
xbt_dynar_t target, xbt_swag_t remote_swag)
{
// swag = REMOTE(*simix_global->process_list)
assert(i == swag.count);
}
-void MC_process_smx_refresh(mc_process_t process)
+void MC_process_smx_refresh(simgrid::mc::Process* process)
{
xbt_assert(mc_mode == MC_MODE_SERVER);
xbt_assert(!process->is_self());
if (mc_mode == MC_MODE_CLIENT)
return SIMIX_host_get_name(p->smx_host);
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
// Currently, smx_host_t = xbt_dictelm_t.
// TODO, add an static_assert on this if switching to C++
const char* MC_smx_process_get_name(smx_process_t p)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
if (mc_mode == MC_MODE_CLIENT)
return p->name;
if (!p->name)
*
* The process lists are currently refreshed each time MCed code is executed.
* We don't try to give a persistent MCer address for a given MCed process.
- * For this reason, a MCer mc_process_t is currently not reusable after
+ * For this reason, a MCer simgrid::mc::Process* is currently not reusable after
* MCed code.
*/
XBT_INTERNAL xbt_dynar_t MC_smx_process_info_list_new(void);
-XBT_INTERNAL void MC_process_smx_refresh(mc_process_t process);
+XBT_INTERNAL void MC_process_smx_refresh(simgrid::mc::Process* process);
/** Get the issuer of a simcall (`req->issuer`)
*
* (or NULL if it does not belong to any snapshot region)
* */
mc_mem_region_t mc_get_snapshot_region(
- const void* addr, const s_mc_snapshot_t* snapshot, int process_index)
+ const void* addr, const simgrid::mc::Snapshot* snapshot, int process_index)
{
size_t n = snapshot->snapshot_regions.size();
for (size_t i = 0; i != n; ++i) {
#include <xbt/asserts.h>
#include <xbt/dynar.h>
-#include "mc_forward.h"
+#include "mc_forward.hpp"
#include "ModelChecker.hpp"
#include "PageStore.hpp"
#include "mc_mmalloc.h"
// ***** Snapshot region
-XBT_INTERNAL void mc_region_restore_sparse(mc_process_t process, mc_mem_region_t reg);
+XBT_INTERNAL void mc_region_restore_sparse(simgrid::mc::Process* process, mc_mem_region_t reg);
static inline __attribute__((always_inline))
void* mc_translate_address_region_chunked(uintptr_t addr, mc_mem_region_t region)
}
XBT_INTERNAL mc_mem_region_t mc_get_snapshot_region(
- const void* addr, const s_mc_snapshot_t *snapshot, int process_index);
+ const void* addr, const simgrid::mc::Snapshot *snapshot, int process_index);
}
/** Stack pointer */
unw_word_t sp;
unw_word_t frame_base;
- mc_frame_t frame;
+ simgrid::mc::Frame* frame;
std::string frame_name;
unw_cursor_t unw_cursor;
} s_mc_stack_frame_t, *mc_stack_frame_t;
typedef struct s_local_variable{
- mc_frame_t subprogram;
+ simgrid::mc::Frame* subprogram;
unsigned long ip;
std::string name;
- mc_type_t type;
+ simgrid::mc::Type* type;
void *address;
int region;
} s_local_variable_t, *local_variable_t;
remote_ptr<void> address, int process_index = ProcessIndexAny,
ReadMode mode = Normal) const MC_OVERRIDE;
public: // To be private
- mc_process_t process;
+ simgrid::mc::Process* process;
int num_state;
size_t heap_bytes_used;
std::vector<std::unique_ptr<s_mc_mem_region_t>> snapshot_regions;
XBT_INTERNAL void MC_restore_snapshot(mc_snapshot_t);
XBT_INTERNAL void mc_restore_page_snapshot_region(
- mc_process_t process,
+ simgrid::mc::Process* process,
void* start_addr, simgrid::mc::PerPageCopy const& pagenos);
MC_SHOULD_BE_INTERNAL const void* MC_region_read_fragmented(
/** Read from the target address space memory (libunwind method)
*
- * Delegates to the `mc_process_t`.
+ * Delegates to the `simgrid::mc::Process*`.
*/
static int access_mem(unw_addr_space_t as,
unw_word_t addr, unw_word_t *valp,
void* arg)
{
mc_unw_context_t context = (mc_unw_context_t) arg;
- mc_frame_t frame = context->process->find_function(remote(addr));
+ simgrid::mc::Frame* frame = context->process->find_function(remote(addr));
if (!frame)
return - UNW_ENOINFO;
*offp = (unw_word_t) frame->low_pc - addr;
// ***** Context management
int mc_unw_init_context(
- mc_unw_context_t context, mc_process_t process, unw_context_t* c)
+ mc_unw_context_t context, simgrid::mc::Process* process, unw_context_t* c)
{
context->address_space = process;
context->process = process;
{
if (!context->process || !context->address_space)
return -UNW_EUNSPEC;
- mc_address_space_t as = context->address_space;
+ simgrid::mc::AddressSpace* as = context->address_space;
- mc_process_t process = dynamic_cast<mc_process_t>(as);
+ simgrid::mc::Process* process = dynamic_cast<simgrid::mc::Process*>(as);
if (process && process->is_self())
return unw_init_local(cursor, &context->context);
*
* This component implements the libunwind API for he model-checker:
*
- * * reading memory from a mc_address_space_t;
+ * * reading memory from a simgrid::mc::AddressSpace*;
*
* * reading stack registers from a saved snapshot (context).
*
/** Virtual table for our `libunwind` implementation
*
- * Stack unwinding on a `mc_process_t` (for memory, unwinding information)
+ * Stack unwinding on a `simgrid::mc::Process*` (for memory, unwinding information)
* and `ucontext_t` (for processor registers).
*
* It works with the `s_mc_unw_context_t` context.
/** A `libunwind` context
*/
typedef struct s_mc_unw_context {
- mc_address_space_t address_space;
- mc_process_t process;
+ simgrid::mc::AddressSpace* address_space;
+ simgrid::mc::Process* process;
unw_context_t context;
} s_mc_unw_context_t, *mc_unw_context_t;
/** Initialises an already allocated context */
XBT_INTERNAL int mc_unw_init_context(
- mc_unw_context_t context, mc_process_t process, unw_context_t* c);
+ mc_unw_context_t context, simgrid::mc::Process* process, unw_context_t* c);
// ***** Libunwind cursor
*/
static mc_visited_state_t visited_state_new()
{
- mc_process_t process = &(mc_model_checker->process());
+ simgrid::mc::Process* process = &(mc_model_checker->process());
mc_visited_state_t new_state = xbt_new0(s_mc_visited_state_t, 1);
new_state->heap_bytes_used = mmalloc_get_bytes_used_remote(
process->get_heap()->heaplimit,
mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, mc_state_t graph_state)
{
- mc_process_t process = &(mc_model_checker->process());
+ simgrid::mc::Process* process = &(mc_model_checker->process());
mc_visited_pair_t pair = NULL;
pair = xbt_new0(s_mc_visited_pair_t, 1);
pair->graph_state = graph_state;
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include <xbt/sysdep.h>
+
#include "mc/AddressSpace.hpp"
#include "mc_xbt.hpp"
void MCer_ignore_global_variable(const char *name)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
xbt_assert(!process->object_infos.empty(), "MC subsystem not initialized");
- for (std::shared_ptr<s_mc_object_info_t> const& info : process->object_infos) {
+ for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info : process->object_infos) {
// Binary search:
int start = 0;
int end = info->global_variables.size() - 1;
while (start <= end) {
unsigned int cursor = (start + end) / 2;
- mc_variable_t current_var = &info->global_variables[cursor];
+ simgrid::mc::Variable* current_var = &info->global_variables[cursor];
int cmp = strcmp(current_var->name.c_str(), name);
if (cmp == 0) {
info->global_variables.erase(
static void mc_ignore_local_variable_in_scope(const char *var_name,
const char *subprogram_name,
- mc_frame_t subprogram,
- mc_frame_t scope);
+ simgrid::mc::Frame* subprogram,
+ simgrid::mc::Frame* scope);
static void MC_ignore_local_variable_in_object(const char *var_name,
const char *subprogram_name,
- mc_object_info_t info);
+ simgrid::mc::ObjectInformation* info);
void MC_ignore_local_variable(const char *var_name, const char *frame_name)
{
- mc_process_t process = &mc_model_checker->process();
+ simgrid::mc::Process* process = &mc_model_checker->process();
if (strcmp(frame_name, "*") == 0)
frame_name = NULL;
- for (std::shared_ptr<s_mc_object_info_t> const& info : process->object_infos)
+ for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info : process->object_infos)
MC_ignore_local_variable_in_object(var_name, frame_name, info.get());
}
static void MC_ignore_local_variable_in_object(const char *var_name,
const char *subprogram_name,
- mc_object_info_t info)
+ simgrid::mc::ObjectInformation* info)
{
for (auto& entry : info->subprograms)
mc_ignore_local_variable_in_scope(
*/
static void mc_ignore_local_variable_in_scope(const char *var_name,
const char *subprogram_name,
- mc_frame_t subprogram,
- mc_frame_t scope)
+ simgrid::mc::Frame* subprogram,
+ simgrid::mc::Frame* scope)
{
// Processing of direct variables:
// Dichotomic search:
while (start <= end) {
int cursor = (start + end) / 2;
- mc_variable_t current_var = &scope->variables[cursor];
+ simgrid::mc::Variable* current_var = &scope->variables[cursor];
int compare = strcmp(current_var->name.c_str(), var_name);
if (compare == 0) {
for (simgrid::mc::Frame& nested_scope : scope->scopes) {
// The new scope may be an inlined subroutine, in this case we want to use its
// namespaced name in recursive calls:
- mc_frame_t nested_subprogram =
+ simgrid::mc::Frame* nested_subprogram =
nested_scope.tag ==
DW_TAG_inlined_subroutine ? &nested_scope : subprogram;
int test_some_array[4][5][6];
struct some_struct { int first; int second[4][5]; } test_some_struct;
-static mc_type_t find_type_by_name(mc_object_info_t info, const char* name)
+static simgrid::mc::Type* find_type_by_name(simgrid::mc::ObjectInformation* info, const char* name)
{
for (auto& entry : info->types)
if(entry.second.name == name)
return nullptr;
}
-static mc_frame_t find_function_by_name(
- mc_object_info_t info, const char* name)
+static simgrid::mc::Frame* find_function_by_name(
+ simgrid::mc::ObjectInformation* info, const char* name)
{
for (auto& entry : info->subprograms)
if(entry.second.name == name)
return nullptr;
}
-static mc_variable_t find_local_variable(
- mc_frame_t frame, const char* argument_name)
+static simgrid::mc::Variable* find_local_variable(
+ simgrid::mc::Frame* frame, const char* argument_name)
{
for (simgrid::mc::Variable& variable : frame->variables)
if(argument_name == variable.name)
return nullptr;
}
-static void test_local_variable(mc_object_info_t info, const char* function, const char* variable, void* address, unw_cursor_t* cursor) {
- mc_frame_t subprogram = find_function_by_name(info, function);
+static void test_local_variable(simgrid::mc::ObjectInformation* info, const char* function, const char* variable, void* address, unw_cursor_t* cursor) {
+ simgrid::mc::Frame* subprogram = find_function_by_name(info, function);
assert(subprogram);
// TODO, Lookup frame by IP and test against name instead
- mc_variable_t var = find_local_variable(subprogram, variable);
+ simgrid::mc::Variable* var = find_local_variable(subprogram, variable);
assert(var);
void* frame_base = mc_find_frame_base(subprogram, info, cursor);
}
-static mc_variable_t test_global_variable(mc_process_t process, mc_object_info_t info, const char* name, void* address, long byte_size) {
+static simgrid::mc::Variable* test_global_variable(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info, const char* name, void* address, long byte_size) {
- mc_variable_t variable = info->find_variable(name);
+ simgrid::mc::Variable* variable = info->find_variable(name);
xbt_assert(variable, "Global variable %s was not found", name);
xbt_assert(variable->name == name,
"Name mismatch for %s", name);
auto i = process->binary_info->types.find(variable->type_id);
xbt_assert(i != process->binary_info->types.end(), "Missing type for %s", name);
- mc_type_t type = &i->second;
+ simgrid::mc::Type* type = &i->second;
xbt_assert(type->byte_size = byte_size, "Byte size mismatch for %s", name);
return variable;
}
-static mc_type_t find_member(mc_object_info_t info, const char* name, mc_type_t type)
+static simgrid::mc::Type* find_member(simgrid::mc::ObjectInformation* info, const char* name, simgrid::mc::Type* type)
{
for (simgrid::mc::Type& member : type->members)
if(member.name == name)
typedef struct foo {int i;} s_foo;
-static void test_type_by_name(mc_process_t process, s_foo my_foo)
+static void test_type_by_name(simgrid::mc::Process* process, s_foo my_foo)
{
assert(
process->binary_info->full_types_by_name.find("struct foo") !=
{
SIMIX_global_init(&argc, argv);
- mc_variable_t var;
- mc_type_t type;
+ simgrid::mc::Variable* var;
+ simgrid::mc::Type* type;
- s_mc_process_t p(getpid(), -1);
- mc_process_t process = &p;
+ simgrid::mc::Process p(getpid(), -1);
+ simgrid::mc::Process* process = &p;
test_global_variable(process, process->binary_info.get(),
"some_local_variable", &some_local_variable, sizeof(int));
#include "../src/mc/mc_private.h"
#include "../src/mc/mc_object_info.h"
-static mc_process_t process;
+static simgrid::mc::Process* process;
static
uintptr_t eval_binary_operation(mc_expression_state_t state, int op, uintptr_t a, uintptr_t b) {
s_mc_expression_state_t state;
memset(&state, 0, sizeof(s_mc_expression_state_t));
- state.address_space = (mc_address_space_t) process;
+ state.address_space = (simgrid::mc::AddressSpace*) process;
basic_test(&state);