||[Wednesday 9th September 2009 at 9:29 pm]
|||||Galicia ~ Awesome [Galicia.mo3]||]|
At work today I was debugging a problem in a bit of code, where somewhere between two systems a string was being truncated. There's three units and multiple programs involved in this, so to try and narrow it down I decided to add some debug to one program. The particular system on that unit uses a flowchart-like execution structure, separating actual code from the flowchart diagram. So, add in a debug node to print out the string when one flowchart has grabbed it from the other, rebuild the chart and transfer it to the unit, run it and it's still truncating the string. But that debug node was rather unhelpful and only printed out the first few characters, so I still don't know where the truncation is occuring. Not to be defeated I dug out a better debug node from the depths of the source control, compiled it, transfered it to the unit and plonked it into the flowchart.
At which point it stops truncating the string and sends the full text all the way through the system. Ah-hah, I think, this must be a heisenbug (adding debugging code can have very subtle effects on program behaviour). I'll remove my debug node from the flowchart, rejoin the original pair of nodes together, and upload the chart.
And it's still working. Ok, I think, the act of converting the chart for the unit must have changed it slightly from the original. It shouldn't do so as that implies non-deterministic code somewhere, but that'd at least explain what's going on. So I dug out the original already-converted chart and transfer that, thinking that this'll now restore the broken behaviour (when debugging it's always helpful to be able to reproduce the original bug - if you can reliably reproduce it, you can use a debugger to see every step involved and often quickly spot the actual problem).
Except it's still working!