Thread (8 messages) flat view 8 messages, 2 authors, 2021-06-28
STALE1914d

[PATCH 1/2] externalsrc.bbclass: dynamical change of DEBUG_PREFIX_MAP

From: Frederic Martinsons <hidden>
Date: 2021-06-23 13:06:47
Subsystem: the rest · Maintainer: Linus Torvalds

When using external source manager (devtool), the debug symbol generated
by the compilation doesn't point to the right directory.
This is normally handled by gcc options that are defined
in DEBUG_PREFIX_MAP in conf/bitbake.conf.

But the path in it are hardcoded and point to WORKDIR which is
not overloaded by devtool.

This patch takes the parent directory of external source directory
and prepend correct path to DEBUG_PREFIX_MAP.

Moreover, to avoid wrong path resolution during dwarfsrcfiles step
in splitdebuginfo, it make B variable point to the same
structure as EXTERNALSRC (if EXTERNALSRC_BUILD is not defined).

Signed-off-by: Frederic Martinsons <redacted>
---
 meta/classes/externalsrc.bbclass | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 3d6b80bee2..de5ef714b4 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -53,14 +53,26 @@ python () {
             d.setVar('BB_DONT_CACHE', '1')
 
     if externalsrc:
+        import os
         import oe.recipeutils
         import oe.path
 
+        pn = d.getVar('PN')
+        # taken from bitbake.conf
+        debugsrcdir = "/usr/src/debug/%s/%s%s-%s" % (pn, d.getVar('EXTENDPE'), d.getVar('PV'), d.getVar('PR'))
+        externalsrc_parentdir = os.path.dirname(externalsrc)
+
+        debug_prefix_map_ext = "-fmacro-prefix-map=%s=%s " % (externalsrc_parentdir, debugsrcdir)
+        macro_prefix_map_ext = "-fdebug-prefix-map=%s=%s " % (externalsrc_parentdir, debugsrcdir)
+        d.prependVar('DEBUG_PREFIX_MAP', debug_prefix_map_ext)
+        d.prependVar('DEBUG_PREFIX_MAP', macro_prefix_map_ext)
+
         d.setVar('S', externalsrc)
         if externalsrcbuild:
             d.setVar('B', externalsrcbuild)
         else:
-            d.setVar('B', '${WORKDIR}/${BPN}-${PV}/')
+            builddir = os.path.join(externalsrc_parentdir, "%s-build" % pn)
+            d.setVar('B', builddir)
 
         local_srcuri = []
         fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help