How do you debug?

I’m just wondering how others debug their programs. This is along the same lines as the topic about what headers people are using on their Wixels - rather general but helpful.

For debugging the timer library I’m working on I knocked together a program that basically displays time series data - how variables or registers in this case change over time. At some point in time I would like to add the viewing of fields within each register as it can be really helpful.


edit: updated the image as I added value difference highlighting

1 Like

Wow, that is a pretty cool looking program!

To test and debug the libraries I have written, I usually make a test app whose name starts with “test_”. It just uses a serial terminal for the UI and it accepts one-letter commands that I can type at the keyboard. Most the commands run some function in the library or print some information. I often make a ‘?’ command that prints out the values of all the registers/variables I care about at the moment. You can see the test_random and test_radio_link apps for examples.

I think I wouldn’t write my own GUI to do this sort of testing because that just adds one more piece to the system that could have bugs in it, so whenever I observe a bug I would have to spend some time verifying that GUI is showing me the right data.

–David

Thanks.

The program on my Wixel is based on example_usb_com so it accepts single character commands and runs sets of functions depending. I have a function that spits out all the variables that I’m interested in so I can run it first to get the initial states then after a function to see what has changed - this works really well for doing bulk testing of functions which is kind of why I wrote it. Though you have a very good point about it just adds another level of complexity and possibility of bugs.

Just some more info about the GUI incase you are interested.
It is about 70 lines in VB (I’m sure I could improve some of my code to make it less), using a custom control that someone wrote for a listview with multiple columns. It basically reads in data from the COM port, when it finds a line that starts with “NOTE=” it adds a new column with what is after the equal sign and anything else is a data value (e.g. T1CTL=) - it checks if there is already a row with the variable name and if so just adds the data to the current column or adds a new row and then the data to the current column. This way I don’t have to change things around everytime I want to debug something else.