簡體   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