diff mbox

arch/arm/kernel/setup.c does not compile at -O0

Message ID 55BA4C4B.3070705@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Mason July 30, 2015, 4:09 p.m. UTC
On 30/07/2015 15:58, Mason wrote:

> But the problem seems to be on a higher level. My debugger
> just doesn't see ANY local variable whatsoever.

I found the magic setting!

NB: I'm using gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11)

If I add either:

KBUILD_CFLAGS  += $(call cc-option, -gdwarf-2,)
or
KBUILD_CFLAGS  += $(call cc-option, -gdwarf-3,)

to my top-level Makefile, then DS-5 is able to display local variables.


However, if I add:

KBUILD_CFLAGS  += $(call cc-option, -gdwarf-4,)

or nothing at all, DS-5 just ignores local variables.


It appears that "gcc -g" and "gcc -gdwarf-2 -g" generate different
debugging information... What debugging format does "gcc -g" use?
(Not DWARF, apparently.)

I'll try setting KBUILD_CFLAGS += -gdwarf-2
instead of $(call cc-option, -gdwarf-2,)
=> Yes, that works too.
Does anyone know the difference?

So basically, I'm now using this patch locally:

$ git diff Makefile 

Regards.

Comments

Mason July 31, 2015, 8:28 a.m. UTC | #1
On 30/07/2015 18:09, Mason wrote:

> It appears that "gcc -g" and "gcc -gdwarf-2 -g" generate different
> debugging information... What debugging format does "gcc -g" use?

For the sake of completeness.

My compiler:
gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11)

-gdwarf-2 generates DWARF 2
-gdwarf-3 generates DWARF 3
-g generates DWARF 4

It seems that my aging version of DS-5
"ARM DS-5 Development Studio version 5.13 build 1622" dated 2012/12/14
did NOT support DWARF 4 debug format...
(at least not the DWARF 4 generated by gcc 4.9.3)

which is weird because the changelog for 5.12 states:
"Support for DWARF4 debug information generated by gcc 4.5 releases"

> I'm now using this patch locally:
> 
> $ git diff Makefile
> diff --git a/Makefile b/Makefile
> index f9041e6d4d19..f79c480f8922 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -641,10 +641,8 @@ KBUILD_CFLAGS      += -fomit-frame-pointer
>  endif
>  endif
>  
> -KBUILD_CFLAGS   += $(call cc-option, -fno-var-tracking-assignments)
> -
>  ifdef CONFIG_DEBUG_INFO
> -KBUILD_CFLAGS  += -g
> +KBUILD_CFLAGS  += -gdwarf-3
>  KBUILD_AFLAGS  += -Wa,--gdwarf-2
>  endif

Regards.
diff mbox

Patch

diff --git a/Makefile b/Makefile
index f9041e6d4d19..f79c480f8922 100644
--- a/Makefile
+++ b/Makefile
@@ -641,10 +641,8 @@  KBUILD_CFLAGS      += -fomit-frame-pointer
 endif
 endif
 
-KBUILD_CFLAGS   += $(call cc-option, -fno-var-tracking-assignments)
-
 ifdef CONFIG_DEBUG_INFO
-KBUILD_CFLAGS  += -g
+KBUILD_CFLAGS  += -gdwarf-3
 KBUILD_AFLAGS  += -Wa,--gdwarf-2
 endif