All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] externalsrc.bbclass: dynamical change of DEBUG_PREFIX_MAP
@ 2021-06-23 13:06 Frederic Martinsons
  2021-06-23 13:06 ` [PATCH 2/2] package.bbclass: manage external sources for debug source file packaging Frederic Martinsons
  2021-06-27 22:04 ` [OE-core] [PATCH 1/2] externalsrc.bbclass: dynamical change of DEBUG_PREFIX_MAP Richard Purdie
  0 siblings, 2 replies; 9+ messages in thread
From: Frederic Martinsons @ 2021-06-23 13:06 UTC (permalink / raw)
  To: openembedded-core; +Cc: Frederic Martinsons

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 <frederic.martinsons@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-06 14:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 13:06 [PATCH 1/2] externalsrc.bbclass: dynamical change of DEBUG_PREFIX_MAP Frederic Martinsons
2021-06-23 13:06 ` [PATCH 2/2] package.bbclass: manage external sources for debug source file packaging Frederic Martinsons
2021-06-23 13:09   ` Frederic Martinsons
2021-06-27 22:00     ` [OE-core] " Richard Purdie
2021-06-28  4:46       ` Frederic Martinsons
     [not found]       ` <168CA58BB55AA64E.608@lists.openembedded.org>
2021-07-06 14:54         ` Frederic Martinsons
2021-06-27 21:58   ` Richard Purdie
2021-06-27 22:04 ` [OE-core] [PATCH 1/2] externalsrc.bbclass: dynamical change of DEBUG_PREFIX_MAP Richard Purdie
2021-06-28  4:35   ` Frederic Martinsons

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.