Now that we have breakpoints set, we should enhance them a little. 

To get to the enhancing options for a breakpoint, simply right-click the breakpoint:

Breakpoint Labels

One thing I have gotten into the habit of doing when setting breakpoints is adding labels. When using any of the breakpoint creation options, other than New->Function Breakpoint, the function names aren't added to the breakpoint.

In the breakpoint menu, select Edit Labels…, put your desired name in the "Type a new label" textbox, and click Add or press Enter.

This helps to keep your breakpoints organized, without having to remember memory addresses. Also, you can use the labels in a different manner, and apply multiple labels to the same breakpoint or one label to multiple breakpoints.

Breakpoint Setttings

The functional options are in the Settings… menu.

Address:

The address of the breakpoint. This is useful when a variable output needs to be tweaked (explained below in the Actions section), or if you've re-compiled changes to the firmware and the function's address has changed. If you change the address of an existing breakpoint, AS7 will force you to select a "Language". I have used "C#" with no problems. Also, this is not available when using New->Function Breakpoint since it is replaced with the function name instead of the address.

Conditions & Actions:

Conditions

  • You can set conditional expressions for when the breakpoint is triggered. Syntax and gotchas are explained in Actions.

Actions

  • This is my personal favorite. You can set the breakpoint to print out information you want to evaluate. You can let the breakpoint pause the board, or let the board keep running by checking "Continue execution". The information is printed to the Output window. This is really helpful in situations where code execution needs to continue to see a larger set of data or when there are dependent functions/interrupts that need to continue. Now, not all information will be available. You will come across variables that are either optimized out by the compiler, or just not at a scope level that AS7 can evaluate.

    To explain the action syntax a little, here is what I know to be available: plain text, "$" macros, and "{???}" variable calls. 

    For the macros, just type "$" and a list of options will appear. $CALLSTACK and $CALLER are nice for a snapshot w/o stopping the board. $ADDRESS is useful if you have multiple breakpoints on the same function.

    For the variable calls, there are a couple things to mention:

    • The value (or lack thereof) output is based on a variable's state at the breakpoint's address. If you're getting a lot of could not evaluate results, try moving the breakpoint's address "down" a little. You can also set multiple breakpoints on a single function, assuming it takes up multiple addresses. This will let you watch a variable through the function's cycle.

    • Pointers work…most of the time. What I mean is this will work: {last_us[self->channel]}. In the case of indexed values, you can also just put the index in if you know it: {last_us[5]}

One last note on Actions. While using "Continue Execution" will keep the board running, it does cause a delay in execution. If you're working with things that require precise timing, you may have to factor that into your approach.

That's about all there is for Breakpoints. Simple, but effective. AS7 does have a "Data Breakpoint" available, but in my early use I couldn't get it to work. I may re-visit it, and update this guide accordingly.

To show all of this in action, here is a screenshot of a PulseIn run:

This guide was first published on May 24, 2018. It was last updated on May 24, 2018. This page (Enhance) was last updated on Jul 28, 2019.