Eclipse Debugging with Strings

Here I am: past midnight, and debugging why my Kinetis ARM Cortex-M4 K60N512 application. So now you know what keeps me up at night :-). Stepping through some code which is using all kind of strings:

Debugging the K60 with Eclipse and CodeWarrior

Debugging the K60 with Eclipse and CodeWarrior

The challenge is: how to debug my strings?

In the Variables View I see my string variables ‘strCmd’ and ‘strHelp’:

Variables View with my two strings

Variables View with my two strings

But what is behind the pointer? I wish the ‘Value‘ column would show me this. Instead, the value shows the address of the first character. Not what I want. Clicking on the triangle gives me the first character. And only the first character:

Variables view with first character

Variables view with first character

Useful, but not what I need. I need more, more characters. There is a context menu which is promising:

Display As Array Context Menu

Display As Array Context Menu

It asks me where to start and how many characters to display:

Display As Array Index and Length

Display As Array Index and Length

Ok, now this is better:

String as Array in Variables View

String as Array in Variables View

But this is not that simple as it should be. To do this for every sting? To much work. There has to be a much simpler way?

And actually, there is. It was there, but I missed it the first time! All what I have to do is to click on the variable name, and it shows in the Details Pane of the Variables View:

Details Pane of Variables View

Details Pane of Variables View

That Details Pane is really powerful: it even shows me the function name behind a function pointer :-):

Details Pane with Function Pointer

Details Pane with Function Pointer

For strings, it shows non-printable characters as well, very nice:

Details Pane with non-printable characters

Details Pane with non-printable characters

While this was cool, there is even a simpler and easier way: the trick is to move the mouse cursor over a variable in the source, and voilà: it will show the string for it :-):

Hover over String Variable

Hover over String Variable

Happy Stringing 🙂

Advertisements

3 thoughts on “Eclipse Debugging with Strings

  1. Pingback: Eclipse Debugging with Strings – Part 2 | MCU on Eclipse

  2. Pingback: Variable Debugging with Eclipse Kepler | MCU on Eclipse

  3. Pingback: Eclipse Debugging with Pointers and Arrays | MCU on Eclipse

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

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