codelldb
codelldb copied to clipboard
breakpoint not worked when remote attach
Which extension version: 1.6.0
When I remote attach a process,set up the sourcemap,the breakpoints added through the gui did not work properly. I found the file path of the breakpoints was incorrect. example: sourcemap set "sourceMap": {"G:\app\src\main\cpp":"${workspaceRoot}"}(workspaceRoot="G:\cpp") the breakpoint set via gui through the console breakpoint list show file = 'g:\cpp\test.cpp', line = 243, exact_match = 0, locations = 0 (pending) but the correct file path should be G:\app\src\main\cpp\test.cpp,if i added it via console with the correct file path,it worked
Please see this. Try to break in disassembly mode, as described on that page to see what the debugger thinks the source path is. Possibly something to do with upper/lower case of drive letters - LLDB does not always handle Windows case-insensitivity properly.
Also, next time please fill out the bug template, so I don't need to guess at which OS you are running.
Please see this. Try to break in disassembly mode, as described on that page to see what the debugger thinks the source path is. Possibly something to do with upper/lower case of drive letters - LLDB does not always handle Windows case-insensitivity properly.
Also, next time please fill out the bug template, so I don't need to guess at which OS you are running.
without sourcemap set,the disassembly windows show that the path is "G:\app\src\main\cpp\test.cpp:220",I think this has nothing to do with the case of the path,because when setting a breakpoint via console, no matter if I use "G:/app" or "g:/app", it worked,i searched the issues,and found the problem is similar to that: https://github.com/vadimcn/vscode-lldb/issues/160 when setting the breakpoint via gui,the path should be reversed according to the sourcemap set before calling BreakpointCreateByLocation
sourcemap set "sourceMap": {"G:\app\src\main\cpp":"${workspaceRoot}"}(workspaceRoot="G:\cpp") the breakpoint set via gui through the console breakpoint list show file = 'g:\cpp\test.cpp', line = 243, exact_match = 0, locations = 0 (pending) but the correct file path should be G:\app\src\main\cpp\test.cpp,if i added it via console with the correct file path,it worked
By setting sourceMap to {"G:\app\src\main\cpp": "G:\cpp" }
(after expanding the macros) you are telling the debugger "Whenever you find G:\app\src\main\cpp
prefix in a source file path retrieved from the debug info, replace it with G:\cpp
before trying to open that file". So it looks like the debugger is doing exactly what you told it to do.
I'll hypothesize that you are running debugger on the same machine you've compiled the binary on? If so, don't set sourceMap at all, as the source hadn't been moved from its original location.
Otherwise, I'm am going to need more info about your setup:
- Where was the source located at compilation time?
- Where was it moved for debugging?
- What exact command have you used to set a breakpoint via the console?
A verbose log of your debug session would be helpful.
sourcemap set "sourceMap": {"G:\app\src\main\cpp":"${workspaceRoot}"}(workspaceRoot="G:\cpp") the breakpoint set via gui through the console breakpoint list show file = 'g:\cpp\test.cpp', line = 243, exact_match = 0, locations = 0 (pending) but the correct file path should be G:\app\src\main\cpp\test.cpp,if i added it via console with the correct file path,it worked
By setting sourceMap to
{"G:\app\src\main\cpp": "G:\cpp" }
(after expanding the macros) you are telling the debugger "Whenever you findG:\app\src\main\cpp
prefix in a source file path retrieved from the debug info, replace it withG:\cpp
before trying to open that file". So it looks like the debugger is doing exactly what you told it to do.I'll hypothesize that you are running debugger on the same machine you've compiled the binary on? If so, don't set sourceMap at all, as the source hadn't been moved from its original location.
Otherwise, I'm am going to need more info about your setup:
- Where was the source located at compilation time?
- Where was it moved for debugging?
- What exact command have you used to set a breakpoint via the console?
A verbose log of your debug session would be helpful.
yes,i compiled on my pc,deployed the binary to my android phone,and attached to the app process of my phone, but for some reason,i used different source location when debugging,so i set the sourcemap, original location:G:\app\src\main\cpp,and moved to G:\cpp for debug which is also the vscode workspacedirectory the command i used is "breakpoint set -l 243-f G:\app\src\main\cpp\test.cpp"
where can i find the log,i have seen the contents of console and output window,dose not help
where can i find the log,i have seen the contents of console and output window,dose not help
This page explains how to enable verbose logging.
"breakpoint set -l 243-f G:\app\src\main\cpp\test.cpp"
You are setting this breakpoint using the original source location. If source map had taken effect, you should have been using breakpoint set -l 243-f G:\cpp\test.cpp"
.
For the most part, codelldb extension is not involved with source mapping, it merely forwards this information to LLDB. You can check whether source map got set successful using settings show target.source-map
command.
@qq6r Were you able to get it working? BTW, there was a bug fix in 1.6.4, related to remote debugging, might be worth trying again.
Hello, I think i've got the same error, I'm trying to remote-debug from windows vscode on a wsl binary, when I manually set a breakpoint with initCommands it does breaks into the gui ( after setting the correct sourceMap ), however the breakpoints sets through vscode GUI doesn't break,
on wsl : /mnt/c/Users/Yukiix/test project ssh/cmake-build-debug-wsl$ lldb-server platform --listen "*:1234" --server
Here's my launch.json :
{ "name": "Launch wsl", "type": "lldb", "request": "launch", "program": "${workspaceFolder}/cmake-build-debug-wsl/MyExample", // binary compiled from remote-toolchain "sourceMap": { "/mnt/c/Users/Yukiix/test": "${workspaceFolder}", // map remote wsl workdir to workspaceFolder }, "initCommands": [ "platform select remote-linux", "platform connect connect://localhost:1234", "settings set target.inherit-env false", "breakpoint set --file main.cpp --line 9", // this one does break into my gui, but no other breakpoints sets through gui does break ], },
I haven't tried to run vscode in remote mode on wsl