Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugging a few holes with Sim Control Panel's Step function #1774

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 0 additions & 2 deletions docs/howto_guides/Realtime-Best-Practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
76 changes: 0 additions & 76 deletions include/trick/DebugPause.hh

This file was deleted.

45 changes: 45 additions & 0 deletions include/trick/Executive.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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(--) */
Expand Down Expand Up @@ -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(--) */
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions include/trick/debug_pause_proto.h

This file was deleted.

5 changes: 5 additions & 0 deletions include/trick/exec_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *) ;
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion include/trick/files_to_ICG.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions include/trick/sim_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ typedef enum {
NoCmd = 0 , /* NoCmd */
FreezeCmd = 2 , /* freeze */
RunCmd = 3 , /* run */
StepCmd = 4, /* step */
ExitCmd = 10 , /* exit */

} SIM_COMMAND;
Expand Down
5 changes: 2 additions & 3 deletions share/trick/sim_objects/default_trick_sys.sm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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) ;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down Expand Up @@ -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" ;
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
}

/**
Expand Down
2 changes: 0 additions & 2 deletions trick_source/sim_services/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 0 additions & 40 deletions trick_source/sim_services/DebugPause/DebugPause_c_intf.cpp

This file was deleted.

3 changes: 0 additions & 3 deletions trick_source/sim_services/DebugPause/Makefile

This file was deleted.

Loading
Loading