aosp have a python script lldbclient.py, which can start lldb server, and create a vscode launch configuration setting supported by codelldb extension.
This generated configuration like this:
{
"name": "(lldbclient.py) Attach surfaceflinger (port: 5039)",
"type": "lldb",
"request": "custom",
"relativePathBase": "/mnt/data/zl/aosp_project",
"sourceMap": {
"/b/f/w": "/mnt/data/zl/aosp_project",
"": "/mnt/data/zl/aosp_project",
".": "/mnt/data/zl/aosp_project"
},
"initCommands": [
"settings append target.exec-search-paths /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/system/lib64/ /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/system/lib64/hw /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/system/lib64/ssl/engines /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/system/lib64/drm /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/system/lib64/egl /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/system/lib64/soundfx /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/vendor/lib64/ /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/vendor/lib64/hw /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/vendor/lib64/egl /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/apex/com.android.runtime/bin"
],
"targetCreateCommands": [
"target create /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/system/bin/surfaceflinger",
"target modules search-paths add / /mnt/data/zl/aosp_project/out/target/product/emulator_x86_64/symbols/"
],
"processCreateCommands": [
"gdb-remote 5039"
],
},
What does the "/b/f/w" in sourceMap section meaning?
I found this sourceMap item cause vscode codelldb set breakpoints failed. This is because when I set a breakpoint in line 1000 with a file such as SurfaceFlinger.cpp, codelldb will send command "b /b/f/w/framework/native/services/surfaceflinger/SurfaceFlinger.cpp:1000" to lldb, lldb cannot find this file, so this failed.
Currently I just remove "/b/f/w": "/mnt/data/zl/aosp_project" in sourceMap section to work around this.
I can't find any information about "/b/f/w" in lldb documetation.