Skip to content

Basic Debugging

schirner edited this page Sep 17, 2019 · 1 revision

Basic Debugging with SpecC

To enable debugging symbols, use the compilation flag "-g" similar to the gcc option. In addition, adding the "-G" option will enable introspective capabilities enabling more information about the design (What is the currently running behavior, which behavior was running before the deadlock?). An example compilation call for including debugging capabilities is:

scc DesignName -sc2out -vvv -vv -g -G

Next, execute the design under control of gdb:

gdb DesignName

This opens the regular gdb debugging session, allowing to set breakpoints, step-by-step execution an much more. There are many tutorials available online, One example is the RMS's gdb Debugger Tutorial.

Debugging of Refined Models

Debugging generated models can be a confusing. Multiple source files are pulled in, in order to create the complete model. Also, some completely new behaviors may have been created. Bottom line, directly debugging the model may be confusing. To avoid confusion, the recommendation is to first generate the SC code into one file and recompile this. The following steps show how to do it:

1. Generate flat SC file out of a model in SIR

scc <DesignName> -sir2sc -sl -o dbgModel.sc

Replace with your current name of the design (such as comm_tlm). One important parameter is -sl, this avoids creating back links into the source files -- I find them confusing.

2. Compile Into a debuggable executable

scc  dbgModel -sc2out -vvv -g -G -xlx -xcx 

3. Start your favorite debugger.

ddd dbgModel

Please see Debugging with DDD for a more detailed description on how to debug specifically with DDD.

Clone this wiki locally