From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27657 invoked by alias); 22 Aug 2007 09:14:46 -0000 Received: (qmail 27624 invoked by uid 22791); 22 Aug 2007 09:14:45 -0000 X-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME X-Spam-Check-By: sourceware.org Received: from agminet01.oracle.com (HELO agminet01.oracle.com) (141.146.126.228) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 22 Aug 2007 09:14:41 +0000 Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l7M9EWtB022465; Wed, 22 Aug 2007 04:14:32 -0500 Received: from dhcp-beijing-cdc-10-182-121-20.cn.oracle.com (dhcp-beijing-cdc-10-182-121-20.cn.oracle.com [10.182.121.20]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id l7M9ETPV000317; Wed, 22 Aug 2007 03:14:30 -0600 Subject: Re: [patch] disassembly window From: Zhao Shujing Reply-To: pearly.zhao@oracle.com To: Andrew Cagney Cc: frysk@sourceware.org In-Reply-To: <46C997F2.1060206@redhat.com> References: <1187340639.3861.47.camel@linux-pzhao.site> <46C997F2.1060206@redhat.com> Content-Type: text/plain Organization: Oracle Date: Wed, 22 Aug 2007 09:14:00 -0000 Message-Id: <1187774326.4163.16.camel@linux-pzhao.site> Mime-Version: 1.0 X-Mailer: Evolution 2.6.0 Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAA== X-Whitelist: TRUE X-Whitelist: TRUE 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/msg00317.txt.bz2 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? 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 >