This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: RFC: Is it OK to disassemble instructions twice ?


Hi Florian,

> Nick, doubling the diassembly cost is rather excessive.  It is quite
> slow already, reducing its usefulness.

Do we actually have complaints about the speed of disassembly ?

My assumption was that most users of the disassembler would only
be looking at a small region of code, or a small test case.
If a user is going to disassemble a large swath of code, are they
really going to be inconvenienced if it takes a non-negligible
amount of time ?

> Would it be possible to add a hook which decodes the size of the
> instruction first, then does the relocation processing, and then
> disassembles the instruction (passing the already-computed size for
> convenience, perhaps)?

I was trying to avoid this as it would mean adding new code to every
architecture's disassembler.  Plus changing the disassembler's API
which I think might affect GDB.

> Or maybe you could add a per-target maximum instruction length and do
> the double-disassembly only if there is a relocation within the maximum
> instruction length window.

That would work.  The code at the moment does limit the double disassembly
to only when relocs are associated with the section being disassembled,
and then only if the next reloc is not targetting the start of the 
instruction that is about to be disassembled.  It is a good suggestion
though, so I will have a go at implementing it.

Cheers
  Nick



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