return nullptr;
}
-simgrid::mc::Variable* ObjectInformation::find_variable(const char* name) const
+const simgrid::mc::Variable* ObjectInformation::find_variable(const char* name) const
{
- for (simgrid::mc::Variable& variable : this->global_variables)
+ for (simgrid::mc::Variable const& variable : this->global_variables)
if(variable.name == name)
return &variable;
return nullptr;
*/
std::vector<FunctionIndexEntry> functions_index;
- // TODO, remove the mutable (to remove it we'll have to add a lot of const everywhere)
- mutable std::vector<simgrid::mc::Variable> global_variables;
+ std::vector<simgrid::mc::Variable> global_variables;
/** Types indexed by DWARF ID */
std::unordered_map<std::uint64_t, simgrid::mc::Type> types;
* @param name scopes name of the global variable (`myproject::Foo::count`)
* @return corresponding variable (if any) or nullptr
*/
- simgrid::mc::Variable* find_variable(const char* name) const;
+ const simgrid::mc::Variable* find_variable(const char* name) const;
/** Remove a global variable (in order to ignore it)
*
this->memory_file = fd;
// Read std_heap (is a struct mdesc*):
- simgrid::mc::Variable* std_heap_var = this->find_variable("__mmalloc_default_mdp");
+ const simgrid::mc::Variable* std_heap_var = this->find_variable("__mmalloc_default_mdp");
if (not std_heap_var)
xbt_die("No heap information in the target process");
if (not std_heap_var->address)
/** Find (one occurrence of) the named variable definition
*/
-simgrid::mc::Variable* RemoteClient::find_variable(const char* name) const
+const simgrid::mc::Variable* RemoteClient::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
// We need to look up the variable in the executable first.
if (this->binary_info) {
std::shared_ptr<simgrid::mc::ObjectInformation> const& info = this->binary_info;
- simgrid::mc::Variable* var = info->find_variable(name);
+ const simgrid::mc::Variable* var = info->find_variable(name);
if (var)
return var;
}
for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info : this->object_infos) {
- simgrid::mc::Variable* var = info->find_variable(name);
+ const simgrid::mc::Variable* var = info->find_variable(name);
if (var)
return var;
}
void RemoteClient::read_variable(const char* name, void* target, size_t size) const
{
- simgrid::mc::Variable* var = this->find_variable(name);
+ const simgrid::mc::Variable* var = this->find_variable(name);
xbt_assert(var->address, "No simple location for this variable");
xbt_assert(var->type->full_type, "Partial type for %s, cannot check size", name);
xbt_assert((size_t)var->type->full_type->byte_size == size, "Unexpected size for %s (expected %zu, was %zu)", name,
std::shared_ptr<simgrid::mc::ObjectInformation> find_object_info_exec(RemotePtr<void> addr) const;
std::shared_ptr<simgrid::mc::ObjectInformation> find_object_info_rw(RemotePtr<void> addr) const;
simgrid::mc::Frame* find_function(RemotePtr<void> ip) const;
- simgrid::mc::Variable* find_variable(const char* name) const;
+ const simgrid::mc::Variable* find_variable(const char* name) const;
// Heap access:
xbt_mheap_t get_heap()
xbt_assert(location.address() == address, "Bad resolution of local variable %s of %s", variable, function);
}
-static simgrid::mc::Variable* test_global_variable(simgrid::mc::RemoteClient& process,
- simgrid::mc::ObjectInformation* info, const char* name,
- void* address, long byte_size)
+static const simgrid::mc::Variable* test_global_variable(simgrid::mc::RemoteClient& process,
+ simgrid::mc::ObjectInformation* info, const char* name,
+ void* address, long byte_size)
{
- simgrid::mc::Variable* variable = info->find_variable(name);
+ const 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);
xbt_assert(variable->global, "Variable %s is not global", name);
{
SIMIX_global_init(&argc, argv);
- simgrid::mc::Variable* var;
+ const simgrid::mc::Variable* var;
simgrid::mc::Type* type;
simgrid::mc::RemoteClient process(getpid(), -1);