Automated Testing and Validation with Reactis®

White Papers > Finding Bugs in C Code with Reactis for C

Download: PDF  


3  Reactis Simulator

Reactis simulator extends traditional debugging with advanced error-detection and testing.

Reactis Simulator provides an environment in which program execution can be carefully controlled and monitored. Simulator’s basic features are similar to traditional source-level debuggers: you can single-step through individual source statements, set breakpoints, and display data values.

A screenshot of the Reactis for C
main window 
is shown, in which the user is hovering over a C macro M_NOTINIT.
Reactis for C shows the expansion of the macro ($0$) and the
status of the condition, decision and statement coverage targets
at the location where the macro is expanded.
Figure 6: Coverage metrics and a C macro expansion displayed during a Simulator session.

However, Simulator also has a number of unique features which make it much more powerful than a traditional debugger.

Runtime error detection. Simulator instantly detects a host of runtime errors, including memory errors, uninitialized variable accesses, and integer overflows. When a runtime error occurs, execution is interrupted, unlike most C environments, in which execution proceeds using a corrupted data value. This is discussed in more detail in Section 5.

Test replay. Simulator provides the ability to replay tests, so that any point in the execution sequence leading to an error can be examined. Execution can be reversed to the beginning of a step at any point, making it is easy to go back and check the value of a variable at an earlier point in time.

Graphical display of coverage metrics. Simulator highlights source code according to coverage status, so that uncovered statements, conditions, decisions and MC/DC targets can be quickly found and uncovered code regions visualized. In Figure 6, code containing uncovered targets is displayed in red. A thin red overline indicates a decision which has never been true, and a thin red underline indicates a decision which has never evaluated to false. Similarly, a thick red overline indicates a condition which has never been true, and a thick red underline indicates a condition which has never evaluated to false.

Macro expansion visualization. Simulator provides the ability to view C preprocessor macro-expansions while browsing the source code. When a macro is hovered over with the mouse, its expansion is displayed. In Figure 6, the user is hovering on M_NOTINIT, which is a macro whose expansion is 0 (a single character string).

Test suite tuning. Simulator gives you the capability to fine tune automatically-generated test suites. Additional tests can be added, and existing tests can be modified or extended with additional steps.