public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump bug-report)
@ 2005-01-13 17:42 Allan B. Cruse
  0 siblings, 0 replies; 13+ messages in thread
From: Allan B. Cruse @ 2005-01-13 17:42 UTC (permalink / raw)
  To: binutils, cruse, hjl



On Thu, 13 Jan 2005, "H. J. Lu" <hjl@lucon.org> wrote:
>
> Subject: Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump
> bug-report)
>
> ... IA-32 instruction reference manual says when INDEX == 0x4, scaled index
> is "[none]". Displaying "(%ebx,2)" is simply wrong here.
> 
> H.J.
>


Thanks, H.J.  

I use 'objdump' to help in teaching x86 architecture and assembly 
language to college students.  In the absence of a suitable AT&T-
syntax textbook that's comprehensive, the accuracy of objdump's
output, as a guide to cpu's behavior, is an invaluable resource.
Your efforts are much appreciated!

Allan  
 

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump bug-report)
@ 2005-01-14  6:11 Allan B. Cruse
  2005-01-14  7:32 ` Bernd Jendrissek
  0 siblings, 1 reply; 13+ messages in thread
From: Allan B. Cruse @ 2005-01-14  6:11 UTC (permalink / raw)
  To: binutils, cruse, hjl; +Cc: gcc, libc-alpha




On Fri, 14 Jan 2005, Alan Modra <amodra@bigpond.net.au> wrote:
>
> Subject: Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump
>
>
> ...And that's where I have a philosophical disagreement with Allan Cruse.
> I believe the disassembler should reflect the encoding as much as
> possible, while he seems to believe the disassembler should reflect
> operation.  The trouble with that argument is that taken to its logical
> conclusion we should disassemble
>   0x89,0xf6 as "nop"
>   0x8d,0x76,0x00 as "nop"
>   0x8d,0x74,0x26,0x00 as "nop"
> and so on for all of the zillion different "nop" encodings.  Indeed,
> that might help some people.  We've had the occasional bug report that
> gas wasn't aligning with nops!  But people use the disassembler for more
> that just teaching, where instruction operation might be the primary
> concern.  I'd guess that programmers casually debugging programs are
> most interested in instruction operation too, but more advanced analysis
> might focus on execution speed and instruction scheduling where
> different encodings do sometimes behave differently.  There's also the
> possibility of subtle cpu bugs that only show up in certain machine
> encodings.
>                                                                                


I think one difference between disassemblies of those 'nop' instructions
and the disassembly of  " movl (%esi,2),%eax "  is that programmers who
possess a general understanding of the assembly language syntax would be
quickly able to figure out that instructions like " xchg %ax,%ax " are
no-ops, whereas only those having an intimate acquaintance with Intel's
documentation would be able to quickly know that  " movl (%esi,2),%eax "
does NOT scale the index-register, contrary to what the syntax indicates.

I don't dispute the valid points that Alan Morda raises, nor the purity of
his appealing philosophical vision which says that a disassembler ought to
reveal subtle distinctions between alternative machine-language encodings.     

But, if one invokes the philosophical principle of "the greatest good for
the greatest number," then I would guess that there are more individuals
who are relying on 'objdump' for help with program-debugging. and with
clarifying processor-operations, than there are people who use 'objdump'
for doing esoteric code-optimizations -- and to decrypt secret messages 
someone might have hidden inside a code-stream. 

Helping more people be more productive with their computers, rather than
waste time figuring out misleading syntax, isn't a bad goal -- is it?
--Allan


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-01-14 21:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20050111210753.0C8CB219E0@nexus.cs.usfca.edu>
2005-01-12 19:10 ` PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump bug-report) H. J. Lu
2005-01-13  3:44   ` Alan Modra
2005-01-13 17:09     ` H. J. Lu
2005-01-13 17:27       ` H. J. Lu
2005-01-14  0:06       ` Alan Modra
2005-01-14  0:27         ` H. J. Lu
2005-01-14  0:59           ` Alan Modra
2005-01-14 21:49             ` H. J. Lu
2005-01-14  7:04         ` Bernd Jendrissek
2005-01-13 17:42 Allan B. Cruse
2005-01-14  6:11 Allan B. Cruse
2005-01-14  7:32 ` Bernd Jendrissek
2005-01-14 17:19   ` E. Weddington

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