microsoft / microsoft/vscode-cpptools

Breakpoints are broken in cpptools-1.1.2 (incorrect source path mapping)

Open
#6,562 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger embedded
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Debugger

Describe the bug

  • OS: Windows 8 x64
  • VSCode version:
Версия: 1.51.1
Фиксация: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Дата: 2020-11-10T23:34:32.027Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
ОС: Windows_NT x64 6.2.9200
  • C/C++ Extension Version: 1.1.2

I have recently upgraded cpptools from v1.0.1 to v1.1.2. After that I am unable to set breakpoints (they are set in disabled state). I am debugging program that runs on the board with ARM processor and Linux OS (the gdbserver runs on that board). On the PC side gdb-9.2 is used. The sources are located at the PC and the executable is accessible on the target board using samba. Here is the launch.json:

{
   "version": "0.2.0",
   "configurations": [
      {
         "name": "Remote debug",
         "type": "cppdbg",
         "request": "launch",
         "program": "//192.168.122.233/share/OGL/build/main.elf",
         "miDebuggerServerAddress": "192.168.122.233:1234",
         "args": [],
         "stopAtEntry": true,
         "cwd": "${workspaceRoot}",
         "environment": [],
         "externalConsole": true,
         "sourceFileMap":{
            "/share/OGL":"${workspaceRoot}"
         },
         "windows": {
           "MIMode": "gdb",
           "miDebuggerPath": "C:\\gdb-arm-linux\\bin\\arm-linux-gnueabihf-gdb.exe",
         }
       }      
   ]
}

There is an error in the logs (see below). As you can see the file path is invalid (see second line of the log below) because of \ symbols were used (instead of /). So, the source path mapping is probably broken.

Here is the log from the 1.1.2 version, when I tried to set breakpoint (it does not work):

<--   C (setBreakpoints-13): {"command":"setBreakpoints","arguments":{"source":{"name":"test.c","path":"d:\\Oleg\\!Projects\\Neon3\\Software\\Client\\CtrlPi\\test.c","sources":[],"checksums":[]},"lines":[163],"breakpoints":[{"line":163}],"sourceModified":false},"type":"request","seq":13}
1: (30181) <-1033-break-insert -f \share\OGL\test.c:163
1: (30194) ->&"No source file named \\share\\OGL\\test.c.\n"
1: (30195) ->1033^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\\share\\OGL\\test.c:163",times="0",original-location="\\share\\OGL\\test.c:163"}
1: (30195) ->(gdb)
1: (30195) 1033: elapsed time 13
1: (30195) ->&"\n"
1: (30195) ->^done
1: (30195) ->(gdb)
1: (30202) Send Event AD7BreakpointErrorEvent

And here is the log from the 1.0.1 version (it works flawlessly):

