public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: cruse@cs.usfca.edu (Allan B. Cruse)
To: binutils@sources.redhat.com, cruse@cs.usfca.edu, hjl@lucon.org
Cc: gcc@gcc.gnu.org, libc-alpha@sources.redhat.com
Subject: Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump bug-report)
Date: Fri, 14 Jan 2005 06:11:00 -0000	[thread overview]
Message-ID: <20050114061022.50A1C21A49@nexus.cs.usfca.edu> (raw)




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


             reply	other threads:[~2005-01-14  6:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-14  6:11 Allan B. Cruse [this message]
2005-01-14  7:32 ` Bernd Jendrissek
2005-01-14 17:19   ` E. Weddington
  -- strict thread matches above, loose matches on Subject: below --
2005-01-13 17:42 Allan B. Cruse
     [not found] <20050111210753.0C8CB219E0@nexus.cs.usfca.edu>
2005-01-12 19:10 ` 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

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=20050114061022.50A1C21A49@nexus.cs.usfca.edu \
    --to=cruse@cs.usfca.edu \
    --cc=binutils@sources.redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=hjl@lucon.org \
    --cc=libc-alpha@sources.redhat.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).