Chris's Wiki :: blog/programming/PrintDebuggingAndInfrequentDevs Commentshttps://utcc.utoronto.ca/~cks/space/blog/programming/PrintDebuggingAndInfrequentDevs?atomcommentsDWiki2022-07-30T20:23:24ZRecent comments in Chris's Wiki :: blog/programming/PrintDebuggingAndInfrequentDevs.By Matthew Smith on /blog/programming/PrintDebuggingAndInfrequentDevstag:CSpace:blog/programming/PrintDebuggingAndInfrequentDevs:a43abdeef5cd000e6d69582cd24b1c6cd4d72fa0Matthew Smith<div class="wikitext"><p>For my print based debugging I… use gdb! You can run commands when a breakpoint is hit, including printing a value and then continuing. Setting it up looks a bit like this</p>
<pre>
break foo.c:20
commands
print ‘value is %u\n’, value
continue
end
</pre>
<p>I’ve learned the hard way to not use this to hack up the program while it’s running as a kind of poor man’s lisp environment.</p>
</div>2022-07-30T20:23:24ZBy lilydjwg on /blog/programming/PrintDebuggingAndInfrequentDevstag:CSpace:blog/programming/PrintDebuggingAndInfrequentDevs:2865b206a6a774d560babb9eea91dfb6a46bd055lilydjwg<div class="wikitext"><p>I usually use logging to debug. One great aspect is that logs can be searched, filtered, saved, and read many times, without a time limit.</p>
<p>Debuggers must be attached at least not too late (e.g. not hours or days later when it finally causes noticeable bad behaviors), and the state itself cannot be easily saved and restarted (even when the issue is highly reproducible, the procedure may take quite some time). Sometimes you mistype a debug command, and the data you want to examine has passed. rr can run a program backwards, but it's quite slow and needs to be prepared beforehand.</p>
<p>I only use gdb when my process crashes and left a coredump.</p>
</div>2022-07-29T07:16:20ZBy Brendan Long on /blog/programming/PrintDebuggingAndInfrequentDevstag:CSpace:blog/programming/PrintDebuggingAndInfrequentDevs:b2a0c7cd75bd391695c41f80df50efc77df49147Brendan Longhttps://www.brendanlong.com<div class="wikitext"><p>Another difference might be local program vs. remote server. If I'm debugging a production server, having a debugger running locally doesn't help. Some debuggers can connect to remote servers, but I also don't usually want to block a real user's session so I can step through it.</p>
</div>2022-07-29T03:52:07Z