* [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
@ 2007-07-11 18:53 Roland McGrath
2007-07-11 21:09 ` Andrew Morton
0 siblings, 1 reply; 14+ messages in thread
From: Roland McGrath @ 2007-07-11 18:53 UTC (permalink / raw)
To: Andrew Morton, Linus Torvalds; +Cc: linux-kernel
The assembler for a while now supports -g to generate source line info just
like the C compiler does. Source-level assembly debugging sounds like an
oxymoron, but it is handy to be able to see the right source file and read
its comments rather than just the disassembly. This patch enables -g for
assembly files when CONFIG_DEBUG_INFO=y and the assembler supports the option.
Signed-off-by: Roland McGrath <roland@redhat.com>
---
Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 8a3c271..88b2252 100644
--- a/Makefile
+++ b/Makefile
@@ -498,6 +498,7 @@ endif
ifdef CONFIG_DEBUG_INFO
CFLAGS += -g
+AFLAGS += $(call as-option, -g)
endif
# Force gcc to behave correct even for buggy distributions
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 18:53 [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO Roland McGrath
@ 2007-07-11 21:09 ` Andrew Morton
2007-07-11 21:30 ` Roland McGrath
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Morton @ 2007-07-11 21:09 UTC (permalink / raw)
To: Roland McGrath; +Cc: Linus Torvalds, linux-kernel, Jason Wessel
On Wed, 11 Jul 2007 11:53:34 -0700 (PDT)
Roland McGrath <roland@redhat.com> wrote:
>
> The assembler for a while now supports -g to generate source line info just
> like the C compiler does. Source-level assembly debugging sounds like an
> oxymoron, but it is handy to be able to see the right source file and read
> its comments rather than just the disassembly. This patch enables -g for
> assembly files when CONFIG_DEBUG_INFO=y and the assembler supports the option.
>
> Signed-off-by: Roland McGrath <roland@redhat.com>
> ---
> Makefile | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 8a3c271..88b2252 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -498,6 +498,7 @@ endif
>
> ifdef CONFIG_DEBUG_INFO
> CFLAGS += -g
> +AFLAGS += $(call as-option, -g)
> endif
>
> # Force gcc to behave correct even for buggy distributions
Jason's kgdb tree does
AFLAGS += -gdwarf2
(for all architectures!) Which is better?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 21:09 ` Andrew Morton
@ 2007-07-11 21:30 ` Roland McGrath
2007-07-11 22:37 ` Jason Wessel
0 siblings, 1 reply; 14+ messages in thread
From: Roland McGrath @ 2007-07-11 21:30 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linus Torvalds, linux-kernel, Jason Wessel
> Jason's kgdb tree does
>
> AFLAGS += -gdwarf2
>
> (for all architectures!) Which is better?
It makes no difference on any platform I care about. -g says "turn on the
default flavor for the target", while -gdwarf2 turns on DWARF flavor even
if the default is different. Every target I know anything in particular
about has DWARF as the default flavor anyway.
Thanks,
Roland
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 21:30 ` Roland McGrath
@ 2007-07-11 22:37 ` Jason Wessel
2007-07-11 22:43 ` Roland McGrath
0 siblings, 1 reply; 14+ messages in thread
From: Jason Wessel @ 2007-07-11 22:37 UTC (permalink / raw)
To: Roland McGrath; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
Roland McGrath wrote:
>> Jason's kgdb tree does
>>
>> AFLAGS += -gdwarf2
>>
>> (for all architectures!) Which is better?
>>
>
> It makes no difference on any platform I care about. -g says "turn on the
> default flavor for the target", while -gdwarf2 turns on DWARF flavor even
> if the default is different. Every target I know anything in particular
> about has DWARF as the default flavor anyway.
>
The -gdwarf2 had a specific reason.
I had not looked at the recent gcc 4.1.x + binutils, but in the gcc
3.x.x compilers when you pass just -g the assembler emitted stabs debug
data on most archs. This not only made the debug object files bigger,
but also the stabs sections were not always parsed correctly in various
versions of gdb. I found the dwarf2 sections to be smaller and more
reliable to allow source level assembly stepping as well as debug frame
info through the assembly linked functions (ie better back traces).
If it is the case that the gcc 4.1.x + binutils all emit dwarf2 as the
default you can use just -g.
I'll also take a moment to mention that in the kgdb branch, I also
modified the top level make file so that you can un-optimize kernel
modules compiled outside the kernel tree. I find this this is useful if
you want to step through significant chunks of code in your kernel
module IE:
make ARCH=i386 -C KERN_SRC_LOCATION M=/my_mod COMPTIMIZE=-O0
Jason.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 22:37 ` Jason Wessel
@ 2007-07-11 22:43 ` Roland McGrath
2007-07-11 23:03 ` Andrew Morton
0 siblings, 1 reply; 14+ messages in thread
From: Roland McGrath @ 2007-07-11 22:43 UTC (permalink / raw)
To: Jason Wessel; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
> The -gdwarf2 had a specific reason.
I have no objection to it.
Thanks,
Roland
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 22:43 ` Roland McGrath
@ 2007-07-11 23:03 ` Andrew Morton
2007-07-11 23:07 ` Roland McGrath
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Andrew Morton @ 2007-07-11 23:03 UTC (permalink / raw)
To: Roland McGrath; +Cc: Jason Wessel, Linus Torvalds, linux-kernel, linux-arch
On Wed, 11 Jul 2007 15:43:27 -0700 (PDT)
Roland McGrath <roland@redhat.com> wrote:
> > The -gdwarf2 had a specific reason.
>
> I have no objection to it.
>
OK, thanks. So I ended up with the below as a probably-2.6.23 thing:
From: Roland McGrath <roland@redhat.com>
The assembler for a while now supports -gdwarf to generate source line info
just like the C compiler does. Source-level assembly debugging sounds like an
oxymoron, but it is handy to be able to see the right source file and read its
comments rather than just the disassembly. This patch enables -gdwarf for
assembly files when CONFIG_DEBUG_INFO=y and the assembler supports the option.
Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
Makefile | 1 +
1 files changed, 1 insertion(+)
diff -puN Makefile~pass-g-to-assembler-under-config_debug_info Makefile
--- a/Makefile~pass-g-to-assembler-under-config_debug_info
+++ a/Makefile
@@ -498,6 +498,7 @@ endif
ifdef CONFIG_DEBUG_INFO
CFLAGS += -g
+AFLAGS += $(call as-option, -gdwarf)
endif
# Force gcc to behave correct even for buggy distributions
_
If there are problems it'll most likely be with oddball architectures
running older compilers, I guess. If something blows up we might need to
make this an arch/foo/Makefile thing.
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 23:03 ` Andrew Morton
@ 2007-07-11 23:07 ` Roland McGrath
2007-07-11 23:15 ` Andreas Schwab
2007-07-11 23:40 ` Linus Torvalds
2 siblings, 0 replies; 14+ messages in thread
From: Roland McGrath @ 2007-07-11 23:07 UTC (permalink / raw)
To: Andrew Morton; +Cc: Jason Wessel, Linus Torvalds, linux-kernel, linux-arch
> OK, thanks. So I ended up with the below as a probably-2.6.23 thing:
Works for me.
Thanks,
Roland
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 23:03 ` Andrew Morton
2007-07-11 23:07 ` Roland McGrath
@ 2007-07-11 23:15 ` Andreas Schwab
2007-07-11 23:19 ` Roland McGrath
2007-07-11 23:40 ` Linus Torvalds
2 siblings, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2007-07-11 23:15 UTC (permalink / raw)
To: Andrew Morton
Cc: Roland McGrath, Jason Wessel, Linus Torvalds, linux-kernel,
linux-arch
Andrew Morton <akpm@linux-foundation.org> writes:
> diff -puN Makefile~pass-g-to-assembler-under-config_debug_info Makefile
> --- a/Makefile~pass-g-to-assembler-under-config_debug_info
> +++ a/Makefile
> @@ -498,6 +498,7 @@ endif
>
> ifdef CONFIG_DEBUG_INFO
> CFLAGS += -g
> +AFLAGS += $(call as-option, -gdwarf)
The option is officially called -gdwarf-2, and -gdwarf2 is an alias for
backward compatibility. But -gdwarf is ambigous and will error out.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 23:15 ` Andreas Schwab
@ 2007-07-11 23:19 ` Roland McGrath
2007-07-11 23:27 ` Andreas Schwab
0 siblings, 1 reply; 14+ messages in thread
From: Roland McGrath @ 2007-07-11 23:19 UTC (permalink / raw)
To: Andreas Schwab
Cc: Andrew Morton, Jason Wessel, Linus Torvalds, linux-kernel,
linux-arch
> > +AFLAGS += $(call as-option, -gdwarf)
>
> The option is officially called -gdwarf-2, and -gdwarf2 is an alias for
> backward compatibility. But -gdwarf is ambigous and will error out.
AFLAGS is actually passed to $(CC), not $(AS), and -gdwarf works there
(it's an unambiguous prefix of -gdwarf-2).
Thanks,
Roland
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 23:19 ` Roland McGrath
@ 2007-07-11 23:27 ` Andreas Schwab
0 siblings, 0 replies; 14+ messages in thread
From: Andreas Schwab @ 2007-07-11 23:27 UTC (permalink / raw)
To: Roland McGrath
Cc: Andrew Morton, Jason Wessel, Linus Torvalds, linux-kernel,
linux-arch
Roland McGrath <roland@redhat.com> writes:
>> > +AFLAGS += $(call as-option, -gdwarf)
>>
>> The option is officially called -gdwarf-2, and -gdwarf2 is an alias for
>> backward compatibility. But -gdwarf is ambigous and will error out.
>
> AFLAGS is actually passed to $(CC), not $(AS), and -gdwarf works there
> (it's an unambiguous prefix of -gdwarf-2).
Oh yes, you're right, sorry for the noise.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 23:03 ` Andrew Morton
2007-07-11 23:07 ` Roland McGrath
2007-07-11 23:15 ` Andreas Schwab
@ 2007-07-11 23:40 ` Linus Torvalds
2007-07-11 23:53 ` Andrew Morton
2 siblings, 1 reply; 14+ messages in thread
From: Linus Torvalds @ 2007-07-11 23:40 UTC (permalink / raw)
To: Andrew Morton; +Cc: Roland McGrath, Jason Wessel, linux-kernel, linux-arch
On Wed, 11 Jul 2007, Andrew Morton wrote:
>
> OK, thanks. So I ended up with the below as a probably-2.6.23 thing:
> ...
> +AFLAGS += $(call as-option, -gdwarf)
"-gdwarf2?"
Linus
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 23:40 ` Linus Torvalds
@ 2007-07-11 23:53 ` Andrew Morton
2007-07-12 8:23 ` Jan Engelhardt
2007-07-14 1:08 ` Adrian Bunk
0 siblings, 2 replies; 14+ messages in thread
From: Andrew Morton @ 2007-07-11 23:53 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Roland McGrath, Jason Wessel, linux-kernel, linux-arch
On Wed, 11 Jul 2007 16:40:29 -0700 (PDT)
Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
>
> On Wed, 11 Jul 2007, Andrew Morton wrote:
> >
> > OK, thanks. So I ended up with the below as a probably-2.6.23 thing:
> > ...
> > +AFLAGS += $(call as-option, -gdwarf)
>
> "-gdwarf2?"
>
yep, that's what the kgdb tree was using - I'll fix it up.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 23:53 ` Andrew Morton
@ 2007-07-12 8:23 ` Jan Engelhardt
2007-07-14 1:08 ` Adrian Bunk
1 sibling, 0 replies; 14+ messages in thread
From: Jan Engelhardt @ 2007-07-12 8:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Linus Torvalds, Roland McGrath, Jason Wessel, linux-kernel,
linux-arch
On Jul 11 2007 16:53, Andrew Morton wrote:
>On Wed, 11 Jul 2007 16:40:29 -0700 (PDT)
>Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
>> On Wed, 11 Jul 2007, Andrew Morton wrote:
>> >
>> > OK, thanks. So I ended up with the below as a probably-2.6.23 thing:
>> > ...
>> > +AFLAGS += $(call as-option, -gdwarf)
>>
>> "-gdwarf2?"
>>
>
>yep, that's what the kgdb tree was using - I'll fix it up.
I am all for using -ggdb/-ggdb2/-ggdb3 instead.
Jan
--
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO
2007-07-11 23:53 ` Andrew Morton
2007-07-12 8:23 ` Jan Engelhardt
@ 2007-07-14 1:08 ` Adrian Bunk
1 sibling, 0 replies; 14+ messages in thread
From: Adrian Bunk @ 2007-07-14 1:08 UTC (permalink / raw)
To: Andrew Morton
Cc: Linus Torvalds, Roland McGrath, Jason Wessel, linux-kernel,
linux-arch
On Wed, Jul 11, 2007 at 04:53:08PM -0700, Andrew Morton wrote:
> On Wed, 11 Jul 2007 16:40:29 -0700 (PDT)
> Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
> >
> >
> > On Wed, 11 Jul 2007, Andrew Morton wrote:
> > >
> > > OK, thanks. So I ended up with the below as a probably-2.6.23 thing:
> > > ...
> > > +AFLAGS += $(call as-option, -gdwarf)
> >
> > "-gdwarf2?"
> >
>
> yep, that's what the kgdb tree was using - I'll fix it up.
Since even gcc 3.2 already supports -gdwarf-2, you can drop
the as-option check.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2007-07-14 1:09 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-11 18:53 [PATCH] Pass -g to assembler under CONFIG_DEBUG_INFO Roland McGrath
2007-07-11 21:09 ` Andrew Morton
2007-07-11 21:30 ` Roland McGrath
2007-07-11 22:37 ` Jason Wessel
2007-07-11 22:43 ` Roland McGrath
2007-07-11 23:03 ` Andrew Morton
2007-07-11 23:07 ` Roland McGrath
2007-07-11 23:15 ` Andreas Schwab
2007-07-11 23:19 ` Roland McGrath
2007-07-11 23:27 ` Andreas Schwab
2007-07-11 23:40 ` Linus Torvalds
2007-07-11 23:53 ` Andrew Morton
2007-07-12 8:23 ` Jan Engelhardt
2007-07-14 1:08 ` Adrian Bunk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox