3 ms·
Can you please explain how does debugger can help in cases where you can't wait too long on a breakpoint because some thread or service waiting on it will fail?
by smusamashah 3y ago
Can you please explain how does debugger can help in cases where you can't wait too long on a breakpoint because some thread or service waiting on it will fail? I do this many times at work in Java with intellij. I do fine with breakpoints most of the times but sometimes print statements is the only way to trace the thing.
From your comment I feel like I am missing better ways to debug.
- Gibbon1 3y agoThing that annoys me is I know that debuggers could do a quick grab and dash. Either stop the program snag the state of a variable and go. Or set a sample point where when it gets hit the debugger takes a sample of local state and continues. It aught to be able to do that within a few hundred clock cycles. Myself I use error/debug printf, a command line interface, debugger, and sometimes an oscilloscope. With error/debug printf I leave them in and just turn them on/off with a compiler switch. Over time they tend to evolve into something that provides good info on what's going on. The command line interface allows me to inspect the program state on the fly and run tests on the fly. The debugger allows me to do random look sees of what the program state is and follow the call tree. Oscilloscope allows me to inspect/debug/verify timing issues. My suggestion to you is implement a command line interface to you program so you can interact and inspect your program while it's running. It's really not hard at all. Implement commands as a table. { "command", handler, extra_data}
- smusamashah 3y agoI don't know how this can be used in a very old and large codebase where no single person knows everything. There is too much state and unknowns at any given time. IDE with breakpoints does help explore the state through stack.
- Groxx 3y agoUse a log breakpoint? No need to recompile then, just add the breakpoint and do the thing again.
- smusamashah 3y agoLog breakpoints are still kind of print debugging. I do add log breakpoints, even add conditionals on them, they however become a huge performance bottleneck in places and best way is to write a print statement in the code itself.
- deergomoo 3y agoAre you able to also set a breakpoint in the service that’s waiting, such that it is also paused? I’m really not familiar with Java but given PhpStorm supports concurrent debugging sessions I assume IntelliJ does too.