From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 989143858403 for ; Mon, 21 Mar 2022 14:34:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 989143858403 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-261-u_Nzvix9OICNVWf_SzPbhg-1; Mon, 21 Mar 2022 10:33:59 -0400 X-MC-Unique: u_Nzvix9OICNVWf_SzPbhg-1 Received: by mail-wm1-f71.google.com with SMTP id i65-20020a1c3b44000000b00385c3f3defaso4171153wma.3 for ; Mon, 21 Mar 2022 07:33:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xaMvBRzHRK3/yCmsL0qITGwLqcVZNyYC4n1Vezyv1fk=; b=QBzP1QlvXWbrNp3/3G5YjnUy2RyQUIVHagECWl/x+4XGAtefg4BRLuY8AL+uph5ZNL 5XX2V3Pxf2ZsS2az1+Kde8KRnAuJCnVcUaOfDjfve+HKyuRVY3dNpaSwz5vQRBYZDqX2 hX6b9XOr2fRHC4WIITnc1ZphBYq+djb5DdRaMdN19A5e7Ed/FPp3VSm0wZJa7o6FZg+P Wsk/e8yKzGIzbjzY0FAWl3R472od2oRO9Ln2NtgFpJk2z3Ty4x1Op6cHAsu+KXJRMXaE 1Lkq7HV3ml0BZRNJBSdzQsvL4qAgWCYn83LxriL3izbGFZqUTax8eFLEtbD7QACg+doX 6raA== X-Gm-Message-State: AOAM533SBPq8ycRUtjDZbeA2Su3116TvG6/SvTBqwEvN7civO2JBQcMt z1w8tTI5xUw+D56Os/6fIB/zxtnrqpCXvd2YqNTwP4jOWiso76Tt2cbmuMNCFx6lyubqttyDV4E sfxOtpU/YxrbixGZzHY9hPmaLC+JBjBF5UrRdHUHaaOJT7T+6IU4QnKkOWISMV/RRz0kD7Q== X-Received: by 2002:a05:600c:4b83:b0:38c:8b9a:482 with SMTP id e3-20020a05600c4b8300b0038c8b9a0482mr13265782wmp.153.1647873238338; Mon, 21 Mar 2022 07:33:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym8X2e8t8lfvzEI7kAjyU6y9C3//Qb7zo8bHXE6S0Va8D7orJ3XVOJEkAbp4Tw3xQLXuD+aA== X-Received: by 2002:a05:600c:4b83:b0:38c:8b9a:482 with SMTP id e3-20020a05600c4b8300b0038c8b9a0482mr13265764wmp.153.1647873238035; Mon, 21 Mar 2022 07:33:58 -0700 (PDT) Received: from localhost (host109-158-45-15.range109-158.btcentralplus.com. [109.158.45.15]) by smtp.gmail.com with ESMTPSA id g6-20020a5d5406000000b001f049726044sm13408609wrv.79.2022.03.21.07.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 07:33:57 -0700 (PDT) From: Andrew Burgess To: binutils@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 0/3] disassembler syntax highlighting in objdump (via libopcodes) Date: Mon, 21 Mar 2022 14:33:49 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Mon, 21 Mar 2022 14:34:04 -0000 This series is a serious attempt at what I discussed here: https://sourceware.org/pipermail/binutils/2021-December/118806.html This series changes libopcodes so that this disassemblers can supply styling information with every piece of disassembly output, e.g. is this a register? an address? a mnemonic? etc. Users of the disassembler can then choose to make use of this information to add styling to the disassembler output. And that is what I do for objdump in this series. The styling is off by default, but can be turned on with a new command line flag: --disassembler-color=off|color|extended-color I've updated GDB enough to keep it building and running after this change, though at this point GDB doesn't make use of the new styling information, that will come later. All feedback would be welcome. Changes since v1: - After discussion with Jan I've now added additional disassembler styles (see enum disassembler_style in includes/dis-asm.h), - I've updated the riscv-dis.c and i386-dis.c to make use of these new styles, and fixed a few places (mostly in riscv-dis.c) where the wrong style was being used, - I've gone through my changes in riscv-dis.c and i386-dis.c and made sure that lines are all under 80 characters, - I've extended binutils/objdump.c to handle the new styles. For now I've not given these styles separate colours, but used existing grouping similar styles together, e.g. anything that is a number (immediate, address, address offset) all gets the same colour. - The crash that Nelson reported from riscv-dis.c is fixed. Andrew Burgess (3): objdump/opcodes: add syntax highlighting to disassembler output opcodes/riscv: implement style support in the disassembler opcodes/i386: partially implement disassembler style support binutils/NEWS | 4 + binutils/doc/binutils.texi | 11 ++ binutils/objdump.c | 249 ++++++++++++++++++++++++++++++++----- gdb/disasm.c | 34 ++++- gdb/disasm.h | 7 ++ include/dis-asm.h | 88 ++++++++++++- opcodes/dis-init.c | 5 +- opcodes/disassemble.c | 23 +++- opcodes/i386-dis.c | 63 ++++++---- opcodes/riscv-dis.c | 193 +++++++++++++++++----------- 10 files changed, 541 insertions(+), 136 deletions(-) -- 2.25.4