From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1953 invoked by alias); 20 Aug 2007 13:32:39 -0000 Received: (qmail 1645 invoked by uid 22791); 20 Aug 2007 13:32:37 -0000 X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 20 Aug 2007 13:32:32 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l7KDWIHA009406; Mon, 20 Aug 2007 09:32:18 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l7KDWHaO001791; Mon, 20 Aug 2007 09:32:17 -0400 Received: from [127.0.0.1] (sebastian-int.corp.redhat.com [172.16.52.221]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l7KDWFEX002730; Mon, 20 Aug 2007 09:32:15 -0400 Message-ID: <46C997F2.1060206@redhat.com> Date: Mon, 20 Aug 2007 13:32:00 -0000 From: Andrew Cagney User-Agent: Thunderbird 1.5.0.12 (X11/20070530) MIME-Version: 1.0 To: pearly.zhao@oracle.com CC: frysk@sourceware.org Subject: Re: [patch] disassembly window References: <1187340639.3861.47.camel@linux-pzhao.site> In-Reply-To: <1187340639.3861.47.camel@linux-pzhao.site> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00310.txt.bz2 Zhao Shujing wrote: > Hi > > This patch is to fix bug #4932 and other bugs of disassembly window. > rowPrepend is added to prepend rows by calculating memory information > like rowAppend. Because the methods that are provided by class > Disassembler, disassembleInstructions and > disassembleInstructionsStartEnd, can only read the instructions that are > following some address, rowPrepend have to use two while execution > control to read the instructions that are preceding some address. > Any suggestions are welcomed. > Pearly, nice work. The challenge here, and the reason why the disassembler only goes forward from PC is that, in general, it isn't possible to disassemble backwards. This is because architectures such as the i386 and x86-64 have variable length instructions making it effectively impossible to figure out where, looking backwards, an instruction starts. For instance, looking backwards is that a one byte int80 instruction, or a multi-byte instruction loading the hex code for int80? For disassembling a range, can I suggest doing something similar to the disassembler command in frysk.hpd.DisassemblerCommand. That code first attempts to fetch the frysk.symtab.Symbol at the frame's adjusted-address and then uses its address/size to determine the start address and size to disassemble. If the symbol isn't available, then I'd just disassemble a small range from the frame's PC. One heads up for you; you may want to consider configuring your personal build with --with-libopcodes. Andrew