3 ms·
Out of interest what are your main use cases for needing conditional breakpoints?
by n4r9 2y ago
Out of interest what are your main use cases for needing conditional breakpoints?
- feelamee 2y agoFor example for debugging gui apps. Let's say we have function `on_event(event_type)` and you want to examine execution if `event_type == mouse_up`. In reality conditional breakpoint is the same as simple, but simple require support from code: ``` void on_event(event_type type) { if (type == mouse_up) { // set breakpoint here } } ``` Also useful to break depending on call stack[0] [0] https://sourceware.org/gdb/current/onlinedocs/gdb.html/Convenience-Funs.html#index-_0024_005fcaller_005fis_002c-convenience-function https://sourceware.org/gdb/current/onlinedocs/gdb.html/Conve...
- n4r9 2y agoYeah, I was specifically wondering about cases where you can't or don't want to change the source code. Sometimes that happens when I need to explore the state after a long process e.g. loading a large file. Generally though I avoid them like the plague as they make the code so slow. Curious to know what other people use it for.