Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add parameter simix/breakpoint. Fixes #143.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 19 Apr 2018 20:43:35 +0000 (22:43 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 19 Apr 2018 21:01:36 +0000 (23:01 +0200)
ChangeLog
doc/doxygen/options.doc
src/simix/smx_global.cpp

index e85b360..71afbb0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@ TRACE
  - Introduced new function simgrid::s4u::Host::get_actor_count. This function
    returns the number of actors running on a specific host.
 
  - Introduced new function simgrid::s4u::Host::get_actor_count. This function
    returns the number of actors running on a specific host.
 
+ Simix:
+ - Add parameter --cfg=simix/breakpoint to raise a SIGTRAP at given time.
+
  SMPI:
  - Replay: The replay file has been re-written in C++.
  - Replay: Tags used for messages sent via MPI_Send / MPI_Recv are now
  SMPI:
  - Replay: The replay file has been re-written in C++.
  - Replay: Tags used for messages sent via MPI_Send / MPI_Recv are now
@@ -18,6 +21,7 @@ TRACE
            the C++ API has been slightly improved.
 
  Fixed bugs:
            the C++ API has been slightly improved.
 
  Fixed bugs:
+ - #143: Setting a breakpoint at a given time
  - #258: daemonized actors hang after all non-daemonized actors have completed
 
 ----------------------------------------------------------------------------
  - #258: daemonized actors hang after all non-daemonized actors have completed
 
 ----------------------------------------------------------------------------
index 02e1350..dff9c9c 100644 (file)
@@ -130,6 +130,8 @@ int main(int argc, char *argv[]) {
 - \c path: \ref options_generic_path
 - \c plugin: \ref options_generic_plugin
 
 - \c path: \ref options_generic_path
 - \c plugin: \ref options_generic_plugin
 
+- \c simix/breakpoint: \ref options_generic_breakpoint
+
 - \c storage/max_file_descriptors: \ref option_model_storage_maxfd
 
 - \c surf/precision: \ref options_model_precision
 - \c storage/max_file_descriptors: \ref option_model_storage_maxfd
 
 - \c surf/precision: \ref options_model_precision
@@ -1264,6 +1266,23 @@ item several times, as in \verbatim
 --cfg=path:toto --cfg=path:tutu
 \endverbatim
 
 --cfg=path:toto --cfg=path:tutu
 \endverbatim
 
+\subsection options_generic_breakpoint Set a breakpoint
+
+\verbatim
+--cfg=simix/breakpoint:3.1416
+\endverbatim
+
+This configuration option sets a breakpoint: when the simulated clock reaches
+the given time, a SIGTRAP is raised.  This can be used to stop the execution and
+get a backtrace with a debugger.
+
+It is also possible to set the breakpoint from inside the debugger, by writing
+in global variable simgrid::simix::breakpoint. For example, with gdb:
+
+\verbatim
+set variable simgrid::simix::breakpoint = 3.1416
+\endverbatim
+
 \subsection options_generic_exit Behavior on Ctrl-C
 
 By default, when Ctrl-C is pressed, the status of all existing
 \subsection options_generic_exit Behavior on Ctrl-C
 
 By default, when Ctrl-C is pressed, the status of all existing
index 37ebaba..683ed17 100644 (file)
@@ -158,6 +158,8 @@ namespace simix {
 
 simgrid::xbt::signal<void()> onDeadlock;
 
 
 simgrid::xbt::signal<void()> onDeadlock;
 
+simgrid::config::Flag<double> breakpoint{"simix/breakpoint",
+                                         "When non-negative, raise a SIGTRAP after given (simulated) time", -1.0};
 }
 }
 
 }
 }
 
@@ -395,6 +397,12 @@ void SIMIX_run()
   do {
     XBT_DEBUG("New Schedule Round; size(queue)=%zu", simix_global->process_to_run.size());
 
   do {
     XBT_DEBUG("New Schedule Round; size(queue)=%zu", simix_global->process_to_run.size());
 
+    if (simgrid::simix::breakpoint >= 0.0 && time >= simgrid::simix::breakpoint) {
+      XBT_DEBUG("Breakpoint reached (%g)", simgrid::simix::breakpoint.get());
+      simgrid::simix::breakpoint = -1.0;
+      raise(SIGTRAP);
+    }
+
     SIMIX_execute_tasks();
 
     while (not simix_global->process_to_run.empty()) {
     SIMIX_execute_tasks();
 
     while (not simix_global->process_to_run.empty()) {