This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump bug-report)
- From: cruse at cs dot usfca dot edu (Allan B. Cruse)
- To: binutils at sources dot redhat dot com, cruse at cs dot usfca dot edu, hjl at lucon dot org
- Cc: gcc at gcc dot gnu dot org, libc-alpha at sources dot redhat dot com
- Date: Thu, 13 Jan 2005 22:10:22 -0800 (PST)
- Subject: Re: PATCH: Fix i386 disassembler with index == 0x4 in SIB (Re: objdump bug-report)
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