On Mon, 2026-10-26 at 09:55 +0100, Enguerrand de Ribaucourt via
lists.openembedded.org wrote:
> libstd-rs DWARF paths use a source prefix under work-shared, while
> rust-native stages the standard-library sources in the recipe native
> sysroot.
> Derive the target prefix from BitBake metadata and map it to the SDK
> source
> tree so LLDB runtime frames resolve without host Rust sources.
> 
> AI-Generated: Uses GitHub Copilot
> Signed-off-by: Enguerrand de Ribaucourt
> <[email protected]>
> ---
>  scripts/lib/devtool/ide_plugins/ide_code.py |  2 ++
>  scripts/lib/devtool/ide_sdk.py              | 19 +++++++++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/scripts/lib/devtool/ide_plugins/ide_code.py
> b/scripts/lib/devtool/ide_plugins/ide_code.py
> index 596586ee9e..623a54ddc6 100644
> --- a/scripts/lib/devtool/ide_plugins/ide_code.py
> +++ b/scripts/lib/devtool/ide_plugins/ide_code.py
> @@ -568,6 +568,8 @@ class IdeVSCode(IdeBase):
>          }
>          rootfs_dbg = lldb_config.image_recipe.rootfs_dbg
>          is_cargo = modified_recipe.build_tool is BuildTool.CARGO
> +        if is_cargo:
> +            source_map.update(modified_recipe.cargo_std_source_map)
>          if is_cargo or rootfs_dbg:
>              source_root = (
>                  modified_recipe.real_srctree
> diff --git a/scripts/lib/devtool/ide_sdk.py
> b/scripts/lib/devtool/ide_sdk.py
> index 9fd95f0a63..b6ac02e367 100755
> --- a/scripts/lib/devtool/ide_sdk.py
> +++ b/scripts/lib/devtool/ide_sdk.py
> @@ -915,6 +915,7 @@ class RecipeModified:
>          self.cargo_packageconfig_confargs = None
>          self.cargo_rustflags = None
>          self.cargo_env = None
> +        self.cargo_std_source_map = {}
>  
>          # Populated after bitbake built all the recipes
>          self._installed_binaries = None
> @@ -1134,6 +1135,24 @@ class RecipeModified:
>                  'SYSTEM_DEPS_BUILD_INTERNAL': 'never',
>                  'ZSTD_SYS_USE_PKG_CONFIG': '1',
>              })
> +            # libstd-rs DWARF paths map to sources staged by rust-
> native.
> +            libstd_recipe_d = parse_recipe(
> +                config, tinfoil, 'libstd-rs', appends=True,
> +                filter_workspace=False)
> +            if libstd_recipe_d:
> +                libstd_rustsrc = libstd_recipe_d.getVar('RUSTSRC')
> +                target_dbgsrc_dir =
> libstd_recipe_d.getVar('TARGET_DBGSRC_DIR')
> +                libstd_tmpdir = libstd_recipe_d.getVar('TMPDIR')
> +                if libstd_rustsrc and target_dbgsrc_dir and
> libstd_tmpdir:
> +                    shared_source_dir = os.path.join(libstd_tmpdir,
> 'work-shared')
> +                    target_source_root = os.path.join(
> +                        target_dbgsrc_dir,
> +                        os.path.relpath(libstd_rustsrc,
> shared_source_dir),
> +                        'library')
> +                    sdk_source_root = os.path.join(
> +                        self.recipe_sysroot_native,
> self.libdir.lstrip('/'),

The native rustlib path is built with self.libdir (the target libdir).
On multilib (/usr/lib64) it doesn't match the rust-native sysroot.
Please use the native libdir (STAGING_LIBDIR_NATIVE). The selftest
hard-codes usr/lib and so doesn't catch this.

Regards,
Adrian


> +                        'rustlib', 'src', 'rust', 'library')
> +                    self.cargo_std_source_map[target_source_root] =
> sdk_source_root
>              self.build_tool = BuildTool.CARGO
>          elif bb.data.inherits_class('module', recipe_d):
>              self.build_tool = BuildTool.KERNEL_MODULE
> 
> 
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#248853): 
https://lists.openembedded.org/g/openembedded-core/message/248853
Mute This Topic: https://lists.openembedded.org/mt/121938797/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to