繁体   English   中英

GDB:同时调试同一应用程序的两个实例

[英]GDB: Debug two instances of the same application simultaneous

我正在尝试调试同一应用程序的两个实例。 因此我设置如下:

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

我遇到的问题是只有当前选择的劣质继续。 有没有办法让所有低级人员继续执行一个命令?

解决方案:

如果使用以下序列,它将起作用:

(gdb) attach pid1
(gdb) add-inferior
(gdb) inferior 2
(gdb) attach pid2
(gdb) set schedule-multiple on
(gdb) b hello-world.cpp:8
Breakpoint 1 at 0x557a557761fd: ../hello-world.cpp:8. (2 locations)
(gdb) continue

感谢克劳斯!

要继续所有附加的进程,您必须在 gdb 中设置调度程序模式。

设置调度程序锁定关闭

现在继续让所有线程继续。

有关调度程序模式的详细说明,请查看此处

最好的方法是使用第二个终端。 为什么你有这个只能使用一个的限制?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM