This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Objdump on VAX
- From: "Maciej W. Rozycki" <macro at linux-mips dot org>
- To: Jan-Benedict Glaw <jbglaw at microdata-pos dot de>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 29 Nov 2004 19:21:01 +0000 (GMT)
- Subject: Re: Objdump on VAX
- References: <20041129194726.E1935@microdata-pos.de>
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