How to Single Step Debug with Workbench

First, build a DKM (Downloadable Kernel Module) as follows:


Then, download a DKM (Downloadable Kernel Module) as follows to an already running simulator or real target:


The option to debug a DKM can be specified right at the load and launch time as follows:


Alternatively, we can attach to an already running task from a DKM as follows:


This is done by attaching to a task by name as seen in the WindShell TCB (Task Control Block) dump above.


Either way, we need to set a break point at a function entry point or in the source code as shown here:


Breakpoints can be seen above and can also be set, listed, or cleared in the WindShell.  Here, we see the “b” command in the following below reveals that no break points are presently set.


To view modules loaded, and to look for specific function entry points, use lkup “function_name” for example.


Showing task status from the TCBs (Task Control Blocks) while debugging, will reveal that the tasks being debugged are in a stopped state.


It is most useful to keep the source window up, single step, click to set breakpoints, for interactive debug as shown here:


Spend time debugging the example code, test_tasks.c, by both attaching to the already running tasks, and by launching with breakpoints pre-set.  Useful features like viewing source in mixed assembly and C source level may also be useful.  The underlying debugger is GDB, which attaches to the remote Wdb debug agent to gain control of tasks on the target and to single step them.