diff mbox

ODP debug -O0

Message ID 53D8ECF3.20007@linaro.org
State RFC
Headers show

Commit Message

Taras Kondratiuk July 30, 2014, 1:02 p.m. UTC
On 07/30/2014 03:55 PM, Ciprian Barbu wrote:
> Hi,
> 
> How would I be able to compile ODP with debug symbols and -O0? The
> configure script is automatically generated to compile with -O2 and
> passing additionally CFLAGS=-O0 doesn't really do the trick. We should
> be able to remove -O2 from CFLAGS altogether if needed. Or maybe it's
> already possible with autotools?

I'm using following patch to control debug info and optimization level
via --enable-debug.

Comments

Santosh Shukla July 30, 2014, 1:05 p.m. UTC | #1
my debug patch very look similar to yours :)

On 30 July 2014 18:32, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
> On 07/30/2014 03:55 PM, Ciprian Barbu wrote:
>> Hi,
>>
>> How would I be able to compile ODP with debug symbols and -O0? The
>> configure script is automatically generated to compile with -O2 and
>> passing additionally CFLAGS=-O0 doesn't really do the trick. We should
>> be able to remove -O2 from CFLAGS altogether if needed. Or maybe it's
>> already possible with autotools?
>
> I'm using following patch to control debug info and optimization level
> via --enable-debug.
>
> diff --git a/configure.ac b/configure.ac
> index a5b0241..1124299 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -76,12 +76,16 @@ AM_CONDITIONAL([ODP_NETMAP_ENABLED], [test x$netmap_support = xyes ])
>  # Enable/disable ODP_DEBUG_PRINT
>  ##########################################################################
>  ODP_DEBUG=1
> +ODP_DEBUG_INFO="-ggdb3"
> +ODP_OPT_LEVEL="-O0"
>  AC_ARG_ENABLE([debug],
>      [  --enable-debug         Enable/disable debug],
>      [if ! test "x$enableval" = "xyes"; then
>          ODP_DEBUG=0
> +       ODP_DEBUG_INFO=""
> +       ODP_OPT_LEVEL="-O3"
>      fi])
> -ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG"
> +ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG $ODP_DEBUG_INFO $ODP_OPT_LEVEL"
>
>  ##########################################################################
>  # Check for pthreads availability
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Ciprian Barbu July 30, 2014, 3:06 p.m. UTC | #2
Thanks Maxim, that's what I was looking for. I didn't realize that
CFLAGS are overridden by configure, I thought specifying some CFLAGS
will append to existing "-g -O2".

On Wed, Jul 30, 2014 at 4:05 PM, Santosh Shukla
<santosh.shukla@linaro.org> wrote:
> my debug patch very look similar to yours :)
>
> On 30 July 2014 18:32, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
>> On 07/30/2014 03:55 PM, Ciprian Barbu wrote:
>>> Hi,
>>>
>>> How would I be able to compile ODP with debug symbols and -O0? The
>>> configure script is automatically generated to compile with -O2 and
>>> passing additionally CFLAGS=-O0 doesn't really do the trick. We should
>>> be able to remove -O2 from CFLAGS altogether if needed. Or maybe it's
>>> already possible with autotools?
>>
>> I'm using following patch to control debug info and optimization level
>> via --enable-debug.
>>
>> diff --git a/configure.ac b/configure.ac
>> index a5b0241..1124299 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -76,12 +76,16 @@ AM_CONDITIONAL([ODP_NETMAP_ENABLED], [test x$netmap_support = xyes ])
>>  # Enable/disable ODP_DEBUG_PRINT
>>  ##########################################################################
>>  ODP_DEBUG=1
>> +ODP_DEBUG_INFO="-ggdb3"
>> +ODP_OPT_LEVEL="-O0"
>>  AC_ARG_ENABLE([debug],
>>      [  --enable-debug         Enable/disable debug],
>>      [if ! test "x$enableval" = "xyes"; then
>>          ODP_DEBUG=0
>> +       ODP_DEBUG_INFO=""
>> +       ODP_OPT_LEVEL="-O3"
>>      fi])
>> -ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG"
>> +ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG $ODP_DEBUG_INFO $ODP_OPT_LEVEL"
>>
>>  ##########################################################################
>>  # Check for pthreads availability
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov July 30, 2014, 3:08 p.m. UTC | #3
On 07/30/2014 07:06 PM, Ciprian Barbu wrote:
> Thanks Maxim, that's what I was looking for. I didn't realize that
> CFLAGS are overridden by configure, I thought specifying some CFLAGS
> will append to existing "-g -O2".
they append. but there is priority

gcc -O0 -O3 -O3

will compile with -O0

Maxim.

> On Wed, Jul 30, 2014 at 4:05 PM, Santosh Shukla
> <santosh.shukla@linaro.org> wrote:
>> my debug patch very look similar to yours :)
>>
>> On 30 July 2014 18:32, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
>>> On 07/30/2014 03:55 PM, Ciprian Barbu wrote:
>>>> Hi,
>>>>
>>>> How would I be able to compile ODP with debug symbols and -O0? The
>>>> configure script is automatically generated to compile with -O2 and
>>>> passing additionally CFLAGS=-O0 doesn't really do the trick. We should
>>>> be able to remove -O2 from CFLAGS altogether if needed. Or maybe it's
>>>> already possible with autotools?
>>> I'm using following patch to control debug info and optimization level
>>> via --enable-debug.
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index a5b0241..1124299 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -76,12 +76,16 @@ AM_CONDITIONAL([ODP_NETMAP_ENABLED], [test x$netmap_support = xyes ])
>>>   # Enable/disable ODP_DEBUG_PRINT
>>>   ##########################################################################
>>>   ODP_DEBUG=1
>>> +ODP_DEBUG_INFO="-ggdb3"
>>> +ODP_OPT_LEVEL="-O0"
>>>   AC_ARG_ENABLE([debug],
>>>       [  --enable-debug         Enable/disable debug],
>>>       [if ! test "x$enableval" = "xyes"; then
>>>           ODP_DEBUG=0
>>> +       ODP_DEBUG_INFO=""
>>> +       ODP_OPT_LEVEL="-O3"
>>>       fi])
>>> -ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG"
>>> +ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG $ODP_DEBUG_INFO $ODP_OPT_LEVEL"
>>>
>>>   ##########################################################################
>>>   # Check for pthreads availability
>>>
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> http://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index a5b0241..1124299 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,12 +76,16 @@  AM_CONDITIONAL([ODP_NETMAP_ENABLED], [test x$netmap_support = xyes ])
 # Enable/disable ODP_DEBUG_PRINT
 ##########################################################################
 ODP_DEBUG=1
+ODP_DEBUG_INFO="-ggdb3"
+ODP_OPT_LEVEL="-O0"
 AC_ARG_ENABLE([debug],
     [  --enable-debug         Enable/disable debug],
     [if ! test "x$enableval" = "xyes"; then
         ODP_DEBUG=0
+	ODP_DEBUG_INFO=""
+	ODP_OPT_LEVEL="-O3"
     fi])
-ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG"
+ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG $ODP_DEBUG_INFO $ODP_OPT_LEVEL"
 
 ##########################################################################
 # Check for pthreads availability