* curious check in dwarf2_gen_line_info()
@ 2004-12-29 10:00 David Mosberger
0 siblings, 0 replies; 7+ messages in thread
From: David Mosberger @ 2004-12-29 10:00 UTC (permalink / raw)
To: geoffk; +Cc: binutils
In dwarf2dbg.c:dwarf2_gen_line_info(), one finds this curious code and
comment:
/* Don't emit sequences of line symbols for the same line when the
symbols apply to assembler code. It is necessary to emit
duplicate line symbols when a compiler asks for them, because GDB
uses them to determine the end of the prologue. */
if (debug_type == DEBUG_DWARF2
&& line == loc->line && filenum == loc->filenum)
return;
The "debug_type == DEBUG_DWARF2" checks has the effect that for
compiler-generated files, the line info is replicated for each
instruction, even when that info doesn't change at all.
The change seems to have been introduced back in 2002:
2002-04-17 Geoffrey Keating <geoffk@redhat.com>
* dwarf2dbg.c (dwarf2_gen_line_info): Do emit duplicate line
numbers, gdb relies on them to detect the start of the prologue.
but there is no hint on which platform needed this workaround.
I looked at gdb's symtab.c:skip_prologue_using_sal() and as near as I
can tell, that doesn't rely on having duplicate line-info.
To evaluate the size impact of the line-info duplication, I compiled a
fairly large Linux kernel file (sched.c). For that file, the
.debug_line size changed as follows:
original gas: 0x3b93 (+46%)
fixed gas: 0x28cd
So the workaround bloats the .debug_line section by almost 50%.
Is there a platform which really needs this workaround? If so,
perhaps the workaround could be enabled for that platform only?
Thanks,
--david
^ permalink raw reply [flat|nested] 7+ messages in thread
* curious check in dwarf2_gen_line_info()
@ 2004-12-29 10:02 David Mosberger
0 siblings, 0 replies; 7+ messages in thread
From: David Mosberger @ 2004-12-29 10:02 UTC (permalink / raw)
To: geoffk; +Cc: binutils, davidm
[Resend with Geoff's email-address corrected; I hope...]
In dwarf2dbg.c:dwarf2_gen_line_info(), one finds this curious code and
comment:
/* Don't emit sequences of line symbols for the same line when the
symbols apply to assembler code. It is necessary to emit
duplicate line symbols when a compiler asks for them, because GDB
uses them to determine the end of the prologue. */
if (debug_type == DEBUG_DWARF2
&& line == loc->line && filenum == loc->filenum)
return;
The "debug_type == DEBUG_DWARF2" checks has the effect that for
compiler-generated files, the line info is replicated for each
instruction, even when that info doesn't change at all.
The change seems to have been introduced back in 2002:
2002-04-17 Geoffrey Keating <geoffk@redhat.com>
* dwarf2dbg.c (dwarf2_gen_line_info): Do emit duplicate line
numbers, gdb relies on them to detect the start of the prologue.
but there is no hint on which platform needed this workaround.
I looked at gdb's symtab.c:skip_prologue_using_sal() and as near as I
can tell, that doesn't rely on having duplicate line-info.
To evaluate the size impact of the line-info duplication, I compiled a
fairly large Linux kernel file (sched.c). For that file, the
.debug_line size changed as follows:
original gas: 0x3b93 (+46%)
fixed gas: 0x28cd
So the workaround bloats the .debug_line section by almost 50%.
Is there a platform which really needs this workaround? If so,
perhaps the workaround could be enabled for that platform only?
Thanks,
--david
^ permalink raw reply [flat|nested] 7+ messages in thread
* curious check in dwarf2_gen_line_info()
@ 2004-12-29 10:06 David Mosberger
2004-12-29 18:32 ` Geoff Keating
0 siblings, 1 reply; 7+ messages in thread
From: David Mosberger @ 2004-12-29 10:06 UTC (permalink / raw)
To: geoffk; +Cc: binutils, davidm
[Resend^2: I mistakenly typed .com instead of .org for his domain... ;-( ]
In dwarf2dbg.c:dwarf2_gen_line_info(), one finds this curious code and
comment:
/* Don't emit sequences of line symbols for the same line when the
symbols apply to assembler code. It is necessary to emit
duplicate line symbols when a compiler asks for them, because GDB
uses them to determine the end of the prologue. */
if (debug_type == DEBUG_DWARF2
&& line == loc->line && filenum == loc->filenum)
return;
The "debug_type == DEBUG_DWARF2" checks has the effect that for
compiler-generated files, the line info is replicated for each
instruction, even when that info doesn't change at all.
The change seems to have been introduced back in 2002:
2002-04-17 Geoffrey Keating <geoffk@redhat.com>
* dwarf2dbg.c (dwarf2_gen_line_info): Do emit duplicate line
numbers, gdb relies on them to detect the start of the prologue.
but there is no hint on which platform needed this workaround.
I looked at gdb's symtab.c:skip_prologue_using_sal() and as near as I
can tell, that doesn't rely on having duplicate line-info.
To evaluate the size impact of the line-info duplication, I compiled a
fairly large Linux kernel file (sched.c). For that file, the
.debug_line size changed as follows:
original gas: 0x3b93 (+46%)
fixed gas: 0x28cd
So the workaround bloats the .debug_line section by almost 50%.
Is there a platform which really needs this workaround? If so,
perhaps the workaround could be enabled for that platform only?
Thanks,
--david
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: curious check in dwarf2_gen_line_info()
2004-12-29 10:06 David Mosberger
@ 2004-12-29 18:32 ` Geoff Keating
2004-12-29 18:51 ` David Mosberger
0 siblings, 1 reply; 7+ messages in thread
From: Geoff Keating @ 2004-12-29 18:32 UTC (permalink / raw)
To: davidm; +Cc: binutils, davidm
[-- Attachment #1: Type: text/plain, Size: 2752 bytes --]
On 29/12/2004, at 2:05 AM, David Mosberger wrote:
> [Resend^2: I mistakenly typed .com instead of .org for his domain...
> ;-( ]
>
> In dwarf2dbg.c:dwarf2_gen_line_info(), one finds this curious code and
> comment:
>
> /* Don't emit sequences of line symbols for the same line when the
> symbols apply to assembler code. It is necessary to emit
> duplicate line symbols when a compiler asks for them, because GDB
> uses them to determine the end of the prologue. */
> if (debug_type == DEBUG_DWARF2
> && line == loc->line && filenum == loc->filenum)
> return;
>
> The "debug_type == DEBUG_DWARF2" checks has the effect that for
> compiler-generated files, the line info is replicated for each
> instruction, even when that info doesn't change at all.
>
> The change seems to have been introduced back in 2002:
>
> 2002-04-17 Geoffrey Keating <geoffk@redhat.com>
> * dwarf2dbg.c (dwarf2_gen_line_info): Do emit duplicate line
> numbers, gdb relies on them to detect the start of the
> prologue.
>
> but there is no hint on which platform needed this workaround.
My understanding is that it was needed on all platforms. It's used
when the user writes
break foo
in GDB, to break after foo's prologue, rather than on its first
instruction. As I wrote in 2002,
> GDB uses duplicate line numbers to detect the end of the prologue.
> GCC would carefully emit them... and gas was stripping them out.
>
> I don't believe this patch will significantly affect the size of the
> debug info for assembler source, because having multiple instructions
> on a line is rare.
>
> I tested this by running the GAS and GDB testsuites on
> powerpc-eabisim.
[the patch was later revised to not apply to assembler source.]
Maybe the GDB people have implemented some other technique for this, in
which case it could go away. Running the GDB testsuite should show the
problem. (Actually, IMO, the whole thing is wrong; GDB really should
be breaking on the first instruction. The problem with that is that
GCC+GDB isn't smart enough to permit the user to print the contents of
incoming arguments at a breakpoint on the first instruction of a
routine, it needs the prologue to be executed. It would be very cool
to fix that.)
This is not a change that should be first made in the assembler.
Instead of having the compiler emit duplicates and have the assembler
remove them, the compiler should be changed to not emit duplicates in
the first place if they are no longer needed.
The overhead of the duplicates should not be very significant (compared
to the information that is required), because the compiler should
already be suppressing duplicate line information except where it is
needed.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2410 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: curious check in dwarf2_gen_line_info()
2004-12-29 18:32 ` Geoff Keating
@ 2004-12-29 18:51 ` David Mosberger
2004-12-29 19:01 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: David Mosberger @ 2004-12-29 18:51 UTC (permalink / raw)
To: Geoff Keating; +Cc: davidm, binutils, davidm
>>>>> On Wed, 29 Dec 2004 10:33:32 -0800, Geoff Keating <geoffk@geoffk.org> said:
Geoff> The overhead of the duplicates should not be very significant
Geoff> (compared to the information that is required), because the
Geoff> compiler should already be suppressing duplicate line
Geoff> information except where it is needed.
Ah, there are multiple issues here: you're assuming that
dwarf2_gen_line_info() is only called once per loc-directive, but this
isn't true for tc-ia64.c, which calls dwarf2_gen_line_info() for each
instruction, no matter what.
I'll check gdb to see if it gets any new failures on ia64 with the
duplicate line info removed.
--david
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: curious check in dwarf2_gen_line_info()
2004-12-29 18:51 ` David Mosberger
@ 2004-12-29 19:01 ` Daniel Jacobowitz
2004-12-31 2:16 ` David Mosberger
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-12-29 19:01 UTC (permalink / raw)
To: davidm; +Cc: Geoff Keating, binutils, davidm
On Wed, Dec 29, 2004 at 10:50:55AM -0800, David Mosberger wrote:
> >>>>> On Wed, 29 Dec 2004 10:33:32 -0800, Geoff Keating <geoffk@geoffk.org> said:
>
> Geoff> The overhead of the duplicates should not be very significant
> Geoff> (compared to the information that is required), because the
> Geoff> compiler should already be suppressing duplicate line
> Geoff> information except where it is needed.
>
> Ah, there are multiple issues here: you're assuming that
> dwarf2_gen_line_info() is only called once per loc-directive, but this
> isn't true for tc-ia64.c, which calls dwarf2_gen_line_info() for each
> instruction, no matter what.
>
> I'll check gdb to see if it gets any new failures on ia64 with the
> duplicate line info removed.
It almost certainly will. The issue hasn't been fixed; Geoff described
the problems pretty accurately.
[For dwarf2 we should be emitting explicit prologue end markers, and
THEN the hack could go away. But that's a whole other story.]
--
Daniel Jacobowitz
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: curious check in dwarf2_gen_line_info()
2004-12-29 19:01 ` Daniel Jacobowitz
@ 2004-12-31 2:16 ` David Mosberger
0 siblings, 0 replies; 7+ messages in thread
From: David Mosberger @ 2004-12-31 2:16 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: davidm, Geoff Keating, binutils, davidm
>>>>> On Wed, 29 Dec 2004 14:01:31 -0500, Daniel Jacobowitz <drow@false.org> said:
>> I'll check gdb to see if it gets any new failures on ia64 with
>> the duplicate line info removed.
Daniel> It almost certainly will.
Yes, it does: the problematic case occurs when a function has the
first statement in the same line as the function name.
I see that tc-xtensa.c has worked around this same issue in a local
fashion, so I created an analogous fix for tc-ia64.c. See bugzilla
report 628 for details:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=628
If the patch looks OK, I'd appreciate it if someone could check it in.
--david
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-12-31 2:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-29 10:00 curious check in dwarf2_gen_line_info() David Mosberger
2004-12-29 10:02 David Mosberger
2004-12-29 10:06 David Mosberger
2004-12-29 18:32 ` Geoff Keating
2004-12-29 18:51 ` David Mosberger
2004-12-29 19:01 ` Daniel Jacobowitz
2004-12-31 2:16 ` David Mosberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).