[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 16:15:22 +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=YQr/41KWdn2hJYPYsmmgn9bYBJrMQ/0y2hDsszhW8Gk=; b=SyeARUEX7QY6PnFIM7KXh8R1riTkX4IX3GBx9sobeEIDQXEQRplH+Z5arSdghBgi7h0Q+6MqBRT38Z3WVVs6LDEB/0HZElVekwoIMtYDnYmcQ6HMqUv6BnLghkecSGeTmKvbAVFKP/bFTeLzN9ZfdJTOnBKb+tPiHUb3PnamZ0k/c9crJ9r1Jl1wF7pLD7Bsa5CJpoilNWbHZrOZa0my5KVwr0iZCoTyr421Mz6Xqah6i4lMdGCAdryNrBkjX3L6D/QUkWtT7GeBcRxW3FQ2vWDI/a5Z469BCjI0aNmHTHiYfJ3k82F7aKKilsG78QMvou2WhS2qjiNMB+lBFhS9/Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cGM00sAB1ltmfqyNeib5KquuzE+GQuiuX1kQhZrhKsl1vaE56x5mdBTn/v8t7b11ohIVfyoH8p3/Dqv/ofTlKKFUt55h/yZ9L8eoTr0Hj2QIelkqoZlFuu3pqnoRfmO2nm1dIH7TCm4H8XhAUX2q3+V4oKvNQbCmrilvjOYe5pq1O+EPvwJeTX9epD35KsBNhhonAb23QeZIdscbpP9am0b2XEySl6aKNYJk1TQhiWY86m4s6E5/j6kxUkH0ywIyESwip5ZT1rZJxXBARWxaVOKRdxuz6O/IsOVhuDsGE4vu6omXHRApil180MynpBNBMMS9beGbQLodia34xZIPgA==
  • 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 14:15:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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).

Jan




 


Rackspace

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