VS Code: Data Breakpoints and Watchpoints

There are many cases where setting a breakpoint on a line of code does not help much. Cases like data or variables get modified from somewhere. That can be data in a linked list somewhere, and all what I have found out so far that it gets changed or corrupted. But I do not know what piece of code is responsible for it.

The solution for such problems are ‘data breakpoints’ or ‘watchpoints‘. Still, not many developers seem to be aware of watchpoints? They are incredibly helpful. And VS Code has at least some basic support for it.

Data Breakpoints in VS Code
Continue reading

Tutorial: Catching Rogue Memory Accesses with ARM Watchpoint Comparators and Instruction Trace

In my “Tutorial: Catching Rogue Memory Accesses with Eclipse and GDB Watchpoints” I have used Eclipse/CDT and GDB watchpoints.  I used a conditional watchpoint, but this comes with a performance hit. In this article I show how to use the ARM Cortex trace hardware to catch specific writes to a memory location. Without severe performance degradation. But for this I need a little helper: the DEADBEEF catcher!

0xdeadbeef catcher

0xdeadbeef catcher

Continue reading

Tutorial: Catching Rogue Memory Accesses with Eclipse and GDB Watchpoints

Eclipse is great: it gives me the tools and capabilities to solve the really hard bugs to find. An example of that ‘hard’ category are ‘rogue’ memory accesses: something in the application is accessing an unwanted memory location and corrupts the data. This might be very sporadic, or takes a long while until it happens. With normal ‘stop-mode’ debugging (setting a normal breakpoint) and stepping usually won’t let me find that bug, as it might be coming from a pointer somewhere. Maybe from an interrupt routine. Or maybe an unitialized or corrupted pointer corrupts to my memory. Usually all what I know is the memory adddress of the data, maybe what is written, but not what or who is writing to that location.

In this article I’m using one of the ‘less-known’ debugging techniques available in Eclipse and CDT and how it works: watchpoints!

Watchpoint with Condition

Watchpoint with Condition

In this article I’m using one of the ‘less-known’ debugging techniques available in Eclipse and CDT and how it works: watchpoints!

Continue reading