X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/19d07a23cba04f4f0ea06aa345a3d6548f580a5e..21822b9cfb88284c4d8d7cace7ac74a7356612ec:/src/mc/remote/RemoteSimulation.cpp diff --git a/src/mc/remote/RemoteSimulation.cpp b/src/mc/remote/RemoteSimulation.cpp index b9abdbe368..f50f60f4f8 100644 --- a/src/mc/remote/RemoteSimulation.cpp +++ b/src/mc/remote/RemoteSimulation.cpp @@ -16,7 +16,9 @@ #include #include // PROT_* +#include #include +#include using simgrid::mc::remote; @@ -60,6 +62,7 @@ static const std::vector filtered_libraries = { "libcrypt", "libcrypto", "libcurl", + "libcurl-gnutls", "libcxxrt", "libdebuginfod", "libdl", @@ -67,11 +70,17 @@ static const std::vector filtered_libraries = { "libelf", "libevent", "libexecinfo", + "libffi", "libflang", "libflangrti", "libgcc_s", + "libgmp", + "libgnutls", + "libgcrypt", "libgfortran", + "libgpg-error", "libgssapi_krb5", + "libhogweed", "libidn2", "libimf", "libintlc", @@ -82,13 +91,16 @@ static const std::vector filtered_libraries = { "libkrb5support", /*odd behaviour on fedora rawhide ... remove these when fixed*/ "liblber", "libldap", + "libldap_r", "liblua5.1", "liblua5.3", "liblzma", "libm", "libmd", + "libnettle", "libnghttp2", "libomp", + "libp11-kit", "libpapi", "libpcre2", "libpfm", @@ -98,6 +110,7 @@ static const std::vector filtered_libraries = { "libquadmath", "libresolv", "librt", + "librtmp", "libsasl2", "libselinux", "libssh", @@ -105,6 +118,7 @@ static const std::vector filtered_libraries = { "libssl", "libstdc++", "libsvml", + "libtasn1", "libtsan", /* gcc sanitizers */ "libubsan", /* gcc sanitizers */ "libunistring", @@ -115,11 +129,6 @@ static const std::vector filtered_libraries = { "libz", "libzstd"}; -static bool is_simgrid_lib(const std::string& libname) -{ - return libname == "libsimgrid"; -} - static bool is_filtered_lib(const std::string& libname) { return std::find(begin(filtered_libraries), end(filtered_libraries), libname) != end(filtered_libraries); @@ -202,14 +211,8 @@ static void zero_buffer_init() int open_vm(pid_t pid, int flags) { - const size_t buffer_size = 30; - char buffer[buffer_size]; - int res = snprintf(buffer, buffer_size, "/proc/%lli/mem", (long long)pid); - if (res < 0 || (size_t)res >= buffer_size) { - errno = ENAMETOOLONG; - return -1; - } - return open(buffer, flags); + std::string buffer = "/proc/" + std::to_string(pid) + "/mem"; + return open(buffer.c_str(), flags); } // ***** RemoteSimulation @@ -292,7 +295,6 @@ void RemoteSimulation::init_memory_map_info() this->maestro_stack_end_ = nullptr; this->object_infos.resize(0); this->binary_info = nullptr; - this->libsimgrid_info = nullptr; std::vector const& maps = this->memory_map_; @@ -341,8 +343,6 @@ void RemoteSimulation::init_memory_map_info() this->object_infos.push_back(info); if (is_executable) this->binary_info = info; - else if (is_simgrid_lib(libname)) - this->libsimgrid_info = info; } // Resolve time (including across different objects): @@ -481,102 +481,32 @@ void RemoteSimulation::ignore_region(std::uint64_t addr, std::size_t size) region.addr = addr; region.size = size; - if (ignored_regions_.empty()) { - ignored_regions_.push_back(region); - return; - } - - unsigned int cursor = 0; - const IgnoredRegion* current_region = nullptr; - - int start = 0; - int end = ignored_regions_.size() - 1; - while (start <= end) { - cursor = (start + end) / 2; - current_region = &ignored_regions_[cursor]; - if (current_region->addr == addr) { - if (current_region->size == size) - return; - else if (current_region->size < size) - start = cursor + 1; - else - end = cursor - 1; - } else if (current_region->addr < addr) - start = cursor + 1; - else - end = cursor - 1; - } - - std::size_t position; - if (current_region->addr == addr) { - if (current_region->size < size) - position = cursor + 1; - else - position = cursor; - } else if (current_region->addr < addr) - position = cursor + 1; - else - position = cursor; - ignored_regions_.insert(ignored_regions_.begin() + position, region); + auto pos = std::lower_bound(ignored_regions_.begin(), ignored_regions_.end(), region, + [](auto const& reg1, auto const& reg2) { + return reg1.addr < reg2.addr || (reg1.addr == reg2.addr && reg1.size < reg2.size); + }); + if (pos == ignored_regions_.end() || pos->addr != addr || pos->size != size) + ignored_regions_.insert(pos, region); } void RemoteSimulation::ignore_heap(IgnoredHeapRegion const& region) { - if (ignored_heap_.empty()) { - ignored_heap_.push_back(std::move(region)); - return; - } - - typedef std::vector::size_type size_type; - - size_type start = 0; - size_type end = ignored_heap_.size() - 1; - // Binary search the position of insertion: - size_type cursor; - while (start <= end) { - cursor = start + (end - start) / 2; - auto const& current_region = ignored_heap_[cursor]; - if (current_region.address == region.address) - return; - else if (current_region.address < region.address) - start = cursor + 1; - else if (cursor != 0) - end = cursor - 1; - // Avoid underflow: - else - break; + auto pos = std::lower_bound(ignored_heap_.begin(), ignored_heap_.end(), region.address, + [](auto const& reg, const void* address) { return reg.address < address; }); + if (pos == ignored_heap_.end() || pos->address != region.address) { + // Insert it: + ignored_heap_.insert(pos, region); } - - // Insert it mc_heap_ignore_region_t: - if (ignored_heap_[cursor].address < region.address) - ++cursor; - ignored_heap_.insert(ignored_heap_.begin() + cursor, region); } void RemoteSimulation::unignore_heap(void* address, size_t size) { - typedef std::vector::size_type size_type; - - size_type start = 0; - size_type end = ignored_heap_.size() - 1; - // Binary search: - size_type cursor; - while (start <= end) { - cursor = (start + end) / 2; - auto const& region = ignored_heap_[cursor]; - if (region.address < address) - start = cursor + 1; - else if ((char*)region.address <= ((char*)address + size)) { - ignored_heap_.erase(ignored_heap_.begin() + cursor); - return; - } else if (cursor != 0) - end = cursor - 1; - // Avoid underflow: - else - break; - } + auto pos = std::lower_bound(ignored_heap_.begin(), ignored_heap_.end(), address, + [](auto const& reg, const void* address) { return reg.address < address; }); + if (pos != ignored_heap_.end() && static_cast(pos->address) <= static_cast(address) + size) + ignored_heap_.erase(pos); } void RemoteSimulation::ignore_local_variable(const char* var_name, const char* frame_name) const