News for hackers. Stuff that matters.
Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by Terr_ on Friday October 04, 2024 @01:26AM (#41738118)
> Since then I have started using things like aaa and 111 as my debug markers.

I often use my initials and "DEBUG", so that the string (A) is distinctly grep-able before committing code and (B) if it somehow ends up in production it's not totally mysterious.

Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by adastra22 on Friday October 04, 2024 @02:04AM (#41738305)
I like this, but use the initials of annoying Steve down the hall.
Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by daurnimator on Friday October 04, 2024 @02:24AM (#41738390)
And if he isn't "annoying Steve" now he will be known as that soon enough :)
Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by dctoedt on Friday October 04, 2024 @11:13AM (#41742258)
> And if he isn't "annoying Steve" now he will be known as that soon enough :)

I once heard a guy — named Ed — who responded to a query about something with, "Well, I'm special." You can guess how he was referred to from then on ....

Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by jxramos on Friday October 04, 2024 @03:38AM (#41738813)
same, "DEBUG 1", "DEBUG 2", "DEBUG 3 with description xyz", etc.
Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by Terr_ on Friday October 04, 2024 @04:14AM (#41739040)
> DEBUG 1, DEBUG 2

If the language has them, it's often valuable to use techniques that automatically insert file/line number data, so that you don't need to spend time creating unique labels.

It goes without saying that a real debugger is even better, but it isn't always convenient or possible.

Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by TremendousJudge on Friday October 04, 2024 @01:13PM (#41743435)
Sometimes an interactive debugger session will make the issue you are researching not happen -- I don't know of a way of tracking down race conditions that isn't logging everything that happens until I find out which thing happened before which other thing that wasn't supposed to
Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by Terr_ on Friday October 04, 2024 @03:38PM (#41744876)
> Sometimes an interactive debugger session will make the issue you are researching not happen

I still remember the first time that happened to me, I think it had to do with some (not yet diagnosed) race condition on a PHP server between the HTTP requests it served, and the debugger had a side-effect of blocking the next request while I was inspecting the first one.

That reminds me of another thing: Some debuggers allow you to set breakpoints and set them to not suspend or pause execution, but to emits a log-message to the debugger or terminal instead.

Those are an upgrade over print-statements in that:

1. You can't accidentally commit it and it doesn't show up to make your diffs weird

2. You may be able to dynamically change what things it prints out without restarting the program

Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by eastbound on Friday October 04, 2024 @02:21PM (#41744127)
And the reverse: I change values using breakpoints. So the code runs (because the breakpoint condition is false) but the value is different. Example of breakpoint condition:

(licenseActive = true) != true

Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by jxramos on Monday October 07, 2024 @05:39PM (#41771344)
yah that may be worth turning on that feature or altering the debug trace during a debug session to see what line comes up, not a bad suggestion. We turn off line traces in general so that the debug logs can be diffed after stripping off variant fields in the log records like object addresses and timestamps. While a project is in development the log line numbers would add a lot of diff noise.
Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by ajross on Friday October 04, 2024 @10:20AM (#41741721)
FIXME is also popular.
Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by sn9 on Friday October 04, 2024 @02:00PM (#41743912)
Am I the only one who just uses my name?

As in "MYNAME: " prefixed to whatever useful information I might need.

Re:Why does man print "gimme gimme gimme" at 00:30? (2017) by greenchair on Saturday October 05, 2024 @08:02AM (#41749306)
you are not the only one buddy!