environment:
global:
- BOOST_ROOT: c:\Libraries\boost
- BOOST_LIBRARYDIR: c:\Libraries\boost\stage\lib
+ BOOST_ROOT: c:\Libraries\boost_1_59_0
+ BOOST_LIBRARYDIR: c:\Libraries\boost_1_59_0\stage\lib
TESH_ARGS: C:/projects/simgrid/bin/tesh --setenv srcdir=C:/projects/simgrid/examples/java --setenv classpath=C:/projects/simgrid/examples/java;C:/projects/simgrid/teshsuite/java;C:/projects/simgrid/simgrid.jar --cd C:/projects/simgrid/examples/java
install:
# Strawberry perl is the one to work with gcc
-- choco install strawberryperl -version 5.20.1.1
+- choco install --limit-output strawberryperl -version 5.20.1.1
- SET PATH=C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH%
- cpanm --notest --quiet Win32API::File
- cpanm --notest --quiet IPC::Run
#- choco install lua53
# Basic dependencies: gcc and Cmake (must be placed before Perl in the path)
- SET PATH=C:\tools\mingw64\bin;%PATH%
-- choco install mingw cmake --limit-output
+- choco install --limit-output mingw cmake
- rename "C:\Program Files\Git\usr\bin\sh.exe" "sh-ignored.exe"
build_script:
# https://github.com/polysquare/cmake-unit/blob/master/appveyor.yml
# https://github.com/openvswitch/ovs/blob/master/appveyor.yml
-# https://github.com/behdad/harfbuzz/pull/112/files
\ No newline at end of file
+# https://github.com/behdad/harfbuzz/pull/112/files
int res = process.getChannel().send(MC_MESSAGE_CONTINUE);
if (res)
throw simgrid::xbt::errno_error(res);
- process.cache_flags = (mc_process_cache_flags_t) 0;
+ process.clear_cache();
}
static
m.pid = pid;
m.value = value;
process.getChannel().send(m);
- process.cache_flags = (mc_process_cache_flags_t) 0;
+ process.clear_cache();
while (process.running())
if (!this->handle_events())
return;
class ModelChecker {
struct pollfd fds_[2];
/** String pool for host names */
- // TODO, use std::unordered_set with heterogeneous comparison lookup (C++14)
+ // TODO, use std::set with heterogeneous comparison lookup (C++14)?
xbt_dict_t /* <hostname, nullptr> */ hostnames_;
// This is the parent snapshot of the current state:
PageStore page_store_;
this->smx_process_infos.clear();
this->smx_old_process_infos.clear();
this->unw_addr_space = unw_create_addr_space(&mc_unw_accessors , __BYTE_ORDER);
- this->unw_underlying_addr_space = unw_create_addr_space(&mc_unw_vmread_accessors, __BYTE_ORDER);
- this->unw_underlying_context = _UPT_create(this->pid_);
+ this->unw_underlying_addr_space = simgrid::unw::create_addr_space();
+ this->unw_underlying_context = simgrid::unw::create_context(
+ this->unw_underlying_addr_space, this->pid_);
}
Process::~Process()
this->heap = std::unique_ptr<s_xbt_mheap_t>(new s_xbt_mheap_t());
this->read_bytes(this->heap.get(), sizeof(struct mdesc),
remote(this->heap_address), simgrid::mc::ProcessIndexDisabled);
- this->cache_flags |= MC_PROCESS_CACHE_FLAG_HEAP;
+ this->cache_flags_ |= Process::cache_heap;
}
/** Refresh the information about the process
void Process::refresh_malloc_info()
{
xbt_assert(mc_mode == MC_MODE_SERVER);
- if (!(this->cache_flags & MC_PROCESS_CACHE_FLAG_HEAP))
- this->refresh_heap();
// Refresh process->heapinfo:
+ if (this->cache_flags_ & Process::cache_malloc)
+ return;
size_t count = this->heap->heaplimit + 1;
if (this->heap_info.size() < count)
this->heap_info.resize(count);
this->read_bytes(this->heap_info.data(), count * sizeof(malloc_info),
remote(this->heap->heapinfo), simgrid::mc::ProcessIndexDisabled);
- this->cache_flags |= MC_PROCESS_CACHE_FLAG_MALLOC_INFO;
+ this->cache_flags_ |= Process::cache_malloc;
}
/** @brief Finds the range of the different memory segments and binary paths */
#include "src/mc/mc_protocol.h"
#include "src/mc/ObjectInformation.hpp"
-// Those flags are used to track down which cached information
-// is still up to date and which information needs to be updated.
-typedef int mc_process_cache_flags_t;
-#define MC_PROCESS_CACHE_FLAG_NONE 0
-#define MC_PROCESS_CACHE_FLAG_HEAP 1
-#define MC_PROCESS_CACHE_FLAG_MALLOC_INFO 2
-#define MC_PROCESS_CACHE_FLAG_SIMIX_PROCESSES 4
namespace simgrid {
namespace mc {
* - etc.
*/
class Process final : public AddressSpace {
+private:
+ // Those flags are used to track down which cached information
+ // is still up to date and which information needs to be updated.
+ static constexpr int cache_none = 0;
+ static constexpr int cache_heap = 1;
+ static constexpr int cache_malloc = 2;
+ static constexpr int cache_simix_processes = 4;
public:
Process(pid_t pid, int sockfd);
~Process();
// Heap access:
xbt_mheap_t get_heap()
{
- if (!(this->cache_flags & MC_PROCESS_CACHE_FLAG_HEAP))
+ if (!(this->cache_flags_ & Process::cache_heap))
this->refresh_heap();
return this->heap.get();
}
malloc_info* get_malloc_info()
{
- if (!(this->cache_flags & MC_PROCESS_CACHE_FLAG_MALLOC_INFO))
+ if (!(this->cache_flags_ & Process::cache_malloc))
this->refresh_malloc_info();
return this->heap_info.data();
}
+
+ void clear_cache()
+ {
+ this->cache_flags_ = Process::cache_none;
+ }
Channel const& getChannel() const { return channel_; }
Channel& getChannel() { return channel_; }
*/
std::vector<SimixProcessInformation> smx_old_process_infos;
+private:
/** State of the cache (which variables are up to date) */
- mc_process_cache_flags_t cache_flags = MC_PROCESS_CACHE_FLAG_NONE;
+ int cache_flags_ = Process::cache_none;
+public:
/** Address of the heap structure in the MCed process. */
void* heap_address;
unsigned type_id = 0;
simgrid::mc::Type* type = nullptr;
- /** Address of the variable -if it is fixed) */
+ /** Address of the variable (if it is fixed) */
void* address = nullptr;
- /** Description of the location of the variable if it's not fixed */
+ /** Description of the location of the variable (if it's not fixed) */
simgrid::dwarf::LocationList location_list;
/** Offset of validity of the variable (DW_AT_start_scope)
*
- * This variable is not valid since the beginning of its scope.
+ * This is an offset from the variable scope beginning. This variable
+ * is only valid starting from this offset.
*/
std::size_t start_scope = 0;
if (use_soft_dirty)
mc_model_checker->process().reset_soft_dirty();
snapshot_ignore_restore(snapshot);
- mc_model_checker->process().cache_flags = 0;
+ mc_model_checker->process().clear_cache();
if (use_soft_dirty)
mc_model_checker->parent_snapshot_ = snapshot;
}
void Process::refresh_simix()
{
xbt_assert(mc_mode == MC_MODE_SERVER);
- if (this->cache_flags & MC_PROCESS_CACHE_FLAG_SIMIX_PROCESSES)
+ if (this->cache_flags_ & Process::cache_simix_processes)
return;
// TODO, avoid to reload `&simix_global`, `simix_global`, `*simix_global`
MC_process_refresh_simix_process_list(
this, this->smx_old_process_infos, simix_global.process_to_destroy);
- this->cache_flags |= MC_PROCESS_CACHE_FLAG_SIMIX_PROCESSES;
+ this->cache_flags_ |= Process::cache_simix_processes;
}
}
* much here.
*/
+#include <sys/types.h>
+
#include <xbt/base.h>
#include <libunwind.h>
-#include "src/mc/Process.hpp"
+#include "src/mc/mc_forward.hpp"
+
+namespace simgrid {
+namespace unw {
+
+XBT_PRIVATE unw_addr_space_t create_addr_space();
+XBT_PRIVATE void* create_context(unw_addr_space_t as, pid_t pid);
+
+}
+}
SG_BEGIN_DECL()
// ***** Libunwind namespace
-/** Virtual table for our `libunwind-process_vm_readv` implementation.
- *
- * This implementation reuse most the code of `libunwind-ptrace` but
- * does not use ptrace() to read the target process memory by
- * `process_vm_readv()` or `/dev/${pid}/mem` if possible.
- *
- * Does not support any MC-specific behaviour (privatisation, snapshots)
- * and `ucontext_t`.
- *
- * It works with `void*` contexts allocated with `_UPT_create(pid)`.
- */
-extern XBT_PRIVATE unw_accessors_t mc_unw_vmread_accessors;
-
/** Virtual table for our `libunwind` implementation
*
* Stack unwinding on a `simgrid::mc::Process*` (for memory, unwinding information)
#include <libunwind.h>
#include <libunwind-ptrace.h>
+#include "src/mc/Process.hpp"
#include "src/mc/mc_unw.h"
-extern "C" {
-
/** \file
* Libunwind namespace implementation using process_vm_readv.
*.
/** Partial structure of libunwind-ptrace context in order to get the PID
*
- * The context type for libunwind-race is an opaque type. We need to get the
- * PID which is the first field. This is a hack which might break if the
- * libunwind-ptrace structure changes.
+ * HACK, The context type for libunwind-race is an opaque type.
+ * We need to get the PID which is the first field. This is a hack
+ * which might break if the libunwind-ptrace structure changes.
*/
struct _UPT_info {
pid_t pid;
return _UPT_access_mem(as, addr, valp, write, arg);
}
-unw_accessors_t mc_unw_vmread_accessors =
- {
- &_UPT_find_proc_info,
- &_UPT_put_unwind_info,
- &_UPT_get_dyn_info_list_addr,
- &access_mem,
- &_UPT_access_reg,
- &_UPT_access_fpreg,
- &_UPT_resume,
- &_UPT_get_proc_name
- };
+namespace simgrid {
+namespace unw {
+
+/** Virtual table for our `libunwind-process_vm_readv` implementation.
+ *
+ * This implementation reuse most the code of `libunwind-ptrace` but
+ * does not use ptrace() to read the target process memory by
+ * `process_vm_readv()` or `/dev/${pid}/mem` if possible.
+ *
+ * Does not support any MC-specific behaviour (privatisation, snapshots)
+ * and `ucontext_t`.
+ *
+ * It works with `void*` contexts allocated with `_UPT_create(pid)`.
+ */
+// TODO, we could get rid of this if we properly stop the model-checked
+// process before reading the memory.
+static unw_accessors_t accessors = {
+ &_UPT_find_proc_info,
+ &_UPT_put_unwind_info,
+ &_UPT_get_dyn_info_list_addr,
+ &access_mem,
+ &_UPT_access_reg,
+ &_UPT_access_fpreg,
+ &_UPT_resume,
+ &_UPT_get_proc_name
+};
+
+unw_addr_space_t create_addr_space()
+{
+ return unw_create_addr_space(&accessors, __BYTE_ORDER);
+}
+
+void* create_context(unw_addr_space_t as, pid_t pid)
+{
+ return _UPT_create(pid);
+}
}
+}
\ No newline at end of file