When The Debugger Lies With Stale Cache Values
In a latest weblog publish by [Daniel Mangum] he goes over a state of affairs noticed whereas debugging the Cortex-M33-based nRF54LM20, studying and writing values whereas operating via a number of situations. After initially it appeared to go seemingly with none points, abruptly the GDB debugger would fortunately return values that urged {that a} earlier operation had not succeeded. Or, because the case turned out to be, stale cached values have been being returned.
What follows is a really technical and low-level breakdown of how this MCU capabilities inside, particularly its cryptographic options and Key Management Unit, which is used for storing delicate info. The most amusing half might be you may bypass the cached information by explicitly specifying the entry port and reminiscence handle together with different parameters.
This ReadMemAP command supported by the JLinkGDBServer used right here confirmed the correct worth, whereas the conventional GDB learn command utilizing x stored returning the cached values. This raised the query of which cache was doing this. The direct learn from the AHB-AP entry port labored positive, so the suspicion is that the J-Link software program’s personal caching, with a run with out the J-Link caching certainly working positive.
J-Link has had some hardware-related issues too, with this new subject pointing to a clumsy software program bug that may very well be table-flip-and-rage-quit worthy relying on how a lot time it wastes throughout a debug session. Fortunately [Daniel] appears to have caught this one shortly and had a simple strategy to bypass it, however we aren’t all that fortunate.

