From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13772 invoked by alias); 22 Aug 2007 13:09:02 -0000 Received: (qmail 13553 invoked by uid 22791); 22 Aug 2007 13:08:59 -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; Wed, 22 Aug 2007 13:08:54 +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 l7MD8e3c004852; Wed, 22 Aug 2007 09:08:40 -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 l7MD8eDp002159; Wed, 22 Aug 2007 09:08:40 -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 l7MD8db7012145; Wed, 22 Aug 2007 09:08:39 -0400 Message-ID: <46CC356C.30300@redhat.com> Date: Wed, 22 Aug 2007 13:09: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> <46C997F2.1060206@redhat.com> <1187774326.4163.16.camel@linux-pzhao.site> In-Reply-To: <1187774326.4163.16.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/msg00319.txt.bz2 Zhao Shujing wrote: > Hi, Andrew > Thanks for the explanation of disassemble backwards. > > If the symbol isn't available, gdb's disassemble command would return > "No function contains specified address". Would frysk's disassemble > command disassemble a small range from the frame's PC, not just return > some warning sentence? > Pearly, yes, the command-line will still disassemble. And I like the idea of the disassembler-window can do something similar. Andrew > Thanks > Pearly > On Mon, 2007-08-20 at 09:32 -0400, Andrew Cagney wrote: > >> 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 >> >> > > >