From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by sourceware.org (Postfix) with ESMTPS id D19A13856DF4 for ; Wed, 1 Jun 2022 05:59:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D19A13856DF4 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2108.outbound.protection.outlook.com [104.47.17.108]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-28-gw4iJVZJNouUkZ9O-ciE0A-1; Wed, 01 Jun 2022 07:59:43 +0200 X-MC-Unique: gw4iJVZJNouUkZ9O-ciE0A-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C3A0dGm1BJGq3mbcMLeEJfxizY8esSo0BXsbuIbil7xpPQU+HHuSR4dtwOtB61Kwx/htt9EG5sP92j1j06qn9VGxhgQjmRG6OAHRnbqbfy9FS/87pN+vpT/x1AJWmw8IIp34tNIwm1mFK5/W4A+JKwl3gT2yPFXUhwoIT4kanFh2G07q/40FkIgeGaxEOlrA38rHmsW0ZoGw/VpjlaIroCLpl7gKWWaDa5/0GbCBb047RFIbjw1FXd+xFg1nyI57vAJSuZeNryMEwQGFqNc4nXvDMtcqNxOC6kbtT3qcxQhw0/xSdawSWkpP4Ji6uBsgI+lUNqE4H8HBa2/Y/Xu2VA== 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=gqCtmaWkxjKCrp4AGj1r0JPZQ1vsRJ5wkmSBfLsOyRg=; b=RyTNh+pnWJUmgOBpRk0VNxQqPrlXzDWzF1LVB19fkkPiYRCUOfQ0W4XHBaTNwSYdLZth6u0uiVksEKGA23YBjMW3Z+gHO/MBNhZNTdqrMLloY1XivUqR3l4WJXwKvDM3/7/wtSpTc+Sf8+Ox+g9Ic6hjjjm2eibqSn7NnbKBejUF1hL/XHhqs9esOMrXyyUUmmkELz7tP85JIvhHo7E4tyII+GatLOLRGeJIZEACYaT37Jv0zSgM+RyNZ6Fk8Rdbnd4ksV1saEmQPvj7asjdafhm0oPVHa96MqqU/RBUzqbUlSvtL8/l3ZuL9rPxuViepAUH/hdNs7LKr6vPtMLNkA== 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 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AM6PR04MB4424.eurprd04.prod.outlook.com (2603:10a6:20b:1e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Wed, 1 Jun 2022 05:59:39 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b%7]) with mapi id 15.20.5314.012; Wed, 1 Jun 2022 05:59:39 +0000 Message-ID: Date: Wed, 1 Jun 2022 07:59:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCHv3] libopcodes: extend the styling within the i386 disassembler Content-Language: en-US To: Andrew Burgess Cc: binutils@sourceware.org, "H.J. Lu" References: <20220509125414.3526554-1-aburgess@redhat.com> <20220527174443.223739-1-aburgess@redhat.com> <87bkvdd3g1.fsf@redhat.com> From: Jan Beulich In-Reply-To: <87bkvdd3g1.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AM6PR0202CA0041.eurprd02.prod.outlook.com (2603:10a6:20b:3a::18) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2a98d27e-775a-4757-e5d9-08da4393e9e8 X-MS-TrafficTypeDiagnostic: AM6PR04MB4424:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C81+6G38Mil8DJ7BCVXlJeQe1rvnHvjSxhoPN1uc8N04pFFgGf7t4SBL4RB1QM/FRs9vKbsH9JDSl7uCXvqJzMnTx2mrRJ6UG8KSiqfuylKayFVmJn7Zh8b9pd1c6Og1907bjUWJW84MNswGZZmL1n0PxWJ60XebOb3+38HYhFIb/6Ocx3SWYO2CCHBjnBaXkpa6cyPkgpoUI3CxUp53nWlX/8ehooJs6+bGuaLoVZEFrqaws8e/NS0hhjbmX/ksOv2xAIlhr2uJDoPexIhhnKmKBk2bS+PolNRowE5GvINUI7YgOIWnrHJWYMvD7w5hBlAXtfuIOY9i7jSn4OXvRBVFoEnjh5lsvgTtxqcuAehlGB0c8mK1vNTjpiBwrMBUqB7u8SNYvT9Dyjp+Ol+x7fWqYm1Op75/Ag/1FITvCRB3lPZozE3bftVBWDzXVSwFFTpTRQnM07Zl35lBl5oAbdI+8NeWAyDqwUfdWAOEjCi8Wum/RVCcJZ+EjnIE5iZC3HayELhl9SVYLWRDo1LIGoCm+BsyMwVCVSngnbbi03zQyhO779IFDrnRaZJRirf0LkzfLI8XLjz8evobQn3Rmb/bgpotylPzEENEecJK/uTpL+j9OsSBcnVvQtN7qzMkgf4i8yOR8IAG9GiRNaBetUXfp//KciUAgRIYSTNrj52/JpfzIK2z641BYuKtdGcYHH/JI5d/OpCWsKtmjpobkIY8eVw6TsKKDCJr3ojzzIA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(2906002)(31696002)(86362001)(6666004)(8936002)(186003)(38100700002)(508600001)(5660300002)(6486002)(2616005)(53546011)(6506007)(6512007)(26005)(31686004)(66946007)(66556008)(66476007)(4326008)(8676002)(36756003)(316002)(6916009)(83380400001)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eEpPcUw5VGRoeTNCRnpscDJWTjJmUnRvS3paQUhFWU9vcjIxRnEranBLWStw?= =?utf-8?B?RlRRUFNUYmx4aGI4UmEvMW9NempMR0Y3bVp0cGljSzRkZ01MR1NVT1JMUGdB?= =?utf-8?B?d3RsWFg4NHgyVmhFZWxCcXcvWDdpR000aWhLVGF3L1EvSWI2RGQ3M1QvWjJB?= =?utf-8?B?OFhxbFRTRGp5NTZBdFJ0dU43aXF4RzNRYW5PZkVMR0VYQ0VmS1lyT3FiMzlq?= =?utf-8?B?aVlQWkVUcXZFK0QxOS9aY1l4OTlhUnB0UHNzUmM5ZVYxUnIzY1hKTXltdk5B?= =?utf-8?B?QzBJb0dYakJmNDkrdlZ6YmM0S0s4ZXNFRGUwSXAwalphNzExNU00V2h0d0M5?= =?utf-8?B?K1lkWEpOZnlzTFFpc0FIT2xYN3dXeFo2NW9xWFUwbzBTQnNWSEpZM1RsK3Bu?= =?utf-8?B?cDkxalhJeTM1WjM2TzlBZDBXZmlJUmVUMXYrSnA2S1dZaHhVb1ZuOG1POWlx?= =?utf-8?B?WERwQ3NFYjZaeDU2Nk94MHo4YjV1NWNCd3pvU25wSzVtY2ZTRGg3VFRwcERj?= =?utf-8?B?VDh3YjhVdzM4ZmJ5cForN0FBUkZSb0hQMCtFeHNzU0o0TkVhRUh3N21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: 2a98d27e-775a-4757-e5d9-08da4393e9e8 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 05:59:39.1204 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8I6Lla5RePvJsYr/tsEN07VMNcu6yar4e3xNBAO4/Kbdn5EDdalb09aMXhP1hxtRXA0e9neAfhFqBWHKcSwCwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4424 X-Spam-Status: No, score=-3032.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2022 05:59:48 -0000 On 31.05.2022 19:20, Andrew Burgess wrote: > Jan Beulich via Binutils writes: >> On 27.05.2022 19:44, Andrew Burgess via Binutils wrote: >>> @@ -9299,11 +9304,117 @@ get_sib (instr_info *ins, int sizeflag) >>> } >>> >>> /* Like oappend (below), but S is a string starting with '%'. >>> - In Intel syntax, the '%' is elided. */ >>> + In Intel syntax, the '%' is elided. STYLE is used when displaying this >>> + part of the output in the disassembler. >> >> As you're touching this comment anyway, can you add reference to >> '$'? > > Done. > >> Or alternatively (that's what I was envisioning with the >> comment on v2) drop this function altogether, doing what it does >> separately in oappend_register() and oappend_immediate()? > > I didn't do this (though I will if you insist), I'd just prefer to keep > the "magic" for how we handle the intel syntax (character skipping) in a > single place. I won't insist; I may do this subsequently though in a follow-on patch. >>> @@ -9404,8 +9515,7 @@ print_insn (bfd_vma pc, instr_info *ins) >>> >>> if (ins->address_mode == mode_64bit && sizeof (bfd_vma) < 8) >>> { >>> - (*ins->info->fprintf_styled_func) (ins->info->stream, dis_style_text, >>> - _("64-bit address is disabled")); >>> + i386_dis_printf (ins, dis_style_text, _("64-bit address is disabled")); >> >> Just wondering: Couldn't there be an "error" style? > > I've avoided an error style because I don't think the disassembler > _should_ be emitting errors like this. > > I'll go so far as to say that I consider this case a bug in the i386 > disassembler. > > IMHO, if we pass some content to the disassembler then it should > disassemble it to something, that might just be .word or .byte > directives rather than real instructions, but we should disassemble to > something. > > In the above, isn't the "error" really just a reflection that the > disassembler has been written using bfd_vma in places where either > uint64_t or int64_t would have been a better choice? > > If we did decide that the assembler should be able to handle errors > other than memory errors, I think the correct solution would be to > either add (yet) another callback which is like the memory error > callback, but for different errors. Or, modify the existing error > callback to handle different types of error maybe.... > > ... anyway, I don't think we should do that, but I don't think we should > add an error style either as I feel it will just encourage bad behaviour > when writing the disassemblers. That's certainly a fair view to have, albeit I'm not sure I fully share it. In some cases I consider it more helpful for the disassembler to at least provide a hint at what's wrong in a given encoding. > Patch below includes the updates you asked for above. Thanks, lgtm. It'll want to be H.J. though to approve of this going in. Jan