From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29037 invoked by alias); 9 Jul 2009 17:42:46 -0000 Received: (qmail 29015 invoked by uid 22791); 9 Jul 2009 17:42:46 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Jul 2009 17:42:37 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n69HgZoE003238; Thu, 9 Jul 2009 13:42:35 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n69HgYLd024099; Thu, 9 Jul 2009 13:42:35 -0400 Received: from opsy.redhat.com (vpn-225-106.phx2.redhat.com [10.3.225.106]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n69HgXMU030190; Thu, 9 Jul 2009 13:42:34 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 163A33784C4; Thu, 9 Jul 2009 11:42:32 -0600 (MDT) To: Hui Zhu Cc: gdb-patches ml Subject: Re: Add a new modifier /c to "disassemble" command to make it output binary code References: From: Tom Tromey Reply-To: tromey@redhat.com Date: Thu, 09 Jul 2009 19:22:00 -0000 In-Reply-To: (Hui Zhu's message of "Thu\, 9 Jul 2009 14\:35\:54 +0800") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00287.txt.bz2 >>>>> ">" == Hui Zhu writes: >> 2009-07-09 Hui Zhu >> * cli/cli-cmds.c (disassemble_command): Add a new modifier /c >> to "disassemble" command to make it output binary code. >> (init_cli_cmds): Ditto. >> (print_disassembly): Add a new argument "code" to make sure >> output binary code or not. >> (disassemble_current_function): Ditto. >> * mi/mi-cmd-disas.c (mi_cmd_disassemble): Ditto. >> * stack.c (gdb_disassembly_stub): Ditto. >> * disasm.h (gdb_disassembly): Ditto. >> * disasm.c (do_mixed_source_and_assembly): Ditto. >> (do_mixed_source_and_assembly): Ditto. >> (do_assembly_only): Ditto. >> (gdb_disassembly): Ditto. >> (dump_insns): Output the binary code if "code" is true. I think this patch looks good. >> static void >> print_disassembly (struct gdbarch *gdbarch, const char *name, >> - CORE_ADDR low, CORE_ADDR high, int mixed) >> + CORE_ADDR low, CORE_ADDR high, int mixed, int code) I'm slightly more of a fan of the "flags" approach, so that we can easily add more flags later if we want. But it isn't a big deal. >> +With a /c modifier, binary code are included.\n\ I think this would be better as: With a /c modifier, print the instruction in hex as well as in symbolic form. (This is what the objdump documentation says, and I think it is clearer, by virtue of being more explicit.) >> + ui_out_message (uiout, 0, " %02x", (unsigned)data); I wasn't sure about ui_out_message, and reading the internals docs was not really enlightening on the subject. I guess it is probably ok, but if somebody else knows for sure, I'd like to be better informed. I think this also needs a change to NEWS. We mention disassemble/m there, we ought to mention /c as well. Please fix the help text; and after a doc review, if nobody has responded about the ui_out_message thing, I will approve this. Tom