Exception on inserting breakpoint into running program (GDB on Windows)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 30/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- cpp, typescript
- 領域
- devtools
研究方向
Start from the log: the setBreakpoints request is followed by a -break-insert MI command and then a *stopped,reason="signal-received",signal-name="0" line, so the bad signal mapping happens between the GDB MI output and the DAP event. Reproduce by building the small infinite-loop program with -g on Windows, setting a breakpoint while it runs, and checking whether the debugger emits the Signal 0 stop. Done means the breakpoint binds without a stop event, confirmed by a clean run on Windows with the same launch.json.
由索引模型根據 Issue 內容生成。
描述
Environment
- OS and version: Windows 26H2 26300.9457
- VS Code: 1.142.0
- C/C++ extension: 1.34.4
- GDB / LLDB version: 18.1, MSYS2 ucrt64 package
Bug Summary and Steps to Reproduce
Bug Summary:
On Windows, using gdb as a debugger for the program, inserting breakpoint when application is running causes exception:
Exception has occurred.
Signal 0
Steps to reproduce:
- Compile simple program with infinite loop, with debugging option
-g, for example :
#include <stdint.h>
int main()
{
uint32_t a = 0;
uint32_t b = 1;
uint32_t c;
while (true)
{
c = a + b;
a = b;
b = c;
}
return 0;
}
- Launch program using this configuration
launch.json :
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch app",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}\\app.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "E:\\_Installed\\Programs\\MSYS2\\ucrt64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable code formating for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"text": "set charset UTF-8"
},
{
"description": "Update breakpoints immediately",
"text": "set breakpoint always-inserted on",
"ignoreFailures": true
}
],
"logging":
{
"engineLogging": true,
"trace": true,
"traceResponse": true
}
},
]
}
- Insert breakpoint, for example on
c = a + b. - Exception pops up:
Exception has occurred.
Signal 0
Debugger Configurations
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch app",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}\\app.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "E:\\_Installed\\Programs\\MSYS2\\ucrt64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable code formating for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"text": "set charset UTF-8"
},
{
"description": "Update breakpoints immediately",
"text": "set breakpoint always-inserted on",
"ignoreFailures": true
}
],
"logging":
{
"engineLogging": true,
"trace": true,
"traceResponse": true
}
},
]
}
Debugger Logs
Output from debug console:
<-- C (setBreakpoints-11): {"command":"setBreakpoints","arguments":{"source":{"name":"main.cpp","path":"e:\\_P\\VScode\\Crater\\src\\main.cpp"},"lines":[11],"breakpoints":[{"line":11}],"sourceModified":false},"type":"request","seq":11}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4776) <-1026-exec-interrupt\r\n"},"seq":641}
1: (4776) <-1026-exec-interrupt
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) ->1026^done\r\n"},"seq":643}
1: (4779) ->1026^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) ->(gdb)\r\n"},"seq":645}
1: (4779) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) 1026: elapsed time 2\r\n"},"seq":647}
1: (4779) 1026: elapsed time 2
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) ->~\"\\nThread \"\r\n"},"seq":649}
1: (4779) ->~"\nThread "
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) ->~\"1 stopped.\\n\"\r\n"},"seq":651}
1: (4779) ->~"1 stopped.\n"
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"\nThread "},"seq":653}
Thread
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"1 stopped.\n"},"seq":655}
1 stopped.
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) ->~\"0x00007ff700051024 in main () at E:/_P/VScode/Crater/src/main.cpp:11\\n\"\r\n"},"seq":657}
1: (4779) ->~"0x00007ff700051024 in main () at E:/_P/VScode/Crater/src/main.cpp:11\n"
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"0x00007ff700051024 in main () at E:/_P/VScode/Crater/src/main.cpp:11\n"},"seq":659}
0x00007ff700051024 in main () at E:/_P/VScode/Crater/src/main.cpp:11
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) ->~\"11\\t\\t\\tc = a + b;\\n\"\r\n"},"seq":661}
1: (4779) ->~"11\t\t\tc = a + b;\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) ->*stopped,reason=\"signal-received\",signal-name=\"0\",signal-meaning=\"Signal 0\",frame={addr=\"0x00007ff700051024\",func=\"main\",args=[],file=\"E:/_P/VScode/Crater/src/main.cpp\",fullname=\"E:/_P/VScode/Crater/src/main.cpp\",line=\"11\",arch=\"i386:x86-64\"},thread-id=\"1\",stopped-threads=\"all\"\r\n"},"seq":663}
1: (4779) ->*stopped,reason="signal-received",signal-name="0",signal-meaning="Signal 0",frame={addr="0x00007ff700051024",func="main",args=[],file="E:/_P/VScode/Crater/src/main.cpp",fullname="E:/_P/VScode/Crater/src/main.cpp",line="11",arch="i386:x86-64"},thread-id="1",stopped-threads="all"
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"11\t\t\tc = a + b;\n"},"seq":664}
11 c = a + b;
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) ->&\"\\n\"\r\n"},"seq":667}
1: (4779) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4779) <-1027-break-insert -f main.cpp:11\r\n"},"seq":669}
1: (4779) <-1027-break-insert -f main.cpp:11
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4784) ->^done\r\n"},"seq":671}
1: (4784) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4784) ->(gdb)\r\n"},"seq":673}
1: (4784) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4795) ->1027^done,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00007ff70005101c\",func=\"main()\",file=\"E:/_P/VScode/Crater/src/main.cpp\",fullname=\"E:/_P/VScode/Crater/src/main.cpp\",line=\"11\",thread-groups=[\"i1\"],times=\"0\",original-location=\"main.cpp:11\"}\r\n"},"seq":675}
1: (4795) ->1027^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x00007ff70005101c",func="main()",file="E:/_P/VScode/Crater/src/main.cpp",fullname="E:/_P/VScode/Crater/src/main.cpp",line="11",thread-groups=["i1"],times="0",original-location="main.cpp:11"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4795) ->(gdb)\r\n"},"seq":677}
1: (4795) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4795) 1027: elapsed time 15\r\n"},"seq":679}
1: (4795) 1027: elapsed time 15
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4795) ->&\"\\n\"\r\n"},"seq":681}
1: (4795) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4795) ->^done\r\n"},"seq":683}
1: (4795) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4795) ->(gdb)\r\n"},"seq":685}
1: (4795) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4797) <-1028-symbol-list-lines E:/_P/VScode/Crater/src/main.cpp\r\n"},"seq":687}
1: (4797) <-1028-symbol-list-lines E:/_P/VScode/Crater/src/main.cpp
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4810) ->1028^done,lines=[{pc=\"0x00007ff700051000\",line=\"4\"},{pc=\"0x00007ff70005100c\",line=\"5\"},{pc=\"0x00007ff700051014\",line=\"6\"},{pc=\"0x00007ff70005101c\",line=\"11\"},{pc=\"0x00007ff700051020\",line=\"11\"},{pc=\"0x00007ff700051024\",line=\"11\"},{pc=\"0x00007ff700051027\",line=\"12\"},{pc=\"0x00007ff70005102b\",line=\"12\"},{pc=\"0x00007ff70005102f\",line=\"13\"},{pc=\"0x00007ff700051032\",line=\"13\"},{pc=\"0x00007ff700051036\",line=\"9\"},{pc=\"0x00007ff700051038\",line=\"0\"}]\r\n"},"seq":689}
1: (4810) ->1028^done,lines=[{pc="0x00007ff700051000",line="4"},{pc="0x00007ff70005100c",line="5"},{pc="0x00007ff700051014",line="6"},{pc="0x00007ff70005101c",line="11"},{pc="0x00007ff700051020",line="11"},{pc="0x00007ff700051024",line="11"},{pc="0x00007ff700051027",line="12"},{pc="0x00007ff70005102b",line="12"},{pc="0x00007ff70005102f",line="13"},{pc="0x00007ff700051032",line="13"},{pc="0x00007ff700051036",line="9"},{pc="0x00007ff700051038",line="0"}]
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4810) ->(gdb)\r\n"},"seq":691}
1: (4810) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4810) ->&\"\\n\"\r\n"},"seq":693}
1: (4810) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4810) ->^done\r\n"},"seq":695}
1: (4810) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4810) ->(gdb)\r\n"},"seq":697}
1: (4810) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4810) 1028: elapsed time 13\r\n"},"seq":699}
1: (4810) 1028: elapsed time 13
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4814) Send Event AD7BreakpointBoundEvent\r\n"},"seq":701}
1: (4814) Send Event AD7BreakpointBoundEvent
--> R (setBreakpoints-11): {"type":"response","request_seq":11,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":2,"verified":true,"line":11,"BoundBreakpoints":[]}]},"seq":703}
--> E (breakpoint): {"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":2,"verified":true,"line":11,"BoundBreakpoints":[]}},"seq":705}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4816) <-1029-stack-list-frames --thread 1 0 1000\r\n"},"seq":707}
1: (4816) <-1029-stack-list-frames --thread 1 0 1000
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4825) ->1029^done,stack=[frame={level=\"0\",addr=\"0x00007ff700051024\",func=\"main\",file=\"E:/_P/VScode/Crater/src/main.cpp\",fullname=\"E:/_P/VScode/Crater/src/main.cpp\",line=\"11\",arch=\"i386:x86-64\"}]\r\n"},"seq":709}
1: (4825) ->1029^done,stack=[frame={level="0",addr="0x00007ff700051024",func="main",file="E:/_P/VScode/Crater/src/main.cpp",fullname="E:/_P/VScode/Crater/src/main.cpp",line="11",arch="i386:x86-64"}]
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4826) ->(gdb)\r\n"},"seq":711}
1: (4826) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4826) 1029: elapsed time 9\r\n"},"seq":713}
1: (4826) 1029: elapsed time 9
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4826) ->&\"\\n\"\r\n"},"seq":715}
1: (4826) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4826) ->^done\r\n"},"seq":717}
1: (4826) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4826) ->(gdb)\r\n"},"seq":719}
1: (4826) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4828) Send Event AD7ExceptionEvent\r\n"},"seq":721}
1: (4828) Send Event AD7ExceptionEvent
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"Execute debugger commands using \"-exec <command>\", for example \"-exec info registers\" will list registers in use (when GDB is the debugger)\r\n"},"seq":723}
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
--> E (stopped): {"type":"event","event":"stopped","body":{"reason":"exception","threadId":1,"text":"Signal 0","allThreadsStopped":true,"source":{"name":"main.cpp","path":"e:\\_P\\VScode\\Crater\\src\\main.cpp","sources":[],"checksums":[]},"line":11,"column":1},"seq":725}
<-- C (threads-12): {"command":"threads","type":"request","seq":12}
--> R (threads-12): {"type":"response","request_seq":12,"success":true,"command":"threads","body":{"threads":[{"id":1,"name":" [1]"},{"id":2,"name":" [2]"},{"id":3,"name":" [3]"},{"id":4,"name":" [4]"}]},"seq":728}
<-- C (stackTrace-13): {"command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":20},"type":"request","seq":13}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4851) <-1030-list-features\r\n"},"seq":731}
1: (4851) <-1030-list-features
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4856) ->1030^done,features=[\"frozen-varobjs\",\"pending-breakpoints\",\"thread-info\",\"data-read-memory-bytes\",\"breakpoint-notifications\",\"ada-task-info\",\"language-option\",\"info-gdb-mi-command\",\"undefined-command-error-code\",\"exec-run-start-option\",\"data-disassemble-a-option\",\"simple-values-ref-types\",\"python\"]\r\n"},"seq":733}
1: (4856) ->1030^done,features=["frozen-varobjs","pending-breakpoints","thread-info","data-read-memory-bytes","breakpoint-notifications","ada-task-info","language-option","info-gdb-mi-command","undefined-command-error-code","exec-run-start-option","data-disassemble-a-option","simple-values-ref-types","python"]
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4856) ->(gdb)\r\n"},"seq":735}
1: (4856) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4856) ->&\"\\n\"\r\n"},"seq":737}
1: (4856) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4857) ->^done\r\n"},"seq":739}
1: (4857) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4857) ->(gdb)\r\n"},"seq":741}
1: (4857) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4857) 1030: elapsed time 5\r\n"},"seq":743}
1: (4857) 1030: elapsed time 5
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4858) <-1031-stack-list-arguments --thread 1 2 0 0\r\n"},"seq":745}
1: (4858) <-1031-stack-list-arguments --thread 1 2 0 0
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4872) ->1031^done,stack-args=[frame={level=\"0\",args=[]}]\r\n"},"seq":747}
1: (4872) ->1031^done,stack-args=[frame={level="0",args=[]}]
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4872) ->(gdb)\r\n"},"seq":749}
1: (4872) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4872) ->&\"\\n\"\r\n"},"seq":751}
1: (4872) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4872) ->^done\r\n"},"seq":753}
1: (4872) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4872) ->(gdb)\r\n"},"seq":755}
1: (4872) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4872) 1031: elapsed time 14\r\n"},"seq":757}
1: (4872) 1031: elapsed time 14
--> R (stackTrace-13): {"type":"response","request_seq":13,"success":true,"command":"stackTrace","body":{"stackFrames":[{"id":1000,"name":"main()","source":{"name":"main.cpp","path":"e:\\_P\\VScode\\Crater\\src\\main.cpp","sources":[],"checksums":[]},"line":11,"column":1,"instructionPointerReference":"0x00007ff700051024"}],"totalFrames":1},"seq":759}
<-- C (evaluate-14): {"command":"evaluate","arguments":{"expression":"return","frameId":1000,"context":"hover","line":16,"column":2,"source":{"name":"main.cpp","path":"e:\\_P\\VScode\\Crater\\src\\main.cpp","sources":[],"checksums":[]}},"type":"request","seq":14}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5836) <-1032-var-create --thread 1 --frame 0 - * \"return\"\r\n"},"seq":762}
1: (5836) <-1032-var-create --thread 1 --frame 0 - * "return"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5849) ->1032^error,msg=\"-var-create: unable to create variable object\"\r\n"},"seq":764}
1: (5849) ->1032^error,msg="-var-create: unable to create variable object"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5849) ->(gdb)\r\n"},"seq":766}
1: (5849) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5849) 1032: elapsed time 12\r\n"},"seq":768}
1: (5849) 1032: elapsed time 12
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5849) ->&\"\\n\"\r\n"},"seq":770}
1: (5849) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5849) ->^done\r\n"},"seq":772}
1: (5849) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5849) ->(gdb)\r\n"},"seq":774}
1: (5849) ->(gdb)
--> R (evaluate-14): {"type":"response","request_seq":14,"success":false,"command":"evaluate","message":"Evaluation error","body":{},"seq":776}
Other Extensions
No response
Additional Information
Exception shows the moment breakpoint is placed.
This is small program to reproduce it.
Originally the issue was in somewhat bigger program with WinApi window created and GetMessageA() function in infinite loop. There the exception was shown to be at GetMessageA().
- 主要語言
- TypeScript
- 星號
- 6.2k
- 分支
- 1.7k
- 平均合併
- 1 天 16 小時
- 30 天內合併 PR
- 20
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/vscode-cpptools 的其他 Issue
-
Allow case-insensitive suppression of parameter inlay hints可能已有人在做 @Colengms 於 8 天前認領。 未關閉bug Feature: Inlay Hint fixed Language Service
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/vscode-cpptools#14829 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
code runner未關閉Language Service more info needed
難度 5/5 一週以上 新手友好度 15/100
microsoft/vscode-cpptools#14840 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 4/5 1-2 天 新手友好度 46/100
microsoft/vscode-cpptools#14839 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 38/100
microsoft/vscode-cpptools#14834 ·
維護者通常 1 天內回覆
-
Directory iteration no longer respects files.exclude可能已有人在做 @Colengms 於 12 天前認領。 未關閉bug Language Service
microsoft/vscode-cpptools#14827 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 microsoft/vscode-cpptools 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 83/100
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 72/100
zts212653/clowder-ai#1678 ·
維護者通常 1 天內回覆
-
good first issue
難度 2/5 1-3 小時 新手友好度 64/100
Progressive-Victory/the-website#680 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 68/100