<--   C (setBreakpoints-12): {"command":"setBreakpoints","arguments":{"source":{"name":"test.c","path":"d:\\Oleg\\!Projects\\Neon3\\Software\\Client\\CtrlPi\\test.c","sources":[],"checksums":[]},"lines":[164],"breakpoints":[{"line":164}],"sourceModified":false},"type":"request","seq":12}
1: (30356) <-1032-break-insert -f test.c:164
1: (30367) ->1032^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00013afc",func="main",file="test.c",fullname="D:\\Oleg\\!Projects\\Neon3\\Software\\Client\\CtrlPi\\test.c",line="164",thread-groups=["i1"],times="0",original-location="test.c:164"}
1: (30367) ->(gdb)
1: (30367) 1032: elapsed time 11
1: (30367) ->&"\n"
1: (30367) ->^done
1: (30367) ->(gdb)
1: (30379) <-1033-symbol-list-lines D:\\Oleg\\!Projects\\Neon3\\Software\\Client\\CtrlPi\\test.c
1: (30389) ->1033^done,lines=[{pc="0x00013ac8",line="155"},{pc="0x00013ac8",line="156"},{pc="0x00013ad8",line="157"},{pc="0x00013adc",line="158"},{pc="0x00013ae0",line="160"},{pc="0x00013ae4",line="162"},{pc="0x00013ae4",line="163"},{pc="0x00013afc",line="164"},{pc="0x00013b0c",line="167"},{pc="0x00013b24",line="168"},{pc="0x00013b34",line="170"},{pc="0x00013b4c",line="171"},{pc="0x00013b5c",line="173"},{pc="0x00013b74",line="174"},{pc="0x00013b84",line="178"},{pc="0x00013b98",line="179"},{pc="0x00013b9c",line="184"},{pc="0x00013ba8",line="185"},{pc="0x00013bb8",line="186"},{pc="0x00013bbc",line="187"},{pc="0x00013bc8",line="188"},{pc="0x00013bcc",line="189"},{pc="0x00013bd0",line="190"},{pc="0x000201f4",line="106"},{pc="0x000201f4",line="107"},{pc="0x000201f4",line="108"},{pc="0x000201f4",line="109"},{pc="0x0002022c",line="110"},{pc="0x00020244",line="111"},{pc="0x00020258",line="112"},{pc="0x00020290",line="114"},{pc="0x00020290",line="115"},{pc="0x000202dc",line="116"},{pc="0x00020314",line="117"},{pc="0x00020324",line="118"},{pc="0x00020324",line="119"},{pc="0x00020324",line="121"},{pc="0x00020338",line="123"},{pc="0x00020338",line="124"},{pc="0x00020338",line="125"},{pc="0x0002033c",line="126"},{pc="0x00020344",line="128"},{pc="0x00020344",line="129"},{pc="0x00020360",line="130"},{pc="0x00020388",line="131"},{pc="0x0002039c",line="132"},{pc="0x0002039c",line="133"},{pc="0x0002039c",line="134"},{pc="0x000203a0",line="135"},{pc="0x000203a8",line="137"},{pc="0x000203a8",line="138"},{pc="0x000203a8",line="139"},{pc="0x000203c8",line="140"},{pc="0x000203e4",line="141"},{pc="0x000203e8",line="142"},{pc="0x000203f0",line="144"},{pc="0x00020408",line="146"},{pc="0x00020410",line="147"},{pc="0x00020418",line="148"},{pc="0x00020420",line="149"},{pc="0x0002042c",line="115"},{pc="0x0002044c",line="129"},{pc="0x0002046c",line="30"},{pc="0x0002046c",line="31"},{pc="0x0002046c",line="32"},{pc="0x0002046c",line="33"},{pc="0x0002046c",line="34"},{pc="0x0002046c",line="35"},{pc="0x0002046c",line="37"},{pc="0x00020488",line="38"},{pc="0x00020498",line="39"},{pc="0x000204a8",line="40"},{pc="0x000204b0",line="42"},{pc="0x000204b0",line="42"},{pc="0x000204c4",line="42"},{pc="0x000204d8",line="43"},{pc="0x000204e4",line="44"},{pc="0x000204f4",line="45"},{pc="0x0002050c",line="47"},{pc="0x00020510",line="48"},{pc="0x00020534",line="50"},{pc="0x00020544",line="56"},{pc="0x00020558",line="0"},{pc="0x00020698",line="71"},{pc="0x000206ac",line="72"},{pc="0x000206b0",line="73"},{pc="0x000206b4",line="67"},{pc="0x000206c8",line="68"},{pc="0x000206cc",line="69"},{pc="0x000206d0",line="88"},{pc="0x000206d4",line="89"},{pc="0x000206d8",line="85"},{pc="0x000206dc",line="86"},{pc="0x000206e0",line="82"},{pc="0x000206e4",line="83"},{pc="0x000206e8",line="79"},{pc="0x000206ec",line="80"},{pc="0x000206f0",line="76"},{pc="0x000206f4",line="77"},{pc="0x000206f8",line="63"},{pc="0x00020704",line="64"},{pc="0x00020708",line="0"}]
1: (30389) ->(gdb)
1: (30389) ->&"\n"
1: (30389) ->^done
1: (30389) ->(gdb)
1: (30390) 1033: elapsed time 11
1: (30397) Send Event AD7BreakpointBoundEvent

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by reproducing the remote-debug configuration from launch.json and compare the setBreakpoints GDB requests and sourceFileMap handling between cpptools 1.0.1 and 1.1.2; done means breakpoints in test.c bind successfully with the Windows-to-Linux source mapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.