diff options
author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2024-02-25 21:47:02 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-27 11:38:46 +0000 |
commit | c82c57621be1447ff2bceb89f232de05b2b6f3a3 (patch) | |
tree | 61f2c5f883b8a1b66b156bcb2cc6ad39451a68d1 /scripts/lib/devtool/ide_sdk.py | |
parent | a5b75e29ff1163f433a707506161943289e98d6c (diff) | |
download | poky-c82c57621be1447ff2bceb89f232de05b2b6f3a3.tar.gz |
devtool: ide-sdk prefer sources from workspace
Improve the previous commit:
- log an error if some assumptions are not true
- Use TARGET_DBGSRC_DIR variable
- Do the same for ide none
Why the additional source mapping is required:
For example the cmake-example recipe refers to sources like this:
./recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-readelf \
-wi image/usr/bin/cmake-example | grep -B1 DW_AT_comp_dir
...
<560> DW_AT_name : (indirect line string, offset: 0x1da):
/usr/src/debug/cmake-example/1.0/oe-local-files/cpp-example.cpp
...
Another example is powertop:
./recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-readelf \
-wi image/usr/sbin/powertop | grep -B1 DW_AT_comp_dir
...
<561> DW_AT_name : (indirect line string, offset: 0x1da):
/usr/src/debug/powertop/2.15/src/devlist.cpp
...
For recipes with local files this works. The oe-local-files folder is
not available in the rootfs-dbg and therefore the sources are first
found in the workspace folder. GDB searches for source files in various
places:
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Source-Path.html
However, for the powertop example the sources opened in the editor are
from the rootfs-dbg instead of from the workspace.
Bitbake calls the compiler with
-fmacro-prefix-map=${S}=${TARGET_DBGSRC_DIR}
where TARGET_DBGSRC_DIR defaults to "/usr/src/debug/${PN}/${PV}".
A source map which maps the recipe specific path from TARGET_DBGSRC_DIR
to the workspace fixes this.
The already existing source map for /usr/src/debug applies for all other
recipes. It finds the sources (read only) in the rootfs-dbg folder.
(From OE-Core rev: 06601632c1879cb80276f9b36de91fb7808311a5)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/ide_sdk.py')
-rwxr-xr-x | scripts/lib/devtool/ide_sdk.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py index 289bbbf47c..7807b322b3 100755 --- a/scripts/lib/devtool/ide_sdk.py +++ b/scripts/lib/devtool/ide_sdk.py | |||
@@ -301,6 +301,7 @@ class RecipeModified: | |||
301 | self.staging_incdir = None | 301 | self.staging_incdir = None |
302 | self.strip_cmd = None | 302 | self.strip_cmd = None |
303 | self.target_arch = None | 303 | self.target_arch = None |
304 | self.target_dbgsrc_dir = None | ||
304 | self.topdir = None | 305 | self.topdir = None |
305 | self.workdir = None | 306 | self.workdir = None |
306 | self.recipe_id = None | 307 | self.recipe_id = None |
@@ -357,7 +358,6 @@ class RecipeModified: | |||
357 | 'PACKAGE_DEBUG_SPLIT_STYLE') | 358 | 'PACKAGE_DEBUG_SPLIT_STYLE') |
358 | self.path = recipe_d.getVar('PATH') | 359 | self.path = recipe_d.getVar('PATH') |
359 | self.pn = recipe_d.getVar('PN') | 360 | self.pn = recipe_d.getVar('PN') |
360 | self.pv = recipe_d.getVar('PV') | ||
361 | self.recipe_sysroot = os.path.realpath( | 361 | self.recipe_sysroot = os.path.realpath( |
362 | recipe_d.getVar('RECIPE_SYSROOT')) | 362 | recipe_d.getVar('RECIPE_SYSROOT')) |
363 | self.recipe_sysroot_native = os.path.realpath( | 363 | self.recipe_sysroot_native = os.path.realpath( |
@@ -368,6 +368,7 @@ class RecipeModified: | |||
368 | recipe_d.getVar('STAGING_INCDIR')) | 368 | recipe_d.getVar('STAGING_INCDIR')) |
369 | self.strip_cmd = recipe_d.getVar('STRIP') | 369 | self.strip_cmd = recipe_d.getVar('STRIP') |
370 | self.target_arch = recipe_d.getVar('TARGET_ARCH') | 370 | self.target_arch = recipe_d.getVar('TARGET_ARCH') |
371 | self.target_dbgsrc_dir = recipe_d.getVar('TARGET_DBGSRC_DIR') | ||
371 | self.topdir = recipe_d.getVar('TOPDIR') | 372 | self.topdir = recipe_d.getVar('TOPDIR') |
372 | self.workdir = os.path.realpath(recipe_d.getVar('WORKDIR')) | 373 | self.workdir = os.path.realpath(recipe_d.getVar('WORKDIR')) |
373 | 374 | ||