4 ms·
Using a print statement to display the value of a variable is no different than putting a breakpoint at that line and just reading the state of your program off
by Jorge1o1 8y ago
Using a print statement to display the value of a variable is no different than putting a breakpoint at that line and just reading the state of your program off the locals window
- kevin_thibedeau 8y agoThe latter freezes your program for non-trivial amounts of time which can be problematic in some cases.
- yorwba 8y agoYes, for example setting a breakpoint in your input method engine while it's relaying your keystrokes to the terminal with the debugger tends to go poorly. On the other hand, gdb supports the "commands" command, which allows you to automatically run a script when a specific breakpoint is run. That way, you can do essentially everything you can do by inserting logging statements directly into the code, but without having to restart the process.
- pjmlp 8y agoWith dynamic trace points and scripting there is no freezing.
- jstimpfle 8y agothere are significant differences as discussed elsewhere. Additionally, you can't read globals or other complex computed expressions from the locals window...
- deleted 8y ago[deleted]