4 ms·
who needs GDB when you have the good old fashion print statement... O.o
by Circuits 7y ago
who needs GDB when you have the good old fashion print statement... O.o
- emidln 7y agoAt my first job, we didn't have GDB or a console, but you could set a test point high. In the worst case, you attached an LED. In the best case, you maybe had a scope handy to log the data.
- AnimalMuppet 7y agoHeh. I once had a problem that I could detect at a certain point in software, but couldn't figure out how I got there. I used a test point to trigger a logic analyzer that was attached to the address bus. Scrolling back, I could see enough of the previous instruction fetches to figure it out. (This was before instruction caches on the 68000 line of processors.)
- danbolt 7y agoIn the games industry, I worked with an older programmer that developed games on the Sega Genesis back in the 90s. He said often changing the background colour[1] was the "simplest" way of debugging state or branches. [1] https://segaretro.org/Sega_Mega_Drive/Palettes_and_CRAM#Background_colour https://segaretro.org/Sega_Mega_Drive/Palettes_and_CRAM#Back...
- 0xcde4c3db 7y agoThis can even be used for profiling on some systems because the background color can be changed in the middle of a frame with a single register write. So you can basically turn the left/right borders into a color-coded CPU utilization gauge.
- unwind 7y agoIn my youth, us Amiga demoscene coders used this method too. You could basically measure CPU consumption by some sub-routine by setting a particular color on entry, then resetting on exit. Basically "raster lines" became a measure of time. Pretty sure I optimized by putting a piece of tape at the exit line on the TV, then trying to make the color bar more narrow. :)
- fra 7y agoif GDB isn't the "good old fashioned", then I need to update my frame of reference ;)
- deleted 7y ago[deleted]
- saagarjha 7y agoGDB lets you add as many print statements as you'd like to a binary you can't change, for one.
- vectorEQ 7y agoclose source indeed, not easy to manually insert some print into binaries :D perhaps a linked in library with hooks can do it... but i'd say gdb is the way to go indeed!