diff --git a/CMakeLists.txt b/CMakeLists.txt index aab776230..fd502bd6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,7 +146,6 @@ set( IO_SRC ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DRHDF5.cpp ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DataRecordDispatcher.cpp ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DataRecordGroup.cpp - ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DebugPause.cpp ${CMAKE_BINARY_DIR}/temp_src/io_src/io_EchoJobs.cpp ${CMAKE_BINARY_DIR}/temp_src/io_src/io_EnumAttributesMap.cpp ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Environment.cpp diff --git a/Makefile b/Makefile index f219d3e29..0d23a4dd7 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,6 @@ SIM_SERV_DIRS = \ ${TRICK_HOME}/trick_source/sim_services/Collect \ ${TRICK_HOME}/trick_source/sim_services/CommandLineArguments \ ${TRICK_HOME}/trick_source/sim_services/DataRecord \ - ${TRICK_HOME}/trick_source/sim_services/DebugPause \ ${TRICK_HOME}/trick_source/sim_services/EchoJobs \ ${TRICK_HOME}/trick_source/sim_services/Environment \ ${TRICK_HOME}/trick_source/sim_services/EventManager \ diff --git a/docs/howto_guides/Realtime-Best-Practices.md b/docs/howto_guides/Realtime-Best-Practices.md index b451d133c..a8ee3fe87 100644 --- a/docs/howto_guides/Realtime-Best-Practices.md +++ b/docs/howto_guides/Realtime-Best-Practices.md @@ -274,7 +274,6 @@ Inserting one or more of the ```#define``` statements listed below to the top of #define TRICK_NO_REALTIME #define TRICK_NO_FRAMELOG #define TRICK_NO_MASTERSLAVE -#define TRICK_NO_INSTRUMENTATION #define TRICK_NO_INTEGRATE #define TRICK_NO_REALTIMEINJECTOR #define TRICK_NO_ZEROCONF @@ -292,7 +291,6 @@ LIBRARY DEPENDENCIES: *************************************************************/ #define TRICK_NO_MONTE_CARLO #define TRICK_NO_MASTERSLAVE -#define TRICK_NO_INSTRUMENTATION #define TRICK_NO_REALTIMEINJECTOR #define TRICK_NO_ZEROCONF #define TRICK_NO_UNITTEST diff --git a/include/trick/DebugPause.hh b/include/trick/DebugPause.hh deleted file mode 100644 index 9ab94b874..000000000 --- a/include/trick/DebugPause.hh +++ /dev/null @@ -1,76 +0,0 @@ -/* - PURPOSE: - (Trick runtime simulation executive parameter definition.) - REFERENCE: - (((Bailey, R.W, and Paddock, E.J.) (Trick Simulation Environment) - (NASA:JSC #37943) - (JSC / Engineering Directorate / Automation and Robotics Division) - (June 1994) (--))) - ASSUMPTIONS AND LIMITATIONS: - ((Only 64 levels of nested input data file inclusion.)) - PROGRAMMERS: - (((Robert W. Bailey) (LinCom) (4/92) (--) (Realtime)) - ((Robert W. Bailey) (LinCom) (6/1/91) (Trick-CR-00000) (Initial Release))) -*/ - -#ifndef DEBUGPAUSE_HH -#define DEBUGPAUSE_HH - -#include -#include - -#include "trick/JobData.hh" - -namespace Trick { - - class DebugPause { - - public: - /** Set to true to pause before every job call during sim execution.\n */ - bool debug_pause_flag ; /**< trick_units(--) */ - - /** - @brief This is the constructor of the DebugPause class. - */ - DebugPause() ; - - /** - @brief Instrumentation class job that pauses before each job when debug_pause is on. - Waits on a semapahore before execution continues. - @param curr_job - pointer to current instrument job that points to the job to pause at - @return always 0 - */ - int debug_pause(Trick::JobData * curr_job) ; - - /** - @brief Command to post the semaphore so that execution continues after pause. - @return always 0 - */ - int debug_signal() ; - - /** - @brief Command to set debug_pause_flag to true which turns on the debug pausing. - Calls Trick::Executive::instrument_job_before to insert the debug_pause routine before every job to pause at. - @return always 0 - */ - int debug_pause_on() ; - - /** - @brief Command to set debug_pause_flag to false which turns off the debug pausing. - Calls Trick::Executive::instrument_job_remove to remove the debug_pause routine from all job queues that it was inserted in. - @return always 0 - */ - int debug_pause_off() ; - - private: - /** Semaphore used to control pausing.\n */ - sem_t * debug_sem ; /**< trick_io(**) trick_units(--) */ - /** Semaphore name for debug_sem.\n */ - std::string sem_name ; /**< trick_io(**) trick_units(--) */ - - } ; - -} - -#endif - diff --git a/include/trick/Executive.hh b/include/trick/Executive.hh index 2be2d27ee..b9cfb5de4 100644 --- a/include/trick/Executive.hh +++ b/include/trick/Executive.hh @@ -47,6 +47,9 @@ namespace Trick { /** gets #except_return */ virtual int get_except_return() const; + /** Set to true to pause before every job call during sim execution.\n */ + bool debug_pause_flag ; /**< trick_units(--) */ + protected: /** Attempts to attach a debugger in the event a signal shuts down the simulation.\n */ bool attach_debugger; /**< trick_units(--) */ @@ -174,6 +177,12 @@ namespace Trick { /** Next scheduled jobs call time.\n */ long long job_call_time_tics; /**< trick_units(--) */ + /** Semaphore used to control pausing.\n */ + sem_t * debug_sem ; /**< trick_io(**) trick_units(--) */ + + /** Semaphore name for debug_sem.\n */ + std::string debug_sem_name ; /**< trick_io(**) trick_units(--) */ + /** stream to record elapsed time of default_data, input_processor, and initialization queues \n */ std::ofstream init_log_stream; /**< trick_units(--) */ @@ -1221,6 +1230,14 @@ namespace Trick { */ virtual int run() ; + /** + @userdesc Command to step the simulation, pausing after each job. Set exec_command to StepCmd. + @par Python Usage: + @code trick.step() @endcode + @return always 0 + */ + virtual int step() ; + /** @userdesc Command to freeze the simulation now. Set exec_command to FreezeCmd. @par Python Usage: @@ -1330,6 +1347,34 @@ namespace Trick { @return always 0 */ virtual int exec_terminate(const char *file_name, const char *error); + + /** + @brief Instrumentation class job that pauses before each job when debug_pause is on. + Waits on a semapahore before execution continues. + @param curr_job - pointer to current instrument job that points to the job to pause at + @return always 0 + */ + int debug_pause(Trick::JobData * curr_job) ; + + /** + @brief Command to post the semaphore so that execution continues after pause. + @return always 0 + */ + int debug_signal() ; + + /** + @brief Command to set debug_pause_flag to true which turns on the debug pausing. + Calls Trick::Executive::instrument_job_before to insert the debug_pause routine before every job to pause at. + @return always 0 + */ + int debug_pause_on() ; + + /** + @brief Command to set debug_pause_flag to false which turns off the debug pausing. + Calls Trick::Executive::instrument_job_remove to remove the debug_pause routine from all job queues that it was inserted in. + @return always 0 + */ + int debug_pause_off() ; /* deleted functions */ private: diff --git a/include/trick/compat/sim_services/DebugPause/include/DebugPause.hh b/include/trick/compat/sim_services/DebugPause/include/DebugPause.hh deleted file mode 100644 index 57a716dbc..000000000 --- a/include/trick/compat/sim_services/DebugPause/include/DebugPause.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/DebugPause.hh" diff --git a/include/trick/compat/sim_services/DebugPause/include/debug_pause_proto.h b/include/trick/compat/sim_services/DebugPause/include/debug_pause_proto.h deleted file mode 100644 index 7ca4babd6..000000000 --- a/include/trick/compat/sim_services/DebugPause/include/debug_pause_proto.h +++ /dev/null @@ -1 +0,0 @@ -#include "trick/debug_pause_proto.h" diff --git a/include/trick/debug_pause_proto.h b/include/trick/debug_pause_proto.h deleted file mode 100644 index cc0308f4d..000000000 --- a/include/trick/debug_pause_proto.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef DEBUGPAUSE_PROTO_H -#define DEBUGPAUSE_PROTO_H - -#ifdef __cplusplus -extern "C" { -#endif - -int debug_pause_on(void) ; -int debug_pause_off(void) ; -int debug_signal(void) ; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/trick/exec_proto.h b/include/trick/exec_proto.h index d536c79eb..f92d25ca8 100644 --- a/include/trick/exec_proto.h +++ b/include/trick/exec_proto.h @@ -77,6 +77,7 @@ extern "C" { int exec_freeze(void) ; int exec_run(void) ; + int exec_step(void) ; void exec_signal_terminate(void) ; int exec_terminate(const char *, const char *) ; @@ -89,6 +90,10 @@ extern "C" { int exec_add_scheduled_job_class(const char * in_name) ; int exec_add_depends_on_job( const char * target_job_string , unsigned int t_instance , const char * depend_job_string , unsigned int d_instance ) ; + int debug_pause_on(void) ; + int debug_pause_off(void) ; + int debug_signal(void) ; + #ifdef __cplusplus } #endif diff --git a/include/trick/files_to_ICG.hh b/include/trick/files_to_ICG.hh index 19dd0071b..7e60845ba 100644 --- a/include/trick/files_to_ICG.hh +++ b/include/trick/files_to_ICG.hh @@ -81,7 +81,6 @@ #include "trick/DRAscii.hh" #include "trick/DRBinary.hh" #include "trick/DRHDF5.hh" -#include "trick/DebugPause.hh" #include "trick/EchoJobs.hh" #include "trick/FrameLog.hh" #include "trick/UnitTest.hh" diff --git a/include/trick/sim_mode.h b/include/trick/sim_mode.h index 1bdbd2ace..60b2b7465 100644 --- a/include/trick/sim_mode.h +++ b/include/trick/sim_mode.h @@ -19,6 +19,7 @@ typedef enum { NoCmd = 0 , /* NoCmd */ FreezeCmd = 2 , /* freeze */ RunCmd = 3 , /* run */ + StepCmd = 4, /* step */ ExitCmd = 10 , /* exit */ } SIM_COMMAND; diff --git a/share/trick/sim_objects/default_trick_sys.sm b/share/trick/sim_objects/default_trick_sys.sm index 24a5c8da3..a3d38e0c2 100644 --- a/share/trick/sim_objects/default_trick_sys.sm +++ b/share/trick/sim_objects/default_trick_sys.sm @@ -72,7 +72,6 @@ a replacement SimObject will create an uncompilable sim. ##include "trick/JSONVariableServer.hh" ##include "trick/data_record_proto.h" ##include "trick/DataRecordDispatcher.hh" -##include "trick/DebugPause.hh" ##include "trick/EchoJobs.hh" ##include "trick/FrameLog.hh" ##include "trick/UnitTest.hh" @@ -157,6 +156,8 @@ class SysSimObject : public Trick::SimObject { {TRK} ("system_advance_sim_time") sched.advance_sim_time() ; {TRK} ("system_thread_sync") sched.thread_sync() ; + + {TRK} ("instrumentation") sched.debug_pause(curr_job) ; } private: @@ -665,12 +666,10 @@ class InstrumentationSimObject : public Trick::SimObject { public: Trick::EchoJobs echo_jobs ; - Trick::DebugPause debug_pause ; InstrumentationSimObject() { // Instrumentation class jobs. Not scheduled by default {TRK} ("instrumentation") echo_jobs.echo_job(curr_job) ; - {TRK} ("instrumentation") debug_pause.debug_pause(curr_job) ; } } diff --git a/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java b/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java index b6b0ae9c6..921ba01e4 100644 --- a/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java +++ b/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java @@ -527,7 +527,7 @@ public void getInitializationPacket() { simRunDirField[i].setText("Slave " + i); } - commandSimcom.put("trick.var_exists(\"trick_instruments.debug_pause.debug_pause_flag\")\n") ; + commandSimcom.put("trick.var_exists(\"trick_sys.sched.debug_pause_flag\")\n") ; results = commandSimcom.get().split("\t"); debug_present = Integer.parseInt(results[1]); @@ -832,7 +832,7 @@ private void scheduleGetSimState() { "trick.var_add(\"trick_real_time.rt_sync.active\") \n"; if ( debug_present != 0 ) { - status_vars += "trick.var_add(\"trick_instruments.debug_pause.debug_pause_flag\")\n" ; + status_vars += "trick.var_add(\"trick_sys.sched.debug_pause_flag\")\n" ; } if ( overrun_present != 0 ) { status_vars += "trick.var_add(\"trick_real_time.rt_sync.total_overrun\")\n" ; @@ -1319,7 +1319,7 @@ private void updateGUI() { disableAllCommands(); setActionsEnabled("freezeSim,lite", true); if (debug_flag != 0) { - setActionsEnabled("stepSim,dumpChkpntASCII", true); + getAction("stepSim").setEnabled(true); } logoImagePanel.resume(); break; @@ -1334,6 +1334,11 @@ private void updateGUI() { break; } + // Disable the step button if instrumentation jobs are off. + if (debug_present == 0) { + getAction("stepSim").setEnabled(false); + } + runtimeStatePanel.setTitle(newStatusDesc); currentSimStatusDesc = runtimeStatePanel.getTitle(); } diff --git a/trick_source/java/src/main/java/trick/simcontrol/utils/SimControlActionController.java b/trick_source/java/src/main/java/trick/simcontrol/utils/SimControlActionController.java index dea9d703d..bf1d13cad 100644 --- a/trick_source/java/src/main/java/trick/simcontrol/utils/SimControlActionController.java +++ b/trick_source/java/src/main/java/trick/simcontrol/utils/SimControlActionController.java @@ -244,15 +244,8 @@ public void actionPerformed(ActionEvent e) { */ public void handleStep( int debug_flag ) { try { - if ( debug_flag == 0 ) { - simcom.put("trick.debug_pause_on()\n" + - "trick.exec_run()\n") ; - } else { - simcom.put("trick.debug_signal()\n") ; - } - } catch (IOException e) { - - } + simcom.put("trick.exec_step()\n") ; + } catch (IOException e) {} } /** diff --git a/trick_source/sim_services/CMakeLists.txt b/trick_source/sim_services/CMakeLists.txt index f251bcce4..e4e2a3a48 100644 --- a/trick_source/sim_services/CMakeLists.txt +++ b/trick_source/sim_services/CMakeLists.txt @@ -23,8 +23,6 @@ set( SS_SRC DataRecord/DataRecordDispatcher DataRecord/DataRecordGroup DataRecord/data_record_utilities - DebugPause/DebugPause - DebugPause/DebugPause_c_intf EchoJobs/EchoJobs EchoJobs/EchoJobs_c_intf Environment/Environment diff --git a/trick_source/sim_services/DebugPause/DebugPause_c_intf.cpp b/trick_source/sim_services/DebugPause/DebugPause_c_intf.cpp deleted file mode 100644 index b4b1e252e..000000000 --- a/trick_source/sim_services/DebugPause/DebugPause_c_intf.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include "trick/DebugPause.hh" - -/* Global singleton pointer to the echo jobs class */ -extern Trick::DebugPause * the_debug_pause ; - -/*************************************************************************/ -/* These routines are the "C" interface to echo jobs instrumentation */ -/*************************************************************************/ - -/** - * @relates Trick::DebugPause - * @copydoc Trick::DebugPause::debug_pause_on - * C wrapper for Trick::DebugPause::debug_pause_on - */ -extern "C" int debug_pause_on(void) { - if (the_debug_pause != NULL) { - return the_debug_pause->debug_pause_on() ; - } - return(0) ; -} - -/** - * @relates Trick::DebugPause - * @copydoc Trick::DebugPause::debug_pause_off - * C wrapper for Trick::DebugPause::debug_pause_off - */ -extern "C" int debug_pause_off(void) { - if (the_debug_pause != NULL) { - return the_debug_pause->debug_pause_off() ; - } - return(0) ; -} - -extern "C" int debug_signal(void) { - if (the_debug_pause != NULL) { - return the_debug_pause->debug_signal() ; - } - return(0) ; -} diff --git a/trick_source/sim_services/DebugPause/Makefile b/trick_source/sim_services/DebugPause/Makefile deleted file mode 100644 index 6f722048e..000000000 --- a/trick_source/sim_services/DebugPause/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -include $(dir $(lastword $(MAKEFILE_LIST)))../../../share/trick/makefiles/Makefile.common -include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib --include Makefile_deps diff --git a/trick_source/sim_services/DebugPause/Makefile_deps b/trick_source/sim_services/DebugPause/Makefile_deps deleted file mode 100644 index 58670972a..000000000 --- a/trick_source/sim_services/DebugPause/Makefile_deps +++ /dev/null @@ -1,22 +0,0 @@ -object_${TRICK_HOST_CPU}/DebugPause.o: DebugPause.cpp \ - ${TRICK_HOME}/include/trick/DebugPause.hh \ - ${TRICK_HOME}/include/trick/JobData.hh \ - ${TRICK_HOME}/include/trick/InstrumentBase.hh \ - ${TRICK_HOME}/include/trick/message_proto.h \ - ${TRICK_HOME}/include/trick/message_type.h \ - ${TRICK_HOME}/include/trick/exec_proto.h \ - ${TRICK_HOME}/include/trick/sim_mode.h \ - ${TRICK_HOME}/include/trick/exec_proto.hh \ - ${TRICK_HOME}/include/trick/Executive.hh \ - ${TRICK_HOME}/include/trick/Scheduler.hh \ - ${TRICK_HOME}/include/trick/ScheduledJobQueue.hh \ - ${TRICK_HOME}/include/trick/SimObject.hh \ - ${TRICK_HOME}/include/trick/ScheduledJobQueue.hh \ - ${TRICK_HOME}/include/trick/SimObject.hh \ - ${TRICK_HOME}/include/trick/Threads.hh \ - ${TRICK_HOME}/include/trick/ThreadBase.hh \ - ${TRICK_HOME}/include/trick/sim_mode.h -object_${TRICK_HOST_CPU}/DebugPause_c_intf.o: DebugPause_c_intf.cpp \ - ${TRICK_HOME}/include/trick/DebugPause.hh \ - ${TRICK_HOME}/include/trick/JobData.hh \ - ${TRICK_HOME}/include/trick/InstrumentBase.hh diff --git a/trick_source/sim_services/Executive/Executive.cpp b/trick_source/sim_services/Executive/Executive.cpp index 5b4759a7e..140f905cd 100644 --- a/trick_source/sim_services/Executive/Executive.cpp +++ b/trick_source/sim_services/Executive/Executive.cpp @@ -51,6 +51,9 @@ Trick::Executive::Executive() { software_frame = 1.0; frame_count = 0 ; stack_trace = true ; + + debug_pause_flag = false ; + /** @li (if on new-enough Linux) allow any process to ptrace this one. * This allows stack trace / debugger attach when ptrace is * restricted (e.g. on Ubuntu 16). diff --git a/trick_source/sim_services/Executive/Executive_c_intf.cpp b/trick_source/sim_services/Executive/Executive_c_intf.cpp index 8e88f0c05..13dad889a 100644 --- a/trick_source/sim_services/Executive/Executive_c_intf.cpp +++ b/trick_source/sim_services/Executive/Executive_c_intf.cpp @@ -801,6 +801,18 @@ extern "C" int exec_run() { return -1 ; } +/** + * @relates Trick::Executive + * @copydoc Trick::Executive::step + * C wrapper for Trick::Executive::step + */ +extern "C" int exec_step() { + if ( the_exec != NULL ) { + return the_exec->step() ; + } + return -1 ; +} + /** * @relates Trick::Executive @userdesc C wrapper to add an instrumentation job before all initialization, integration, @@ -1096,3 +1108,34 @@ int exec_register_scheduler( Trick::Scheduler * scheduler ) { return -1 ; } +/** + * @relates Trick::DebugPause + * @copydoc Trick::DebugPause::debug_pause_on + * C wrapper for Trick::DebugPause::debug_pause_on + */ +extern "C" int debug_pause_on(void) { + if (the_exec != NULL) { + return the_exec->debug_pause_on() ; + } + return(0) ; +} + +/** + * @relates Trick::DebugPause + * @copydoc Trick::DebugPause::debug_pause_off + * C wrapper for Trick::DebugPause::debug_pause_off + */ +extern "C" int debug_pause_off(void) { + if (the_exec != NULL) { + return the_exec->debug_pause_off() ; + } + return(0) ; +} + +extern "C" int debug_signal(void) { + if (the_exec != NULL) { + return the_exec->debug_signal() ; + } + return(0) ; +} + diff --git a/trick_source/sim_services/DebugPause/DebugPause.cpp b/trick_source/sim_services/Executive/Executive_debug_pause.cpp similarity index 67% rename from trick_source/sim_services/DebugPause/DebugPause.cpp rename to trick_source/sim_services/Executive/Executive_debug_pause.cpp index b95bcbd20..fab192f65 100644 --- a/trick_source/sim_services/DebugPause/DebugPause.cpp +++ b/trick_source/sim_services/Executive/Executive_debug_pause.cpp @@ -7,21 +7,13 @@ #include #include -#include "trick/DebugPause.hh" +#include "trick/Executive.hh" #include "trick/message_proto.h" #include "trick/message_type.h" #include "trick/exec_proto.h" #include "trick/exec_proto.hh" - -Trick::DebugPause * the_debug_pause = NULL ; - -Trick::DebugPause::DebugPause() { - debug_pause_flag = false ; - the_debug_pause = this ; -} - -int Trick::DebugPause::debug_pause(Trick::JobData * curr_job) { +int Trick::Executive::debug_pause(Trick::JobData * curr_job) { // The target job was copied to sup_class_data in Trick::ScheduledJobQueueInstrument::call() Trick::JobData * target_job = (Trick::JobData *)curr_job->sup_class_data ; @@ -32,7 +24,7 @@ int Trick::DebugPause::debug_pause(Trick::JobData * curr_job) { // Pause for all job classes that are not initialization or for init jobs greater than phase 1. if ( target_job->job_class_name.compare("initialization") or target_job->phase > 1 ) { - message_publish(MSG_NORMAL, "%12.6f pausing before %s\n" , exec_get_sim_time() , + message_publish(MSG_NORMAL, "%12.6f pausing before %s\n" , get_sim_time() , target_job->name.c_str() ) ; do { @@ -51,14 +43,14 @@ int Trick::DebugPause::debug_pause(Trick::JobData * curr_job) { } -int Trick::DebugPause::debug_signal() { +int Trick::Executive::debug_signal() { sem_post(debug_sem); return(0) ; } -int Trick::DebugPause::debug_pause_on() { +int Trick::Executive::debug_pause_on() { std::stringstream sem_name_stream ; @@ -68,12 +60,12 @@ int Trick::DebugPause::debug_pause_on() { debug_pause_flag = true ; - sem_name_stream << "itimersepmaphore_" << getpid() ; - sem_name = sem_name_stream.str() ; + sem_name_stream << "debugstepmaphore_" << getpid() ; + debug_sem_name = sem_name_stream.str() ; - debug_sem = sem_open(sem_name.c_str(), O_CREAT, S_IRWXU , 0); + debug_sem = sem_open(debug_sem_name.c_str(), O_CREAT, S_IRWXU , 0); - exec_instrument_before("trick_instruments.debug_pause.debug_pause") ; + instrument_job_before("trick_sys.sched.debug_pause") ; //TODO: turn off real-time clock if on. @@ -81,18 +73,18 @@ int Trick::DebugPause::debug_pause_on() { } -int Trick::DebugPause::debug_pause_off() { +int Trick::Executive::debug_pause_off() { if ( debug_pause_flag == false ) { return(0) ; } debug_pause_flag = false ; - exec_instrument_remove("trick_instruments.debug_pause.debug_pause") ; + instrument_job_remove("trick_sys.sched.debug_pause") ; debug_signal() ; - sem_unlink(sem_name.c_str()) ; + sem_unlink(debug_sem_name.c_str()) ; //TODO: turn back on real-time clock if on before debug_pause started. return(0); diff --git a/trick_source/sim_services/Executive/Executive_freeze_loop.cpp b/trick_source/sim_services/Executive/Executive_freeze_loop.cpp index 19d5ef4bd..e7847bb94 100644 --- a/trick_source/sim_services/Executive/Executive_freeze_loop.cpp +++ b/trick_source/sim_services/Executive/Executive_freeze_loop.cpp @@ -25,6 +25,11 @@ int Trick::Executive::freeze_loop() { /* Set the mode to Freeze */ mode = Freeze; + if (debug_pause_flag) { + debug_pause_off(); + } + + /* Execute the Freeze Init Jobs. */ freeze_init_queue.reset_curr_index() ; while ( (curr_job = freeze_init_queue.get_next_job()) != NULL ) { @@ -77,6 +82,11 @@ int Trick::Executive::freeze_loop() { } else if ( exec_command == FreezeCmd ) { /* redundant freeze command. Clear it. */ exec_command = NoCmd ; + } else if ( exec_command == StepCmd ) { + mode = Step ; + exec_command = NoCmd ; + + debug_pause_on(); } /* Call Executive::exec_terminate_with_return(int , const char * , int , const char *) diff --git a/trick_source/sim_services/Executive/Executive_step.cpp b/trick_source/sim_services/Executive/Executive_step.cpp new file mode 100644 index 000000000..8b874f080 --- /dev/null +++ b/trick_source/sim_services/Executive/Executive_step.cpp @@ -0,0 +1,22 @@ + +#include +#include + +#include "trick/Executive.hh" +#include "trick/Message_proto.hh" +#include "trick/message_proto.h" +#include "trick/message_type.h" + +int Trick::Executive::step() { + + /** @par Detailed Design */ + /** @li Set exec_command to RunCmd. Requirement [@ref r_exec_mode_5] */ + if(debug_pause_flag) { + debug_signal(); + } else { + exec_command = StepCmd ; + } + + return(0) ; + +} diff --git a/trick_source/trick_swig/sim_services.i b/trick_source/trick_swig/sim_services.i index 2732e36a8..727fcc3d9 100644 --- a/trick_source/trick_swig/sim_services.i +++ b/trick_source/trick_swig/sim_services.i @@ -50,8 +50,6 @@ #endif #include "trick/DataRecordDispatcher.hh" #include "trick/data_record_proto.h" -#include "trick/DebugPause.hh" -#include "trick/debug_pause_proto.h" #include "trick/EchoJobs.hh" #include "trick/echojobs_proto.h" #include "trick/Environment.hh"