Skip to content

Commit

Permalink
Merge branch '1764-Brittle-Step_Executive-Implementation' into 1764-B…
Browse files Browse the repository at this point in the history
…rittle-Step
  • Loading branch information
Mrockwell2 committed Oct 2, 2024
2 parents c6c38d1 + c7cd17e commit 21febc3
Show file tree
Hide file tree
Showing 21 changed files with 93 additions and 205 deletions.
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
76 changes: 0 additions & 76 deletions include/trick/DebugPause.hh

This file was deleted.

37 changes: 37 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 @@ -1338,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.

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

This file was deleted.

4 changes: 4 additions & 0 deletions include/trick/exec_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,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
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
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
47 changes: 0 additions & 47 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.

22 changes: 0 additions & 22 deletions trick_source/sim_services/DebugPause/Makefile_deps

This file was deleted.

3 changes: 3 additions & 0 deletions trick_source/sim_services/Executive/Executive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
31 changes: 31 additions & 0 deletions trick_source/sim_services/Executive/Executive_c_intf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,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) ;
}

Loading

0 comments on commit 21febc3

Please sign in to comment.