top | item 41106646

(no title)

cordenr | 1 year 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?

discuss

order

flohofwoe|1 year ago

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.

pjmlp|1 year ago

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

pjmlp|1 year ago

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.

kazinator|1 year ago

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.

mgaunard|1 year ago

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