All the debugging tools in the world doesn’t beat an excellent sense of intuition and putting that print statement exactly where it needs to be.
134 0 ReplyAs linus says, if you need to use a debugger your code is too complicated
64 1 ReplyHe works on Linux where he controls the whole stack down to the metal and I love that for him, but other people have to call library code, and them debug that if it doesn't work as they thought it would.
38 0 ReplyDude can pry my debugger from my cold, dead hands.
11 0 ReplyThe problem is that sometimes it's not your code that you're debugging
5 0 Reply
echo __LINE__ . "Moo\n";
Honestly if you're not including the LoC in your debug statement I don't even fucking understand you.
But yeah, senior devs know the power of breadcrumb debugging (because most of us were deeply scarred by
gdb
).50 1 ReplyDid GDB do something bad at some point?
25 0 ReplyYes. It breaks points.
17 0 ReplyNo
4 1 Reply
That's
console.trace()
for all you JS devs out there.9 0 ReplyI always combine that with objects with the shorthand notation. So you always know what variable has what value without having to remember in what order you printed the variables.
console.trace({i, list}); // {i: 1, list: [0, 1, 2]}
3 0 ReplyI also use group and groupend to nicely collapse different logs. and table when i'm feeling funny.
1 0 Reply
Don't you want it to look a little nicer? echo __LINE__ . ": Moo!";
I mean, presuming cowsay is unavailable
7 0 Replydbg!()
for Rust users6 0 Reply
Beep
Boop
Gloop
Glorp
Yeet
Yo
18 0 Reply"Hello worl" if I need something quick
"AAAAAAAAAAAAAAAAA" if I'm lazy and don't want to have to hunt the output logs for it
5 0 ReplyThat's me..... I do that...................
2 0 Reply
This is why I find shaders scary as fuck
17 0 Replytfw I recently worked on a side project where I was too lazy to change the log level but not sloppy enough to use raw
printf
so I'd just throw stuff into info and then remove the statements once I solved my issue10 0 ReplyAfter all, that's why git is there, to help me remember the shit I put all over the place. (Ok, it might have some other uses.)
3 0 Reply[[[[[[[[[ TEST ]]]]]]]]]
3 0 Reply
Ahhh, my favourite debugging combo...
echo "<pre>"; print_r( "We are here, we are here!" ); echo "</pre>"; die();
Also fun at parties, hanging out asynchronously, is the ever popular PHP Mail to see if something ran in the background properly, or to get output.
7 0 Replydbg!(1)
all the time...7 0 Reply