On UNIX platforms:0. In order to view model source code in debugger, compile all model code with -g option for comp_flags_devel OPNET preference.
- Run the development simulation kernel with ODB turned on.
- Once simulation stops at the initial ODB prompt, from a separate unix shell, figure out the process id of the op_runsim_dev (or op_runsim_dev64 if running a 64-bit kernel) process:
%
ps -ef | grep op_runsim_dev
- Run gdb or other symbolic debugger of your choice.
- Attach symbolic debugger to a running simulation. Use attach <process_id_obtained_in_step_2> for both GDB and DBX
- At this point, source debugger controls the simulation. You can set breakpoints, examine variable, source code and do other operation.
- In order to pass control to ODB, let source level debugger continue execution with cont command.
- Now ODB controls the simulation execution and you can use ODB commands to move on.
- If you had set breakpoints in a source debugger, control will go back to source debugger if that is hit. Otherwise, simulation control remains with ODB.
- If you want to defer setting breakpoints in a source debugger (e.g., after a certain event number), navigate using ODB to go to the event of interest. Then, in order to pass control to the source debugger, hit <Control>+<c> in a source debugger shell window;
- Special note for process model code debugging: In order to check the values of model state variables use the following convention:
(gdb) print op_sv_ptr-><state_var_name>