This is the mail archive of the binutils@sources.redhat.com 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: Objdump on VAX


On Mon, 29 Nov 2004, Jan-Benedict Glaw wrote:

> objdump works by going through the .text section and disassembles
> it, adding function name and address to each line of disassembly.
> However, this doesn't really work for VAX: per calling convention,
> the first two bytes of a function's address don't contain executable
> assembler instructions, but a bitmask of registers to push onto the
> stack while CALLSing this function.
> 
> There are about 10 really hackish ways to solve that, but I don't
> see a really clean solution. I'd think of something like
> 
> 	- Disassemble data at current address
> 	- Try to get function's name and start address
> 	- if (VAX && 8current_address-2) <= function_start_address) {
> 		current_address++;
> 		continue;
> 	  }
> 
> However, this breaks if previous function's padding bytes make of a
> long opcode which spawns into the new function...

 See how disassemble_bytes() is called -- it works on a
function-by-function basis (this is how you get disassembly and raw output
interspersed depending on symbol types for "-d" for MIPS/ELF), so padding
is not a problem -- just dump trailing bytes as raw data (or "...") as
they don't form a complete instruction anyway.  You probably also want to
treat the leading two bytes this way (or maybe using a somewhat more fancy
output), but disassemble_bytes() and its worker disassembly function do
not get passed the associated symbol's type attribute.  I guess passing it
as an additional argument might be the easiest solution, but not
necessarily the best -- others may have different proposals.  Or perhaps
just do that unconditionally.

 Note that you probably need to find a reasonable way of treating both
"-d" and "-D" and cases when a symbol table is available or not.

  Maciej


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