public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Zhao Shujing <pearly.zhao@oracle.com>
To: Andrew Cagney <cagney@redhat.com>
Cc: frysk@sourceware.org
Subject: Re: [patch] disassembly window
Date: Wed, 22 Aug 2007 09:14:00 -0000	[thread overview]
Message-ID: <1187774326.4163.16.camel@linux-pzhao.site> (raw)
In-Reply-To: <46C997F2.1060206@redhat.com>

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
> 


  reply	other threads:[~2007-08-22  9:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-17  8:47 Zhao Shujing
2007-08-20  9:07 ` Zhao Shujing
2007-08-20 13:32 ` Andrew Cagney
2007-08-22  9:14   ` Zhao Shujing [this message]
2007-08-22 13:09     ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1187774326.4163.16.camel@linux-pzhao.site \
    --to=pearly.zhao@oracle.com \
    --cc=cagney@redhat.com \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).