As promised back in Percepio, I want to have it ported and working with the Freescale Cortex-M4/Kinetis in CodeWarrior. That’s what I’m working on now, deep into the night. While doing this, I had to generate a lot of trace data, and I used the script I presented in that earlier post: Setting a breakpoint in the trace buffer wrapper event and then export the data. But there has to be an even better way, and indeed there is one: Breakpoints with Special Effects!
So what I want to do is this:
- Stop my application on a breakpoint
- Run a debugger shell script or commands to export memory
Breakpoint with Debugger Shell
The basic way to do this is: exactly this! To set a breakpoint, run, hit the breakpoint and execute a debugger shell command or script:
The smarter way is to use Breakpoint Actions: for this I right-click on a breakpoint and select ‘Properties’:
Hint: The ‘Breakpoint Properties’ context menu exists in the Breakpoints view as well.
This gives me the following dialog. I have ‘Actions’ selected and press ‘New…’:
This gives me a dialog where I can name the action and select from a list of possible (and interesting!) actions. For my purpose here I select ‘Debugger Shell Action’:
Now time to fill in the script part: I can add multiple commands, or point to a script file:
Now a step which easily is missed: we have defined an action, and this action can be used for multiple breakpoints. So I need to assign it to the breakpoint too. For this I select the action and use the ‘Attach’ button:
This then attach the action to the breakpoint:
Pressing OK, and my settings are saved.
Breakpoint Action Decorator
Having a breakpoint with an action will add a ‘+’ decorator to the breakpoint icon as shown below:
Now I can simply run my application: it will hit the breakpoint and automatically dump my trace information. Even more: I can add the ‘Resume’ action to my breakpoint and the application will continue to run right aftwards. Really cool debugger automation 🙂
Happy Breakpointing 🙂