• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nasa / trick / 11349719212

15 Oct 2024 03:50PM UTC coverage: 55.852% (+0.006%) from 55.846%
11349719212

push

github

web-flow
Fixed debug_pause semaphore name (#1793)

0 of 1 new or added line in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

12283 of 21992 relevant lines covered (55.85%)

77423.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

10.81
/trick_source/sim_services/DebugPause/DebugPause.cpp
1

2
#include <iostream>
3
#include <sstream>
4

5
#include <fcntl.h>
6
#include <iomanip>
7
#include <errno.h>
8
#include <unistd.h>
9

10
#include "trick/DebugPause.hh"
11
#include "trick/message_proto.h"
12
#include "trick/message_type.h"
13
#include "trick/exec_proto.h"
14
#include "trick/exec_proto.hh"
15

16

17
Trick::DebugPause * the_debug_pause = NULL ;
18

19
Trick::DebugPause::DebugPause() {
176✔
20
    debug_pause_flag = false ;
176✔
21
    the_debug_pause = this ;
176✔
22
}
176✔
23

24
int Trick::DebugPause::debug_pause(Trick::JobData * curr_job) {
×
25

26
    // The target job was copied to sup_class_data in Trick::ScheduledJobQueueInstrument::call()
27
    Trick::JobData * target_job = (Trick::JobData *)curr_job->sup_class_data ;
×
28
    int sem_ret ;
29

30
    if ( target_job != NULL ) {
×
31

32
        // Pause for all job classes that are not initialization or for init jobs greater than phase 1.
33
        if ( target_job->job_class_name.compare("initialization") or target_job->phase > 1 ) {
×
34

35
            message_publish(MSG_NORMAL, "%12.6f pausing before %s\n" , exec_get_sim_time() ,
×
36
             target_job->name.c_str() ) ;
37

38
            do {
×
39
                sem_ret = sem_wait(debug_sem);
×
40
            } while ((sem_ret < 0) && (errno == EINTR));
×
41

42
            if (sem_ret != 0) {
×
43
                perror("Call to sem_wait");
×
44
                fflush(stderr);
×
45
            }
46
        }
47
    }
48

49

50
    return(0) ;
×
51

52
}
53

54
int Trick::DebugPause::debug_signal() {
×
55

56
    sem_post(debug_sem);
×
57
    return(0) ;
×
58

59
}
60

61
int Trick::DebugPause::debug_pause_on() {
×
62

63
    std::stringstream sem_name_stream ;
×
64

65
    if ( debug_pause_flag == true ) {
×
66
        return(0) ;
×
67
    }
68

69
    debug_pause_flag = true ;
×
70

NEW
71
    sem_name_stream << "debugstepmaphore_" << getpid() ;
×
72
    sem_name = sem_name_stream.str() ;
×
73

74
    debug_sem = sem_open(sem_name.c_str(), O_CREAT, S_IRWXU , 0);
×
75

76
    exec_instrument_before("trick_instruments.debug_pause.debug_pause") ;
×
77

78
    //TODO: turn off real-time clock if on.
79

80
    return(0) ;
×
81

82
}
83

84
int Trick::DebugPause::debug_pause_off() {
×
85

86
    if ( debug_pause_flag == false ) {
×
87
        return(0) ;
×
88
    }
89
    debug_pause_flag = false ;
×
90

91
    exec_instrument_remove("trick_instruments.debug_pause.debug_pause") ;
×
92

93
    debug_signal() ;
×
94

95
    sem_unlink(sem_name.c_str()) ;
×
96

97
    //TODO: turn back on real-time clock if on before debug_pause started.
98
    return(0);
×
99

100
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc