作者hardman1110 (笨小孩)
看板C_and_CPP
標題[問題] vscode c++ debug doesn’t work
時間Tue Dec 20 16:37:04 2022
*[36m開發平台(Platform): (Ex: Win10, Linux, ...) *[m
linux
*[36m編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)*[m
g++
*[36m額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) *[m
都是自己的 .so 全都有加在 task.json args 項目裡
*[36m問題(Question):*[m
已完成:
1.用vscode 在 hello word 等簡單程式設過斷點並偵錯
2. 開新資料夾加入 task.json and lanch.json
https://github.com/ChiFang/question/blob/master/tasks.json
https://github.com/ChiFang/question/blob/master/launch.json
3. 成功用2編譯出執行檔 直接terminal 執行可用
狀況:
如下圖 按debug c/c++ file 想單步執行 會在terminal 出現 Unable to connect to server!
想請教各位大大小弟設定有哪需要更改
*[36m餵入的資料(Input):*[m
*[36m預期的正確結果(Expected Output):*[m
可以跟terminal 下gdb一樣且用gui偵錯
*[36m錯誤結果(Wrong Output):*[m
Unable to connect to server! in terminal
*[36m程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔) *[m
https://i.imgur.com/R58ZbcZ.jpg
--
Sent from nPTT on my iPhone
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.137.62.206 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1671525428.A.E31.html
推 ko27tye: gdb的路徑? 12/20 18:34
→ hardman1110: 是指launch.json下要多加 “miDebuggerPath”: path 12/20 22:28
→ hardman1110: to gab? 12/20 22:28
→ hardman1110: to gdb 12/20 22:28
推 wulouise: 你確定program名字叫做test嗎? launch裡面的"program" 12/20 22:33
→ wulouise: 有辦法直接跑嗎? 12/20 22:33
→ wulouise: 你先試試看command line跑gdb <launch的路徑>能不能跑吧 12/20 22:34
→ tomsawyer: 這是docker還是ssh? 12/20 22:37
推 wulouise: ...等等 你這看起來是remote server? title bar有ssh 12/20 22:39
→ hardman1110: Test.cpp 編出的 test 可跑 也可 cmd line 下 gdb . 12/20 23:25
→ hardman1110: /test跑完 另外我確實是用vscode remote連到Linux 12/20 23:25
→ hardman1110: 上的docker 12/20 23:25
→ tomsawyer: 你是連上linux server還是裡面的docker有開ssh 12/21 00:22
→ hardman1110: 我是在a電腦開vscode連到b電腦 且直接連進b電腦上的 12/21 00:38
→ hardman1110: docker(vscode 的plugin) 12/21 00:38
→ hardman1110: SSH ip 是b電腦的 12/21 00:43
推 Dracarys: 設定這好麻煩 我都直接使用lldb 12/22 01:39
→ youchenliu: 你需要的應該是Dev Containers插件 12/26 01:49