This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] disassembly window


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
> 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]