From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24558 invoked by alias); 9 Aug 2011 16:33:15 -0000 Received: (qmail 24538 invoked by uid 22791); 9 Aug 2011 16:33:14 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yw0-f41.google.com (HELO mail-yw0-f41.google.com) (209.85.213.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Aug 2011 16:33:00 +0000 Received: by ywa6 with SMTP id 6so142832ywa.0 for ; Tue, 09 Aug 2011 09:32:59 -0700 (PDT) Received: by 10.42.153.198 with SMTP id n6mr6458419icw.311.1312907579207; Tue, 09 Aug 2011 09:32:59 -0700 (PDT) Received: from [10.172.73.11] (24-205-77-12.dhcp.psdn.ca.charter.com [24.205.77.12]) by mx.google.com with ESMTPS id h6sm105766icy.1.2011.08.09.09.32.57 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Aug 2011 09:32:58 -0700 (PDT) Message-Id: <1C4F1715-8FC9-4BC5-90C0-6766791FF8AB@newplanetsoftware.com> From: John Lindal To: gdb-patches@sourceware.org In-Reply-To: Content-Type: multipart/mixed; boundary=Apple-Mail-20--407073333 Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: Allow -data-disassemble to run with only -s option Date: Tue, 09 Aug 2011 16:33:00 -0000 References: <587BFD3C-0540-49FA-87F9-89CBBF2FF010@newplanetsoftware.com> <3DBE6912-1DE6-4B8B-8353-96855B07268E@newplanetsoftware.com> 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: 2011-08/txt/msg00203.txt.bz2 --Apple-Mail-20--407073333 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Content-length: 179 > What Tom meant is that you should write a testcase for it. See the > directory gdb/testsuite for examples. Attached are the updated patches. Thanks for your patience. John --Apple-Mail-20--407073333 Content-Disposition: attachment; filename=ChangeLog Content-Type: application/octet-stream; x-unix-mode=0644; name="ChangeLog" Content-Transfer-Encoding: 7bit Content-length: 198 2011-08-06 John Lindal * mi-cmd-disas.c: Accept only -s option. Automatically set end to end of function, or complain that start address is not part of any function. --Apple-Mail-20--407073333 Content-Disposition: attachment; filename=patch_code Content-Type: application/octet-stream; x-unix-mode=0644; name="patch_code" Content-Transfer-Encoding: 7bit Content-length: 2161 *** gdb-7.3-orig/gdb/mi/mi-cmd-disas.c 2011-03-09 12:31:50.000000000 -0800 --- gdb-7.3/gdb/mi/mi-cmd-disas.c 2011-08-08 20:18:25.000000000 -0700 *************** *** 37,42 **** --- 37,47 ---- or: + START-ADDRESS: address to start the disassembly at. + (END-ADDRESS is the end of the function.) + + or: + FILENAME: The name of the file where we want disassemble from. LINE: The line around which we want to disassemble. It will disassemble the function that contins that line. *************** mi_cmd_disassemble (char *command, char *** 127,132 **** --- 132,148 ---- argv += optind; argc -= optind; + if (!line_seen && !file_seen && !num_seen && start_seen && !end_seen) + { + char *ignore_name; + CORE_ADDR ignore_low; + + if (!find_pc_partial_function (low, &ignore_name, &ignore_low, &high)) + error (_("No function contains specified address")); + + end_seen = 1; + } + /* Allow only filename + linenum (with how_many which is not required) OR start_addr + and_addr */ *************** mi_cmd_disassemble (char *command, char *** 134,144 **** || (line_seen && file_seen && !num_seen && !start_seen && !end_seen) || (!line_seen && !file_seen && !num_seen && start_seen && end_seen))) error (_("-data-disassemble: Usage: ( [-f filename -l linenum [-n " ! "howmany]] | [-s startaddr -e endaddr]) [--] mode.")); if (argc != 1) error (_("-data-disassemble: Usage: [-f filename -l linenum " ! "[-n howmany]] [-s startaddr -e endaddr] [--] mode.")); mode = atoi (argv[0]); if (mode < 0 || mode > 3) --- 150,160 ---- || (line_seen && file_seen && !num_seen && !start_seen && !end_seen) || (!line_seen && !file_seen && !num_seen && start_seen && end_seen))) error (_("-data-disassemble: Usage: ( [-f filename -l linenum [-n " ! "howmany]] | [-s startaddr [-e endaddr]]) [--] mode.")); if (argc != 1) error (_("-data-disassemble: Usage: [-f filename -l linenum " ! "[-n howmany]] [-s startaddr [-e endaddr]] [--] mode.")); mode = atoi (argv[0]); if (mode < 0 || mode > 3) --Apple-Mail-20--407073333 Content-Disposition: attachment; filename=patch_doc Content-Type: application/octet-stream; x-unix-mode=0644; name="patch_doc" Content-Transfer-Encoding: 7bit Content-length: 1205 *** gdb-7.3/doc/gdb.texinfo-orig 2011-08-08 17:51:19.000000000 -0700 --- gdb-7.3/doc/gdb.texinfo 2011-08-08 20:15:15.000000000 -0700 *************** examine memory and registers, evaluate e *** 28271,28277 **** @smallexample -data-disassemble ! [ -s @var{start-addr} -e @var{end-addr} ] | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ] -- @var{mode} @end smallexample --- 28271,28277 ---- @smallexample -data-disassemble ! [ -s @var{start-addr} [ -e @var{end-addr} ] ] | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ] -- @var{mode} @end smallexample *************** Where: *** 28283,28289 **** @item @var{start-addr} is the beginning address (or @code{$pc}) @item @var{end-addr} ! is the end address @item @var{filename} is the name of the file to disassemble @item @var{linenum} --- 28283,28291 ---- @item @var{start-addr} is the beginning address (or @code{$pc}) @item @var{end-addr} ! is the end address. If only @var{start-addr} is specified, then ! @var{end-addr} is set to the end of the function containing ! @var{start-addr}. @item @var{filename} is the name of the file to disassemble @item @var{linenum} --Apple-Mail-20--407073333 Content-Disposition: attachment; filename=patch_test Content-Type: application/octet-stream; x-unix-mode=0644; name="patch_test" Content-Transfer-Encoding: 7bit Content-length: 878 *** mi2-disassemble.exp-orig 2011-08-08 20:22:09.000000000 -0700 --- mi2-disassemble.exp 2011-08-09 09:29:52.000000000 -0700 *************** proc test_disassembly_only {} { *** 58,63 **** --- 58,67 ---- mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -- 0" \ "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ "data-disassemble file & line, assembly only" + + mi_gdb_test "333-data-disassemble -s \$pc -- 0" \ + "333\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\]" \ + "data-disassemble from pc to end of function" } proc test_disassembly_with_opcodes {} { --Apple-Mail-20--407073333--