All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hongxu Jia <hongxu.jia@windriver.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 0/4] base/bbclass: use target path to replace build ones in debugging info
Date: Fri, 29 Jan 2016 11:39:23 +0800	[thread overview]
Message-ID: <56AADEEB.6050106@windriver.com> (raw)
In-Reply-To: <1454000660.10340.52.camel@linuxfoundation.org>

On 01/29/2016 01:04 AM, Richard Purdie wrote:
> On Thu, 2016-01-28 at 10:58 +0800, Hongxu Jia wrote:
>> On 01/28/2016 06:13 AM, Richard Purdie wrote:
>>> On Wed, 2016-01-27 at 14:34 -0500, Khem Raj wrote:
>>>>> On Jan 27, 2016, at 5:16 AM, Richard Purdie <
>>>>> richard.purdie@linuxfoundation.org> wrote:
>>>>>
>>>>> I like the idea of this a lot, I think it makes sense however
>>>>> why
>>>>> not
>> My original trying was just added them here, but the variable parsing
>> at here is too early, the ${BPN}, ${B} and {S} was assigned with
>> 'defaultpkgname' at this time. Which we have:
>> ...
>>> -fdebug-prefix-map=/buildarea/raid0/hjia/build-20160127-yocto
>>> -buildpath-2/
>> tmp/work/core2-64-poky-linux/defaultpkgname/1.0-r0/defaultpkgname
>> -1.0=
>> /usr/src/defaultpkgname
>
> I think this is just from your debugging technique. By the time these
> are used in recipes, they will have the correct value for these
> variables. Expansion happens late, not when the line is parsed.

For var DEBUG_FLAGS, it indeed has correct value at last, but the CFLAGS
and TARGET_CFLAGS was expanded when DEBUG_FLAGS has 'defaultpkgname'

The CFLAGS and TARGET_CFLAGS is shell variables (export CFLAGS=), it
seems shell variable is expanded only once.

>
> Can you be more specific about how you tested this and the problem you
> saw?

1. Modify bitbake.conf
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index e80ee18..3ddb9e8 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -546,7 +546,14 @@ EXTRA_OEMAKE_prepend_task-install = 
"${PARALLEL_MAKEINST} "
  ##################################################################
  # Optimization flags.
  ##################################################################
-DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types"
+DEBUG_FLAGS ?= "-g \
+    -feliminate-unused-debug-types \
+    -fdebug-prefix-map=${B}=/usr/src/${BPN} \
+    -fdebug-prefix-map=${S}=/usr/src/${BPN} \
+    -gno-record-gcc-switches \
+    -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+    -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+"

2. Build lib32-glibc, there are still buildpath QA Warnings
...
$ bitbake lib32-glibc
ERROR: QA Issue: File 
work/core2-32-pokymllib32-linux/lib32-glibc/2.22-r0/packages-split/lib32-glibc-dev/usr/lib/crt1.o 
in package contained reference to tmpdir
...

3. vim temp/run.do_compile
...
export 
TARGET_CFLAGS="-I/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/sysroots/lib32-qemux86-64/usr/include 
-O2 -pipe -g -feliminate-unused-debug-types 
-fdebug-prefix-map=/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/work/core2-64-poky-linux/defaultpkgname/1.0-r0/defaultpkgname-1.0=/usr/src/defaultpkgname 
-fdebug-prefix-map=/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/work/core2-64-poky-linux/defaultpkgname/1.0-r0/defaultpkgname-1.0=/usr/src/defaultpkgname 
-gno-record-gcc-switches 
-fdebug-prefix-map=/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/sysroots/x86_64-linux= 
-fdebug-prefix-map=/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/sysroots/qemux86-64= 
"

export 
CFLAGS="-I/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/sysroots/lib32-qemux86-64/usr/include 
-O2 -pipe -g -feliminate-unused-debug-types 
-fdebug-prefix-map=/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/work/core2-64-poky-linux/defaultpkgname/1.0-r0/defaultpkgname-1.0=/usr/src/defaultpkgname 
-fdebug-prefix-map=/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/work/core2-64-poky-linux/defaultpkgname/1.0-r0/defaultpkgname-1.0=/usr/src/defaultpkgname 
-gno-record-gcc-switches 
-fdebug-prefix-map=/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/sysroots/x86_64-linux= 
-fdebug-prefix-map=/buildarea/raid0/hjia/build-20160128-yocto-buildpath2/tmp/sysroots/qemux86-64= 
"
...

>> With searching the manual, I could not find a gcc option to
>> do the path substitution on switches in debugging information.
>>
>> Maybe we could add a patch for gcc to do this. I could try in V2
>> if there is no side effect.
> I like that idea.

I have sent a simple modification on gcc in V2, it adds
a new option to not record  '-fdebug-prefix-map' to gcc
command line switches in debugging information.

//Hongxu

>> Compile with '-fdebug-prefix-map':
>> objdump -g packages-split/lib32-glibc-dev/usr/lib/gcrt1.o
>> ...
>>> <0><5e>: Abbrev Number: 1 (DW_TAG_compile_unit)
>>>     <5f>   DW_AT_producer    : (indirect string, offset: 0xbb): GNU
>>> C99 5.3.0 -m32
>> -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mpreferred-stack
>> -boundary=4 -g -O2
>> -std=gnu99 -fgnu89-inline -fdebug-prefix
>> -map=/buildarea/raid0/hjia/build-20160119-
>> yocto-buildpath/tmp/work/core2-32-pokymllib32-linux/lib32-glibc/2.22
>> -r0/git=/usr/src/glibc
>> -feliminate-unused-debug-types -fmerge-all-constants -frounding-math
>> -ftls-model=initial-exec
>>
>> When we use '-fdebug-prefix-map', the TMPDIR was added to switches.
>> Although
>> remove the switches is to avoid buildpath QA check, the side effect
>> is
>> the other
>> part of compile options have also been removed.
>>
>> If we need to leave the switches in, I think we could tweak the
>> buildpath QA check,
>> which allows TMPDIR in '-fdebug-prefix-map=' without warning. I think
>> I
>> should
>> send a V2 to do this for discussion.
>>
>> Solution1: do some path substitutions on the switches
>> Solution2: tweak buildpath QA check to allow TMPDIR in '-fdebug
>> -prefix-map='
>>
>> I will try them in V2.
> Thanks, that part looks good to me.
>
> Cheers,
>
> Richard



  reply	other threads:[~2016-01-29  3:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27  8:45 [PATCH 0/4] base/bbclass: use target path to replace build ones in debugging info Hongxu Jia
2016-01-27  8:45 ` [PATCH 1/4] base/bbclass: use target path as compile dir " Hongxu Jia
2016-01-27  8:45 ` [PATCH 2/4] base/bbclass: disallow appending the compile options " Hongxu Jia
2016-01-27 19:20   ` Khem Raj
2016-01-27  8:45 ` [PATCH 3/4] base/bbclass: use target path as include dir " Hongxu Jia
2016-01-27  8:45 ` [PATCH 4/4] base/bbclass: fix missing to replace build " Hongxu Jia
2016-01-27 10:16 ` [PATCH 0/4] base/bbclass: use target path to replace build ones " Richard Purdie
2016-01-27 19:34   ` Khem Raj
2016-01-27 22:13     ` Richard Purdie
2016-01-28  2:58       ` Hongxu Jia
2016-01-28 17:04         ` Richard Purdie
2016-01-29  3:39           ` Hongxu Jia [this message]
2016-01-29  6:40             ` Richard Purdie
2016-01-29  6:58               ` Hongxu Jia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56AADEEB.6050106@windriver.com \
    --to=hongxu.jia@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.