From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) by sourceware.org (Postfix) with ESMTPS id AF4C63858D20 for ; Thu, 17 Feb 2022 03:57:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF4C63858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-ua1-x935.google.com with SMTP id v5so2077497uam.3 for ; Wed, 16 Feb 2022 19:57:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ii5kr3d8J/1u2lqDR0xI8dRmEqkq/+0sc6zkIWmTyLo=; b=BRKI5gXLvN0JKGIzFzQT4RTovxcHeFiPUhI6TUTytz2X+lLJYqIS85dLhxhLbr/aPK pnJcOXq40rIYdFYod8JcANQRZ7S72RIYhyCi5/dzVgqzvwSsLZFwb5DODXntuxrCiA2d F2b3jaMEqL/PQNaEXeym0+WSvvaj/JtuMj+sRjn/+V1H2YNWBktzN0sy9C88eEtTqeSm 8rSdQBb42JA5ZF1Hcn3Tl4S2HsE1mRWt5mBeJSM8XkZiHbeGV4ZS6oWQwF0w2Lcvc9Xf /KEkzlqq6BinMf0L6+z0CNoDB7Ymf75J4F5U8ClvkRS5tWBUxj9G9lsJv2T4tKl7+Z96 3DcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ii5kr3d8J/1u2lqDR0xI8dRmEqkq/+0sc6zkIWmTyLo=; b=x2QLDBOvu2qmtQRDilnz+QiXuknHf9WI19cbWYD+GZc8k+x8dFfq/4U0UIZEqlQpIn 3wAuUv4tBVEU9EZQyq5OsR+lI5OrCOXzPIrvq6BnfF667Bz0AsTfEQKobxaRIc2PgkPl /zZuKa3TeoCb+nLcZnGGoioqnQj6avloJZFuxClLvth1EWL5+agGfsCt+YPSQCK8Tmha rQ2UBh/bN3lqEq9BBh/MHsYl4n9BgCIs5nDiAaoUE/yx7ua/WFoEnRijWDDAPZptHenj TTUIwRmO+Y5qPcAQzZRt9TYNJFal3ojfQQnPZoOe8pD+P0nbYZBDVsBIknBFKh6D+fCm 6BcA== X-Gm-Message-State: AOAM530pmDPNI43t+k0mLk9q0V9uYEqjW5BsoIv7N2/KowE8zM5a22ID n8hNYnbA3nxQHt76PvATL2HdQtR714w96P66uol1cg== X-Google-Smtp-Source: ABdhPJyUVBpcYVelyx4jqzF8cD2pLECiCWb2TixpsIp7WDNLgxrkhyTj7GDSgGbjsHFBhFSDou0NeUOkrcJMavjLZd8= X-Received: by 2002:ab0:280f:0:b0:33c:ead3:23d7 with SMTP id w15-20020ab0280f000000b0033cead323d7mr382876uap.50.1645070263961; Wed, 16 Feb 2022 19:57:43 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Nelson Chu Date: Thu, 17 Feb 2022 11:57:34 +0800 Message-ID: Subject: Re: [PATCH 0/3] disassembler syntax highlighting in objdump (via libopcodes) To: Andrew Burgess Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Thu, 17 Feb 2022 03:57:46 -0000 Hi Andrew, I get gas/testsuite/gas/riscv/insn testcase fail after applying the series of patches. Here is the reduced case, $ cat tmp.s .word 0x68c58543 fmadd.s fa0,fa1,fa2,fa3,rne .insn r MADD, 0, 0, a0, a1, a2, a3 .insn 0x68c58543 All these are the same instruction encoding - fmadd.s, but the first ".word" will be marked and dumped as data rather than instruction. We are used to get the following dump result, $ /scratch/nelsonc/build-upstream/rv64gc-elf/build-install/bin/riscv64-unknown-elf-objdump -d tmp.o 0000000000000000 <.text>: 0: 68c58543 .word 0x68c58543 4: 68c58543 fmadd.s fa0,fa1,fa2,fa3,rne 8: 68c58543 fmadd.s fa0,fa1,fa2,fa3,rne c: 68c58543 fmadd.s fa0,fa1,fa2,fa3,rne But now with the patches, I will get segmentation fault when trying to dump fmadd.s as instruction, $ /scratch/nelsonc/build-upstream/rv64gc-elf/build-install/bin/riscv64-unknown-elf-objdump -d tmp.o 0000000000000000 <.text>: 0: 68c58543 .word 0x68c58543 Segmentation fault (core dumped) Is it possible if you could help to see what happened? Thanks! Nelson On Thu, Feb 17, 2022 at 4:53 AM Andrew Burgess via Binutils wrote: > > 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. > > Thanks, > Andrew > > --- > > 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 | 245 ++++++++++++++++++++++++++++++++----- > gdb/disasm.c | 34 ++++- > gdb/disasm.h | 7 ++ > include/dis-asm.h | 62 +++++++++- > opcodes/dis-init.c | 5 +- > opcodes/disassemble.c | 23 +++- > opcodes/i386-dis.c | 71 +++++++---- > opcodes/riscv-dis.c | 147 +++++++++++----------- > 10 files changed, 475 insertions(+), 134 deletions(-) > > -- > 2.25.4 >