Cargo debug info remaps the modified source tree to TARGET_DBGSRC_DIR.
Include this reverse map in CodeLLDB launch configs even when rootfs-dbg
is disabled. Use the Cargo workspace as its source root while preserving
the existing rootfs-debug mappings for other recipes.

AI-Generated: Uses GitHub Copilot
Signed-off-by: Enguerrand de Ribaucourt 
<[email protected]>
---
 meta/lib/oeqa/selftest/cases/devtool.py     |  3 +++
 scripts/lib/devtool/ide_plugins/ide_code.py | 13 ++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py 
b/meta/lib/oeqa/selftest/cases/devtool.py
index 38bd3301cf..ca76597bbe 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -4408,6 +4408,9 @@ class DevtoolIdeSdkRustTests(DevtoolIdeSdkTests):
 
         self.assertIn('vadimcn.vscode-lldb', extensions['recommendations'])
         self.assertEqual(launch['type'], 'lldb')
+        target_dbgsrc_dir = get_bb_var('TARGET_DBGSRC_DIR', recipe_name)
+        self.assertEqual(
+            launch['sourceMap'][target_dbgsrc_dir], os.path.realpath(tempdir))
         server_task = next(
             task for task in tasks if task['label'] == launch['preLaunchTask'])
         self.assertIn('lldb-server platform --server', server_task['args'][-1])
diff --git a/scripts/lib/devtool/ide_plugins/ide_code.py 
b/scripts/lib/devtool/ide_plugins/ide_code.py
index e18c6a703d..596586ee9e 100644
--- a/scripts/lib/devtool/ide_plugins/ide_code.py
+++ b/scripts/lib/devtool/ide_plugins/ide_code.py
@@ -566,15 +566,22 @@ class IdeVSCode(IdeBase):
         source_map = {
             "/usr/include": os.path.join(modified_recipe.recipe_sysroot, 
"usr", "include")
         }
-        if lldb_config.image_recipe.rootfs_dbg:
+        rootfs_dbg = lldb_config.image_recipe.rootfs_dbg
+        is_cargo = modified_recipe.build_tool is BuildTool.CARGO
+        if is_cargo or rootfs_dbg:
+            source_root = (
+                modified_recipe.real_srctree
+                if is_cargo else "${workspaceFolder}")
             # Map build-time paths back to the workspace source tree.
             for target_path, host_path in 
modified_recipe.reverse_debug_prefix_map.items():
                 if host_path.startswith(modified_recipe.real_srctree):
                     source_map[target_path] = (
-                        "${workspaceFolder}"
+                        source_root
                         + host_path[len(modified_recipe.real_srctree):])
-                else:
+                elif rootfs_dbg:
                     source_map[target_path] = host_path
+
+        if rootfs_dbg:
             if "/usr/src/debug" in source_map:
                 logger.error(
                     'Key "/usr/src/debug" already exists in source_map. '

-- 
2.53.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#248653): 
https://lists.openembedded.org/g/openembedded-core/message/248653
Mute This Topic: https://lists.openembedded.org/mt/121938796/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to