Breakpoints with Special Effects

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:

  1. Stop my application on a breakpoint
  2. 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:

Breakpoint with Debugger Shell

Breakpoint with Debugger Shell

Breakpoint Actions

The smarter way is to use Breakpoint Actions: for this I right-click on a breakpoint and select ‘Properties’:

Breakpoint Properties

Breakpoint 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…’:

Breakpoint Properies with Actions

Breakpoint Properties with Actions

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’:

New Breakpoint Action

New Breakpoint Action

Now time to fill in the script part: I can add multiple commands, or point to a script file:

Export Trace Data with Debugger Action

Export Trace Data with Debugger Action

Pressing OK.

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:

Attaching an Action

Attaching an Action

This then attach the action to the breakpoint:

Breakpoint with attached action

Breakpoint with attached action

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:

Breakpoint Action Decorator

Breakpoint Action Decorator

Summary

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 🙂

2 thoughts on “Breakpoints with Special Effects

  1. I tried it, I doe not work for me, I do not know why. I love to to get this feature to work and I
    Installed Products:
    – CodeWarrior for MCU
    Version: 10.6
    Build Id:140329
    the processer is MK40DN512ZVLL10 in LQFP 100-pin package.
    when manully debug, I can step into one line of the code and then I put a break point there and follow the instruction on this post with a simple command of
    ” save -h 0x1fff1800..0x1fff23b7 0x1fff2c0c..0x1fff37c3 IQValues.txt -o 16bit”
    to save a section of memery data. but it never worked. I can doo this maully wih debug common shell.

    any more comments?

    thank you

    Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.