Hacker News new | past | comments | ask | show | jobs | submit login

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?



Only 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.


If the CPU doesn't support conditional hardware breakpoints, some do.


The 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.


grandparent 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.


The rationale is explained in the article; it's for speed.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: