X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e5b02b8cdb65a2d3f160efae2e4cf27d7fcfa89b..d89ca681772fdaafdd69049d4d66676a4e98de38:/src/mc/remote/RemoteProcess.cpp diff --git a/src/mc/remote/RemoteProcess.cpp b/src/mc/remote/RemoteProcess.cpp index 64b83b5a92..fcde1d3f42 100644 --- a/src/mc/remote/RemoteProcess.cpp +++ b/src/mc/remote/RemoteProcess.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2014-2022. 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. */ @@ -35,6 +35,7 @@ namespace mc { static const std::vector filtered_libraries = { #ifdef __linux__ "ld", + "ld-linux-x86", #elif defined __FreeBSD__ "ld-elf", "ld-elf32", @@ -100,8 +101,6 @@ static const std::vector filtered_libraries = { "liblber", "libldap", "libldap_r", - "liblua5.1", - "liblua5.3", "liblzma", "libm", "libmd", @@ -217,12 +216,13 @@ int open_vm(pid_t pid, int flags) RemoteProcess::RemoteProcess(pid_t pid) : AddressSpace(this), pid_(pid), running_(true) {} -void RemoteProcess::init(void* mmalloc_default_mdp, void* maxpid, void* actors, void* dead_actors) +void RemoteProcess::init(xbt_mheap_t mmalloc_default_mdp, unsigned long* maxpid, xbt_dynar_t actors, + xbt_dynar_t dead_actors) { - this->heap_address = mmalloc_default_mdp; - this->maxpid_addr_ = maxpid; - this->actors_addr_ = actors; - this->dead_actors_addr_ = dead_actors; + this->heap_address = remote(mmalloc_default_mdp); + this->maxpid_addr_ = remote(maxpid); + this->actors_addr_ = remote(actors); + this->dead_actors_addr_ = remote(dead_actors); this->memory_map_ = simgrid::xbt::get_memory_map(this->pid_); this->init_memory_map_info(); @@ -263,7 +263,7 @@ void RemoteProcess::refresh_heap() // Read/dereference/refresh the std_heap pointer: if (not this->heap) this->heap = std::make_unique(); - this->read_bytes(this->heap.get(), sizeof(mdesc), remote(this->heap_address)); + this->read(this->heap.get(), this->heap_address); this->cache_flags_ |= RemoteProcess::cache_heap; } @@ -290,15 +290,13 @@ void RemoteProcess::init_memory_map_info() XBT_DEBUG("Get debug information ..."); this->maestro_stack_start_ = nullptr; this->maestro_stack_end_ = nullptr; - this->object_infos.resize(0); + this->object_infos.clear(); this->binary_info = nullptr; std::vector const& maps = this->memory_map_; const char* current_name = nullptr; - this->object_infos.clear(); - for (size_t i = 0; i < maps.size(); i++) { simgrid::xbt::VmMap const& reg = maps[i]; const char* pathname = maps[i].pathname.c_str(); @@ -444,8 +442,8 @@ std::string RemoteProcess::read_string(RemotePtr address) const void* RemoteProcess::read_bytes(void* buffer, std::size_t size, RemotePtr address, ReadOptions /*options*/) const { - if (pread_whole(this->memory_file, buffer, size, (size_t)address.address()) < 0) - xbt_die("Read at %p from process %lli failed", (void*)address.address(), (long long)this->pid_); + xbt_assert(pread_whole(this->memory_file, buffer, size, (size_t)address.address()) != -1, + "Read at %p from process %lli failed", (void*)address.address(), (long long)this->pid_); return buffer; } @@ -457,8 +455,8 @@ void* RemoteProcess::read_bytes(void* buffer, std::size_t size, RemotePtr */ void RemoteProcess::write_bytes(const void* buffer, size_t len, RemotePtr address) const { - if (pwrite_whole(this->memory_file, buffer, len, (size_t)address.address()) < 0) - xbt_die("Write to process %lli failed", (long long)this->pid_); + xbt_assert(pwrite_whole(this->memory_file, buffer, len, (size_t)address.address()) != -1, + "Write to process %lli failed", (long long)this->pid_); } static void zero_buffer_init(const void** zero_buffer, size_t zero_buffer_size) @@ -558,7 +556,7 @@ void RemoteProcess::dump_stack() const if (unw_init_remote(&cursor, as, context) != 0) { _UPT_destroy(context); unw_destroy_addr_space(as); - XBT_ERROR("Could not initialiez ptrace cursor"); + XBT_ERROR("Could not initialize ptrace cursor"); return; } @@ -567,18 +565,5 @@ void RemoteProcess::dump_stack() const _UPT_destroy(context); unw_destroy_addr_space(as); } - -unsigned long RemoteProcess::get_maxpid() const -{ - unsigned long maxpid; - this->read_bytes(&maxpid, sizeof(unsigned long), remote(maxpid_addr_)); - return maxpid; -} - -void RemoteProcess::get_actor_vectors(RemotePtr& actors, RemotePtr& dead_actors) -{ - actors = remote(static_cast(actors_addr_)); - dead_actors = remote(static_cast(dead_actors_addr_)); -} } // namespace mc } // namespace simgrid