Home > OS >  GDB: Debug two instances of the same application simultaneous
GDB: Debug two instances of the same application simultaneous

Time:01-21

I am trying to debug two instances of the same application. Therefore I setup as followed:

(gdb) set target-async on
(gdb) set non-stop on
(gdb) attach 10862
(gdb) set scheduler-locking off
(gdb) add-inferior
(gdb) inferior 2
(gdb) attach 10863
(gdb) set scheduler-locking off
(gdb) b hello-world.cpp:8
Breakpoint 1 at 0x557a557761fd: ../hello-world.cpp:8. (2 locations)
(gdb) continue

The Problem I have is that only the currently selected inferior is continued. Is there a way to let all inferiors continue with one command?

CodePudding user response:

To continue all attached processes you have to set the scheduler mode in gdb.

set scheduler-locking off

A continue now let all threads continue.

For a detailed description of scheduler mode take a look here

CodePudding user response:

The best way to do that is to use a second terminal. Why do you have this limitation of using only one ?

  •  Tags:  
  • Related