me trying to find my single important telemetry print, while the log transmission is a few mb behind because it's being spammed with loop overrun messages and worthless verbose path data
For the JVM you can do it using jdwp at the command line, over the network protocol of your choice. For native apps you can use gdbserver (or just gdb if it's installed on the remote). There are equivalents for python and .NET.
The fact that theres valid reasons to do it and that sometimes it may be necessary, doesn't mean it's not a bad way to troubleshoot.
Kinda irritating how every time people are joking about debuggers and how not enough people use them someone must come and show their wisdom by saying "its not always the right tool for the job". Yes - we all know. The same is true for every single tool at a programmer's disposal.
As a software engineer for 8 years it’s never been worth me figuring out the difference between step through and step over. Unclear and confusing terminology. Setting a break point every line is something clear and straight forward and I’ve never been bothered to look into it more
I had a lecturer who was showing us how to use the java debugger and he did this. He put breakpoints on every single line and clicked continue instead of step. I wanted to scream
def dijkstra(G, c, maxDist, origin, destination):
l = {}
pred = {}
path = []
R = []
for g in G:
l[g] = math.inf
l[origin] = 0
while not len(R) == len(G):
mini = math.inf
for x, y in l.items():
if y < mini and not R.__contains__(x) and y < maxDist:
mini = y
currentNode = x
R.append(currentNode)
for v in G.get(currentNode):
if l[v] > l[currentNode] + c.get((v, currentNode)) and not R.__contains__(v):
l[v] = l[currentNode] + c.get((v, currentNode))
pred[v] = currentNode
found = false
path.append(destination)
lastPred = destination
while not found:
if lastpred == origin:
found = True
else:
lastPred = pred[lastPred]
path.append(lastPred)
return path
Something in vscode is causing my Node debugger to break a few lines after I place the breakpoint, so I basically do this to ensure I can get a breakpoint where I want it
Do you use webpack? You can configure sourcemaps there,
But for unit testing, I would imagine it should just execute the original code so I don't think it's relevant... But I could be wrong. It's been 4 years since I've used Vue.
I was recently working on my boss’s old code and in every method he had an integer variable named line. Every few lines of code he incremented this variable (line++). In catch block he just printed out this number 😂
I still cannot understand how this would make debugging easier. Luckily I quit the job few weeks ago. Everything is a lot better nowadays.
Fun fact: in baremetal embedded your chip have like 5 or 6 breakpoint, set one too many and things go crazy (like your mcu crash). Your friend can work around that by removing the breakpoint at the line above and setting it in the line below. Hope this was helpful
114
u/[deleted] Feb 22 '23
When you want to walk the stack while debugging…why not walk every single line of code, right?
176
u/Waghabond Feb 22 '23
Your friend is already ahead of most of my colleagues
63
u/shizzy0 Feb 22 '23
THIS TRAIN… MAKES FREQUENT STOPS.
60
u/O_X_E_Y Feb 22 '23
maybe a little much but i don't hate it. much preferrable over not using the debugger at all
26
u/GerbilScream Feb 22 '23
For those confused, F10, F11, Shift + F11 are your friends here.
14
u/[deleted] Feb 22 '23
lack of confidence or military precision?
4
u/No_Roll6768 Feb 23 '23
I am more amazed by the use of contains instead of in
3
u/[deleted] Feb 22 '23
F8!!!
7
u/DonLimpio14 Feb 22 '23
i feel personally attacked
6
u/toolbg Feb 22 '23
perfect! I do every time.
2
u/Tmaster95 Feb 23 '23
If only there was a function key to step down line per line
2
u/Romejanic Feb 23 '23
I had a lecturer who was showing us how to use the java debugger and he did this. He put breakpoints on every single line and clicked continue instead of step. I wanted to scream
2
u/AlterGnooble Feb 23 '23
Transcription:
1
u/alydnhrealgang Feb 23 '23 edited Feb 25 '23
I recommend your friend write some unit test for this code
1
u/BeauteousMaximus Feb 23 '23
Something in vscode is causing my Node debugger to break a few lines after I place the breakpoint, so I basically do this to ensure I can get a breakpoint where I want it
1
u/[deleted] Feb 23 '23
My code when I try to understand something I wrote yesterday whilst awake enough to see
1
u/Far_Pilot_8183 Feb 23 '23
I was recently working on my boss’s old code and in every method he had an integer variable named line. Every few lines of code he incremented this variable (line++). In catch block he just printed out this number 😂
I still cannot understand how this would make debugging easier. Luckily I quit the job few weeks ago. Everything is a lot better nowadays.
1
u/E_l_n_a_r_i_l Feb 23 '23
You should tell your friend there is a better way to configure the editor color scheme ! :D
1
u/Jgordos Feb 23 '23
stepping through code line by line, looking at the stack and the variables is an excellent way to learn what the code is doing.
You might think that knowing how it’s supposed to work is good enough, but the intended behavior might not be what is actually happening.
1
u/lestofante Feb 23 '23
Fun fact: in baremetal embedded your chip have like 5 or 6 breakpoint, set one too many and things go crazy (like your mcu crash).
Your friend can work around that by removing the breakpoint at the line above and setting it in the line below.
Hope this was helpful
0
u/zanderman112 Feb 23 '23
We've all been here, let's be honest with ourselves.
-1
u/ososalsosal Feb 23 '23
Honestly if you do Task.Run you need to pop a few more confettis in there just to get the debugger to stop
16
u/[deleted] Feb 22 '23
[removed] — view removed comment