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 🙂

Advertisements

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s