11 ms·
Doesn't gdb allow breakpoints to be made to be conditional? Add a breakpoint somewhere in the code, say added as breakpoint #2. Then; condition 2 (x_id
by cordenr 2y ago
Doesn't gdb allow breakpoints to be made to be conditional?
Add a breakpoint somewhere in the code, say added as breakpoint #2. Then;
condition 2 (x_id == 153827)
Or is there some other reason to not do this?
- flohofwoe 2y agoOnly reason I can think of is that conditional breakpoints in the debugger can be much slower than compiling that same condition right into the debuggee.
- pjmlp 2y agoIf the CPU doesn't support conditional hardware breakpoints, some do.
- pjmlp 2y agoThe only reason is that many still don't learn how to use debuggers, people write blog posts about language featuritis, rewrite X in Y, and then keep using debuggers as if stuck in the 1960's.
- mgaunard 2y agoThe rationale is explained in the article; it's for speed.
- kazinator 2y agograndparent is not advocating making it unconditional, but just adding the nop instruction to the __asm part. Inserting an unconditional debug trap into a shipping, production executable, is a complete nonstarter. The program will receive a signal that is fatal, if unhandled.