From 666d80e2586b302239e49deb62b5418160b6dd9d Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Mon, 26 Jun 2023 21:22:56 +0200 Subject: gdb: example to set bp on all threads but one, show convenience vars --- src/tools/gdb.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/tools/gdb.md') diff --git a/src/tools/gdb.md b/src/tools/gdb.md index d0191af..5ae9062 100644 --- a/src/tools/gdb.md +++ b/src/tools/gdb.md @@ -223,6 +223,14 @@ Create conditional breakpoints for a function `void foo(int i)` in the debugee. cond 2 if i == 7 ``` +## Set breakpoint on all threads except one +Create conditional breakpoint using the `$_thread` [convenience +variable][gdb-convenience-vars]. +```markdown + # Create conditional breakpoint on all threads except thread 12. + b foo if $_thread != 12 +``` + ## Catch SIGSEGV and execute commands This creates a `catchpoint` for the `SIGSEGV` signal and attached the `command` to it. @@ -364,3 +372,5 @@ executed. To workaround that bug one can create a wrapper function which calls handler end ``` + +[gdb-convenience-vars]: https://sourceware.org/gdb/onlinedocs/gdb/Convenience-Vars.html#Convenience-Vars -- cgit v1.2.3