[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] x86: improve .debug_line contents for assembly sources


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 14 Apr 2022 18:34:28 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SJwdD5Tu+8YeA7HZ1XQVAi4DVCliaFUyUb0bIoJhaHs=; b=HGFrkKxkheCHlr4fJDbuW5+IJXXMNqr/gNvI7zA0mBfFBzBoQOudhzXD72yXvIk7L6IFw/giZpWdIe+WjTXdaX1bHOj4b5hr2riM7JQ9fwZBfa3f6JkYjJ7qPzN1BYjs8Ol8bxazuBbuDh6fL3ZQmm9RH5cEpFG6GWhR2cjQvZkNpzkaYpfz62DtGak3154qBlefdTYqaOAuJ2jWc4XdVuvM7ev4x4enxGie/DMqatzyWlSu9vk4kA3PhZFXZbF7oWe0hp7zjHUf9Itmu5sZRrAaZx8lQ5joy1iI9N7hS8mBe6nBROeaJj2HQxXOpt+ZyGzXEKUPVMXVsc0ieKGPhg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XoBlh6MW1XHft1ebhetNR1kFIjMFhkjvrYgAdyd6bFi5vJ0dJToxR1TLoZKY8sGfraeTU4D9cC/OGjbfnpLG5nnGqq73fQOWQlWW/oZucJlDaIOgCJdJNhj05MHC5T1xV6TYMGwpw56TFgaCHZscbBZp67j9mCLVJZKs/DZulgTTuI9AfmNvF5BL9tcaoyPexi5ZH/DpiP0OlmYA3tLYgRRjOFP+U4on20RGrE1DBss30gK1G5gd1xyv6zQJZUTLO5BgHXduyDFTt4ue6N/cVDRv5Czd87pojoMrfd71bQq1xofdLeKu8BVDOhOospxhXqNCWVtdhFm85q00zqWvYA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 14 Apr 2022 16:34:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.04.2022 18:02, Roger Pau Monné wrote:
> On Thu, Apr 14, 2022 at 04:15:22PM +0200, Jan Beulich wrote:
>> On 14.04.2022 15:31, Roger Pau Monné wrote:
>>> On Thu, Apr 14, 2022 at 02:52:47PM +0200, Jan Beulich wrote:
>>>> On 14.04.2022 14:40, Roger Pau Monné wrote:
>>>>> On Tue, Apr 12, 2022 at 12:27:34PM +0200, Jan Beulich wrote:
>>>>>> While future gas versions will allow line number information to be
>>>>>> generated for all instances of .irp and alike [1][2], the same isn't
>>>>>> true (nor immediately intended) for .macro [3]. Hence macros, when they
>>>>>> do more than just invoke another macro or issue an individual insn, want
>>>>>> to have .line directives (in header files also .file ones) in place.
>>>>>>
>>>>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>>>>>
>>>>>> [1] 
>>>>>> https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=7992631e8c0b0e711fbaba991348ef6f6e583725
>>>>>> [2] 
>>>>>> https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=2ee1792bec225ea19c71095cee5a3a9ae6df7c59
>>>>>> [3] 
>>>>>> https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=6d1ace6861e999361b30d1bc27459ab8094e0d4a
>>>>>> ---
>>>>>> Using .file has the perhaps undesirable side effect of generating a fair
>>>>>> amount of (all identical) STT_FILE entries in the symbol table. We also
>>>>>> can't use the supposedly assembler-internal (and hence undocumented)
>>>>>> .appfile anymore, as it was removed [4]. Note that .linefile (also
>>>>>> internal/undocumented) as well as the "# <line> <file>" constructs the
>>>>>> compiler emits, leading to .linefile insertion by the assembler, aren't
>>>>>> of use anyway as these are processed and purged when processing .macro
>>>>>> [3].
>>>>>>
>>>>>> [4] 
>>>>>> https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=c39e89c3aaa3a6790f85e80f2da5022bc4bce38b
>>>>>>
>>>>>> --- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
>>>>>> +++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
>>>>>> @@ -24,6 +24,8 @@
>>>>>>  #include <asm/msr-index.h>
>>>>>>  #include <asm/spec_ctrl.h>
>>>>>>  
>>>>>> +#define FILE_AND_LINE .file __FILE__; .line __LINE__
>>>>>
>>>>> Seeing as this seems to get added to all macros below, I guess you did
>>>>> consider (and discarded) introducing a preprocessor macro do to the
>>>>> asm macro definitons:
>>>>>
>>>>> #define DECLARE_MACRO(n, ...) \
>>>>> .macro n __VA_ARGS__ \
>>>>>     .file __FILE__; .line __LINE__
>>>>
>>>> No, I didn't even consider that. I view such as too obfuscating - there's
>>>> then e.g. no visual match with the .endm. Furthermore, as outlined in the
>>>> description, I don't think this wants applying uniformly. There are
>>>> macros which better don't have this added. Yet I also would prefer to not
>>>> end up with a mix of .macro and DECLARE_MACRO().
>>>
>>> I think it's a dummy question, but why would we want to add this to
>>> some macros?
>>>
>>> Isn't it better to always have the file and line reference where the
>>> macro gets used?
>>
>> Like said in the description, a macro simply invoking another macro,
>> or a macro simply wrapping a single insn, is likely better to have
>> its generated code associated with the original line number. Complex
>> macros, otoh, are imo often better to have line numbers associated
>> with actual macro contents. IOW to some degree I support the cited
>> workaround in binutils (which has been there for many years).
> 
> Seems a bit ad-hoc policy, but it's you and Andrew that mostly deal
> with this stuff, so if you are fine with it.

What other rule of thumb would you suggest? I'd be happy to take
suggestions rather than force in something which looks to be not
entirely uncontroversial.

> Acked-by: roger Pau Monné <roger.pau@xxxxxxxxxx>

Thanks. Given the above, I guess I'll apply this only provisionally.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.