Use Cargo RUSTFLAGS to populate reverse debug mappings and recognize Rust
--remap-path-prefix alongside the existing GCC prefix-map options. The
following LLDB source-map change depends on these normalized mappings.

AI-Generated: Uses GitHub Copilot
Signed-off-by: Enguerrand de Ribaucourt 
<[email protected]>
---
 scripts/lib/devtool/ide_sdk.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py
index 44429e80b0..f22a98cedf 100755
--- a/scripts/lib/devtool/ide_sdk.py
+++ b/scripts/lib/devtool/ide_sdk.py
@@ -1140,6 +1140,9 @@ class RecipeModified:
         if self.build_tool is BuildTool.KERNEL_MODULE:
             self.reverse_debug_prefix_map = 
self._init_reverse_debug_prefix_map(
                 self.kernel_cc)
+        elif self.build_tool is BuildTool.CARGO:
+            self.reverse_debug_prefix_map = 
self._init_reverse_debug_prefix_map(
+                self.cargo_rustflags)
         else:
             self.reverse_debug_prefix_map = 
self._init_reverse_debug_prefix_map(
                 recipe_d.getVar('DEBUG_PREFIX_MAP'))
@@ -1292,15 +1295,20 @@ class RecipeModified:
         return ':'.join(self.solib_search_path(image))
 
     def _init_reverse_debug_prefix_map(self, debug_prefix_map):
-        """Parses GCC map options and returns a mapping of target to host 
paths.
+        """Parses compiler map options and returns a mapping of target to host 
paths.
 
-        This function scans a string containing GCC options such as 
-fdebug-prefix-map,
+        This function scans a string containing compiler options such as 
-fdebug-prefix-map,
         -fmacro-prefix-map, and -ffile-prefix-map (in both '--option value' 
and '--option=value'
         forms), extracting all mappings from target paths (used in debug info) 
to host source
         paths. If multiple mappings for the same target path are found, the 
most suitable
         host path is selected (preferring 'sources' over 'build' directories).
         """
-        prefixes = ("-fdebug-prefix-map", "-fmacro-prefix-map", 
"-ffile-prefix-map")
+        prefixes = (
+            "-fdebug-prefix-map",
+            "-fmacro-prefix-map",
+            "-ffile-prefix-map",
+            "--remap-path-prefix",
+        )
         all_mappings = {}
         args = shlex.split(debug_prefix_map)
         i = 0

-- 
2.53.0

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

Reply via email to