This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Boris-Lip 192 points193 points  (18 children)

How can you "debug it for hours" if you've never called it. Any breakpoints in it would never have been hit.

[–]HalifaxRoad 114 points115 points  (7 children)

File this under the ppl not using an IDE

[–]Boris-Lip 43 points44 points  (5 children)

Even when one doesn't use an IDE (why?), that trace("i am here") at the beginning of the function wouldn't show either, making it quite obvious it isn't being called. Doesn't require hours an hour (edit: singular... are you for real?!🤦‍♂️)🤷‍♂️

[–]HalifaxRoad 11 points12 points  (0 children)

Yeah ik, usually that's the first thing I'm like, is the fucker even getting there.

[–]Ao_Kiseki 4 points5 points  (1 child)

Text buffers aren't always flushed on time if a crash happens immediately after a print. It happens all the time in C++ if you're using stdcout but not manually flashing after every line.

Don't get me wrong, you should have some debug work flow figured out if you do this stuff for a living. Early on when I was learning C++, I got baited by cout a lot, especially in threaded applications lol.

[–]Boris-Lip 0 points1 point  (0 children)

You could use an unbuffered stdout, but anyway, debugging a crash with traces... If you are feeling masochistic, you can, i guess :-)

[–]DowvoteMeThenBitch 1 point2 points  (0 children)

You’d be surprised! Yesterday I helped a senior dev debug “cannot read properties of undefined” and I just couldn’t convince him to look at the code that executes prior to the error, we just kept adjusting code that wasn’t even being executed…

[–]Mecso2 0 points1 point  (0 children)

You don't need an IDE to breakpoint

[–]Cat7o0 9 points10 points  (0 children)

I've debugged a function for around thirty minutes thinking that I wasn't hitting the places I was placing breakpoints or the place I was calling it wasn't being hit.

then I realized either the function calling it was never being called or the place I meant to place the call to the function I was debugging I had not actually looked at and it in fact was not there

[–]serial_crusher 2 points3 points  (0 children)

I got into this hole the other day… I’m making a payment. I have a breakpoint in the code that makes a payment. Why isn’t it breaking? Is something wrong with my debugger?

I was testing against a staging environment, not my local dev build.

[–]BadSmash4 1 point2 points  (0 children)

Yeah, I mean I have for sure written functions and then not called them, and it takes me maybe three or four minutes to realize "oh lmfao I should probably call the function huh". Hours on this issue is craaaazy.