From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 338DB3858D34; Sat, 16 May 2020 08:09:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 338DB3858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589616589; bh=z/wzbLaD1lpWzAviGW19DDK73sb1nUVKQ1tBfpnfVto=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CzZQ4STLHoGbOeTpJWFSwnoaoytZkF6oIxP5bLke+T9vYn7J2YIbh50zWDzkM4h4y 9uzuxFwbyQKm4R2bIS8R4RiZQTr9Sb5PKZ+/72trYo4CLHt/QlXzzcHvLgzNOjbp/P 9u/xlv/T+WV0LSstlH+UhN23KTNJSJgoSG048cBI= From: "bernd.edlinger at hotmail dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/94474] Incorrect DWARF range information for inlined function Date: Sat, 16 May 2020 08:09:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 9.2.0 X-Bugzilla-Keywords: wrong-debug X-Bugzilla-Severity: normal X-Bugzilla-Who: bernd.edlinger at hotmail dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2020 08:09:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94474 --- Comment #11 from Bernd Edlinger --- Andrew, (In reply to Andrew Burgess from comment #10) > Further, I've seen no mention of exit views anywhere, and I think they > would also be needed. >=20 Yes, that is also my idea, when I say the dwarf2 spec needs to be fixed. > With the addition of these two features we would be able to support (I > believe) fully merged callers and callees, with lines marked as > is-stmt from both the caller and callee appearing at the same address. >=20 > For now, without this, I think GCC needs to restrict itself when > inlining. When an address represents a line from both the caller and > callee, then that address should only be is-stmt true for EITHER lines > from the caller, or lines from the callee. If the address is is-stmt > true for a line from the caller, then the address should NOT be within > the callee's range(s), and if the address is is-stmt true for a line > from the callee, then the address MUST be within the callee's > range(s). >=20 I tried to do something similar, in my original gcc-patch, which was unfortunately not accepted. But what I learned from writing the patch is that gcc cannot easily tell if a range will be empty or not. That is because the assembler does emit the line info and the views, and the assembler decides how many bytes if any a certain construct will take in the binary representation. That is why this empty range appears, because that was supposed to be the start of the inline function, but instructions from the function prologue were moved in there. What causes the problem is the is-stmt line info which is the only remaining thing from the original plan. But on the other hand, it is not a big issue for gdb to ignore those artefacts, when they rarely occur. My gdb-patch does this, by changing the is-stmt bit of this line info. > On a final note. These are just my personal thoughts from the > perspective of a debug consumer, though I use words like "must" or > "should" above this reflects my thoughts on how I believe the debug > should appear, and is not an attempt to prescribe how GCC should > be. I know there are limitations to what GCC can achieve, and also, I > could be totally wrong in my understanding of DWARF. I'm always happy > to be corrected! Yeah, that is true for myself as well. Ping, Alexandre Oliva, are you still with us? I would be curious to know what you think, about this how should we proceed? Thanks Bernd.=