From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10210 invoked by alias); 29 Dec 2004 18:32:42 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 10166 invoked from network); 29 Dec 2004 18:32:35 -0000 Received: from unknown (HELO rwcrmhc11.comcast.net) (204.127.198.35) by sourceware.org with SMTP; 29 Dec 2004 18:32:35 -0000 Received: from [10.69.69.128] (c-67-169-96-182.client.comcast.net[67.169.96.182]) by comcast.net (rwcrmhc11) with SMTP id <2004122918323401300cdljke>; Wed, 29 Dec 2004 18:32:35 +0000 In-Reply-To: <16850.33143.199264.751617@napali.hpl.hp.com> References: <16850.33143.199264.751617@napali.hpl.hp.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-2--663522734; protocol="application/pkcs7-signature" Message-Id: <2478F3AA-59C8-11D9-937B-000A95B1F520@geoffk.org> Cc: binutils@sources.redhat.com, davidm@napali.hpl.hp.com From: Geoff Keating Subject: Re: curious check in dwarf2_gen_line_info() Date: Wed, 29 Dec 2004 18:32:00 -0000 To: davidm@hpl.hp.com X-SW-Source: 2004-12/txt/msg00335.txt.bz2 --Apple-Mail-2--663522734 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 2752 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 > * 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. --Apple-Mail-2--663522734 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s Content-length: 3270 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEH AQAAoIIGRTCCAv4wggJnoAMCAQICAwyqbjANBgkqhkiG9w0BAQQFADBiMQsw CQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkg THRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3Vp bmcgQ0EwHhcNMDQwNzEyMDAxMzAyWhcNMDUwNzEyMDAxMzAyWjByMRAwDgYD VQQEEwdLZWF0aW5nMRkwFwYDVQQqExBHZW9mZnJleS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