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

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
>>
>>     
>
>
>   

      reply	other threads:[~2007-08-22 13:09 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
2007-08-22 13:09     ` Andrew Cagney [this message]

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=46CC356C.30300@redhat.com \
    --to=cagney@redhat.com \
    --cc=frysk@sourceware.org \
    --cc=pearly.zhao@oracle.com \
    /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).