From: Gabriel Corona Date: Tue, 1 Mar 2016 09:19:23 +0000 (+0100) Subject: Coding style: camel case RemotePtr X-Git-Tag: v3_13~609 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/27f768c6fbe663c6de000473c44a61222b77d481 Coding style: camel case RemotePtr --- diff --git a/src/mc/AddressSpace.hpp b/src/mc/AddressSpace.hpp index 0ff146ac86..a5ff9b382e 100644 --- a/src/mc/AddressSpace.hpp +++ b/src/mc/AddressSpace.hpp @@ -12,7 +12,7 @@ #include #include "src/mc/mc_forward.hpp" -#include "src/mc/remote_ptr.hpp" +#include "src/mc/RemotePtr.hpp" namespace simgrid { namespace mc { @@ -116,19 +116,19 @@ public: * @param options */ virtual const void* read_bytes(void* buffer, std::size_t size, - remote_ptr address, int process_index = ProcessIndexAny, + RemotePtr address, int process_index = ProcessIndexAny, ReadOptions options = ReadOptions::none()) const = 0; /** Read a given data structure from the address space */ template inline - void read(T *buffer, remote_ptr ptr, int process_index = ProcessIndexAny) + void read(T *buffer, RemotePtr ptr, int process_index = ProcessIndexAny) { this->read_bytes(buffer, sizeof(T), ptr, process_index); } /** Read a given data structure from the address space */ template inline - T read(remote_ptr ptr, int process_index = ProcessIndexMissing) + T read(RemotePtr ptr, int process_index = ProcessIndexMissing) { static_assert(std::is_trivial::value, "Cannot read a non-trivial type"); T res; diff --git a/src/mc/ChunkedData.cpp b/src/mc/ChunkedData.cpp index cfacbfafda..89dc272219 100644 --- a/src/mc/ChunkedData.cpp +++ b/src/mc/ChunkedData.cpp @@ -28,7 +28,7 @@ namespace mc { * @return Snapshot page numbers of this new snapshot */ ChunkedData::ChunkedData(PageStore& store, AddressSpace& as, - remote_ptr addr, std::size_t page_count, + RemotePtr addr, std::size_t page_count, const std::size_t* ref_page_numbers, const std::uint64_t* pagemap) { store_ = &store; @@ -44,7 +44,7 @@ ChunkedData::ChunkedData(PageStore& store, AddressSpace& as, continue; } - remote_ptr page = remote(addr.address() + (i << xbt_pagebits)); + RemotePtr page = remote(addr.address() + (i << xbt_pagebits)); xbt_assert(mc_page_offset((void*)page.address())==0, "Not at the beginning of a page"); diff --git a/src/mc/ChunkedData.hpp b/src/mc/ChunkedData.hpp index 20711dff26..3c414be4e4 100644 --- a/src/mc/ChunkedData.hpp +++ b/src/mc/ChunkedData.hpp @@ -83,7 +83,7 @@ public: } ChunkedData(PageStore& store, AddressSpace& as, - remote_ptr addr, std::size_t page_count, + RemotePtr addr, std::size_t page_count, const std::size_t* ref_page_numbers, const std::uint64_t* pagemap); }; diff --git a/src/mc/ModelChecker.cpp b/src/mc/ModelChecker.cpp index 92895002f4..15f6d234c8 100644 --- a/src/mc/ModelChecker.cpp +++ b/src/mc/ModelChecker.cpp @@ -263,7 +263,7 @@ bool ModelChecker::handle_message(char* buffer, ssize_t size) _mc_property_automaton = xbt_automaton_new(); simgrid::mc::Process* process = &this->process(); - simgrid::mc::remote_ptr address + simgrid::mc::RemotePtr address = simgrid::mc::remote((int*) message.data); simgrid::xbt::add_proposition(_mc_property_automaton, message.name, diff --git a/src/mc/Process.cpp b/src/mc/Process.cpp index 482c07d1a3..ed5880b0ca 100644 --- a/src/mc/Process.cpp +++ b/src/mc/Process.cpp @@ -390,7 +390,7 @@ void Process::init_memory_map_info() XBT_DEBUG("Get debug information done !"); } -std::shared_ptr Process::find_object_info(remote_ptr addr) const +std::shared_ptr Process::find_object_info(RemotePtr addr) const { for (auto const& object_info : this->object_infos) { if (addr.address() >= (std::uint64_t)object_info->start @@ -401,7 +401,7 @@ std::shared_ptr Process::find_object_info(remote return nullptr; } -std::shared_ptr Process::find_object_info_exec(remote_ptr addr) const +std::shared_ptr Process::find_object_info_exec(RemotePtr addr) const { for (std::shared_ptr const& info : this->object_infos) { if (addr.address() >= (std::uint64_t) info->start_exec @@ -412,7 +412,7 @@ std::shared_ptr Process::find_object_info_exec(remote_ptr Process::find_object_info_rw(remote_ptr addr) const +std::shared_ptr Process::find_object_info_rw(RemotePtr addr) const { for (std::shared_ptr const& info : this->object_infos) { if (addr.address() >= (std::uint64_t)info->start_rw @@ -423,7 +423,7 @@ std::shared_ptr Process::find_object_info_rw(remote_ptr return nullptr; } -simgrid::mc::Frame* Process::find_function(remote_ptr ip) const +simgrid::mc::Frame* Process::find_function(RemotePtr ip) const { std::shared_ptr info = this->find_object_info_exec(ip); return info ? info->find_function((void*) ip.address()) : nullptr; @@ -466,7 +466,7 @@ void Process::read_variable(const char* name, void* target, size_t size) const this->read_bytes(target, size, remote(var->address)); } -char* Process::read_string(remote_ptr address) const +char* Process::read_string(RemotePtr address) const { if (!address) return nullptr; @@ -499,7 +499,7 @@ char* Process::read_string(remote_ptr address) const } const void *Process::read_bytes(void* buffer, std::size_t size, - remote_ptr address, int process_index, + RemotePtr address, int process_index, ReadOptions options) const { if (process_index != simgrid::mc::ProcessIndexDisabled) { @@ -541,13 +541,13 @@ const void *Process::read_bytes(void* buffer, std::size_t size, * @param remote target process memory address (target) * @param len data size */ -void Process::write_bytes(const void* buffer, size_t len, remote_ptr address) +void Process::write_bytes(const void* buffer, size_t len, RemotePtr address) { if (pwrite_whole(this->memory_file, buffer, len, address.address()) < 0) xbt_die("Write to process %lli failed", (long long) this->pid_); } -void Process::clear_bytes(remote_ptr address, size_t len) +void Process::clear_bytes(RemotePtr address, size_t len) { pthread_once(&zero_buffer_flag, MC_zero_buffer_init); while (len) { diff --git a/src/mc/Process.hpp b/src/mc/Process.hpp index 4ab4e06ef9..62fad58620 100644 --- a/src/mc/Process.hpp +++ b/src/mc/Process.hpp @@ -76,7 +76,7 @@ public: // Read memory: const void* read_bytes(void* buffer, std::size_t size, - remote_ptr address, int process_index = ProcessIndexAny, + RemotePtr address, int process_index = ProcessIndexAny, ReadOptions options = ReadOptions::none()) const override; void read_variable(const char* name, void* target, size_t size) const; template @@ -87,17 +87,17 @@ public: read_variable(name, &res, sizeof(T)); return res; } - char* read_string(remote_ptr address) const; + char* read_string(RemotePtr address) const; // Write memory: - void write_bytes(const void* buffer, size_t len, remote_ptr address); - void clear_bytes(remote_ptr address, size_t len); + void write_bytes(const void* buffer, size_t len, RemotePtr address); + void clear_bytes(RemotePtr address, size_t len); // Debug information: - std::shared_ptr find_object_info(remote_ptr addr) const; - std::shared_ptr find_object_info_exec(remote_ptr addr) const; - std::shared_ptr find_object_info_rw(remote_ptr addr) const; - simgrid::mc::Frame* find_function(remote_ptr ip) const; + std::shared_ptr find_object_info(RemotePtr addr) const; + std::shared_ptr find_object_info_exec(RemotePtr addr) const; + std::shared_ptr find_object_info_rw(RemotePtr addr) const; + simgrid::mc::Frame* find_function(RemotePtr ip) const; simgrid::mc::Variable* find_variable(const char* name) const; // Heap access: @@ -122,7 +122,7 @@ public: pid_t pid() const { return pid_; } - bool in_maestro_stack(remote_ptr p) const + bool in_maestro_stack(RemotePtr p) const { return p >= this->maestro_stack_start_ && p < this->maestro_stack_end_; } @@ -205,7 +205,7 @@ private: int socket_ = -1; bool running_ = false; std::vector memory_map_; - remote_ptr maestro_stack_start_, maestro_stack_end_; + RemotePtr maestro_stack_start_, maestro_stack_end_; int memory_file = -1; std::vector ignored_regions_; int clear_refs_fd_ = -1; diff --git a/src/mc/RegionSnapshot.hpp b/src/mc/RegionSnapshot.hpp index 9707681d3f..30beff1e20 100644 --- a/src/mc/RegionSnapshot.hpp +++ b/src/mc/RegionSnapshot.hpp @@ -15,7 +15,7 @@ #include -#include "src/mc/remote_ptr.hpp" +#include "src/mc/RemotePtr.hpp" #include "src/mc/PageStore.hpp" #include "src/mc/AddressSpace.hpp" #include "src/mc/ChunkedData.hpp" @@ -252,14 +252,14 @@ public: // Other getters - remote_ptr start() const { return remote(start_addr_); } - remote_ptr end() const { return remote((char*)start_addr_ + size_); } - remote_ptr permanent_address() const { return remote(permanent_addr_); } + RemotePtr start() const { return remote(start_addr_); } + RemotePtr end() const { return remote((char*)start_addr_ + size_); } + RemotePtr permanent_address() const { return remote(permanent_addr_); } std::size_t size() const { return size_; } StorageType storage_type() const { return storage_type_; } RegionType region_type() const { return region_type_; } - bool contain(remote_ptr p) const + bool contain(RemotePtr p) const { return p >= start() && p < end(); } diff --git a/src/mc/remote_ptr.hpp b/src/mc/RemotePtr.hpp similarity index 61% rename from src/mc/remote_ptr.hpp rename to src/mc/RemotePtr.hpp index 9e0d85dbe4..c9a931c1d7 100644 --- a/src/mc/remote_ptr.hpp +++ b/src/mc/RemotePtr.hpp @@ -23,15 +23,15 @@ namespace mc { * model-checker. * * We do not actually store the target address space because we can - * always detect it in context. This way `remote_ptr` is as efficient + * always detect it in context. This way `RemotePtr` is as efficient * as a `uint64_t`. */ -template class remote_ptr { +template class RemotePtr { std::uint64_t address_; public: - remote_ptr() : address_(0) {} - remote_ptr(std::uint64_t address) : address_(address) {} - remote_ptr(T* address) : address_((std::uintptr_t)address) {} + RemotePtr() : address_(0) {} + RemotePtr(std::uint64_t address) : address_(address) {} + RemotePtr(T* address) : address_((std::uintptr_t)address) {} std::uint64_t address() const { return address_; } operator bool() const @@ -42,24 +42,24 @@ public: { return !address_; } - operator remote_ptr() const + operator RemotePtr() const { - return remote_ptr(address_); + return RemotePtr(address_); } - remote_ptr operator+(std::uint64_t n) const + RemotePtr operator+(std::uint64_t n) const { - return remote_ptr(address_ + n * sizeof(T)); + return RemotePtr(address_ + n * sizeof(T)); } - remote_ptr operator-(std::uint64_t n) const + RemotePtr operator-(std::uint64_t n) const { - return remote_ptr(address_ - n * sizeof(T)); + return RemotePtr(address_ - n * sizeof(T)); } - remote_ptr& operator+=(std::uint64_t n) + RemotePtr& operator+=(std::uint64_t n) { address_ += n * sizeof(T); return *this; } - remote_ptr& operator-=(std::uint64_t n) + RemotePtr& operator-=(std::uint64_t n) { address_ -= n * sizeof(T); return *this; @@ -67,51 +67,51 @@ public: }; template -bool operator<(remote_ptr const& x, remote_ptr const& y) +bool operator<(RemotePtr const& x, RemotePtr const& y) { return x.address() < y.address(); } template -bool operator>(remote_ptr const& x, remote_ptr const& y) +bool operator>(RemotePtr const& x, RemotePtr const& y) { return x.address() > y.address(); } template -bool operator>=(remote_ptr const& x, remote_ptr const& y) +bool operator>=(RemotePtr const& x, RemotePtr const& y) { return x.address() >= y.address(); } template -bool operator<=(remote_ptr const& x, remote_ptr const& y) +bool operator<=(RemotePtr const& x, RemotePtr const& y) { return x.address() <= y.address(); } template -bool operator==(remote_ptr const& x, remote_ptr const& y) +bool operator==(RemotePtr const& x, RemotePtr const& y) { return x.address() == y.address(); } template -bool operator!=(remote_ptr const& x, remote_ptr const& y) +bool operator!=(RemotePtr const& x, RemotePtr const& y) { return x.address() != y.address(); } template inline -remote_ptr remote(T *p) +RemotePtr remote(T *p) { - return remote_ptr(p); + return RemotePtr(p); } template inline -remote_ptr remote(uint64_t p) +RemotePtr remote(uint64_t p) { - return remote_ptr(p); + return RemotePtr(p); } } diff --git a/src/mc/mc_snapshot.cpp b/src/mc/mc_snapshot.cpp index 70f2080d90..d39fbf7f38 100644 --- a/src/mc/mc_snapshot.cpp +++ b/src/mc/mc_snapshot.cpp @@ -176,7 +176,7 @@ Snapshot::~Snapshot() } const void* Snapshot::read_bytes(void* buffer, std::size_t size, - remote_ptr address, int process_index, + RemotePtr address, int process_index, ReadOptions options) const { mc_mem_region_t region = mc_get_snapshot_region((void*)address.address(), this, process_index); diff --git a/src/mc/mc_snapshot.h b/src/mc/mc_snapshot.h index a1e7399c2b..baaed85e7b 100644 --- a/src/mc/mc_snapshot.h +++ b/src/mc/mc_snapshot.h @@ -146,7 +146,7 @@ public: Snapshot(Process* process); ~Snapshot(); const void* read_bytes(void* buffer, std::size_t size, - remote_ptr address, int process_index = ProcessIndexAny, + RemotePtr address, int process_index = ProcessIndexAny, ReadOptions options = ReadOptions::none()) const override; public: // To be private int num_state; diff --git a/src/mc/mc_xbt.cpp b/src/mc/mc_xbt.cpp index bfdd15619b..b7e6f5a272 100644 --- a/src/mc/mc_xbt.cpp +++ b/src/mc/mc_xbt.cpp @@ -6,7 +6,7 @@ #include -#include "src/mc/remote_ptr.hpp" +#include "src/mc/RemotePtr.hpp" #include "src/mc/AddressSpace.hpp" #include "src/mc/mc_xbt.hpp" @@ -17,7 +17,7 @@ namespace simgrid { namespace mc { void read_element(AddressSpace const& as, - void* local, remote_ptr addr, std::size_t i, std::size_t len) + void* local, RemotePtr addr, std::size_t i, std::size_t len) { s_xbt_dynar_t d; as.read_bytes(&d, sizeof(d), addr); @@ -28,7 +28,7 @@ void read_element(AddressSpace const& as, as.read_bytes(local, len, remote(xbt_dynar_get_ptr(&d, i))); } -std::size_t read_length(AddressSpace const& as, remote_ptr addr) +std::size_t read_length(AddressSpace const& as, RemotePtr addr) { if (!addr) return 0; diff --git a/src/mc/mc_xbt.hpp b/src/mc/mc_xbt.hpp index cc23b1aca0..1d9a58153e 100644 --- a/src/mc/mc_xbt.hpp +++ b/src/mc/mc_xbt.hpp @@ -11,16 +11,16 @@ #include -#include "src/mc/remote_ptr.hpp" +#include "src/mc/RemotePtr.hpp" #include "src/mc/AddressSpace.hpp" namespace simgrid { namespace mc { XBT_PRIVATE void read_element(AddressSpace const& as, - void* local, remote_ptr addr, std::size_t i, std::size_t len); + void* local, RemotePtr addr, std::size_t i, std::size_t len); XBT_PRIVATE std::size_t read_length( - AddressSpace const& as, remote_ptr addr); + AddressSpace const& as, RemotePtr addr); } } diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 37233cd2b9..cd343b421f 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -550,7 +550,7 @@ set(MC_SRC_BASE ) set(MC_SRC - src/mc/remote_ptr.hpp + src/mc/RemotePtr.hpp src/mc/AddressSpace.hpp src/mc/AddressSpace.cpp src/mc/Frame.hpp