With variable instruction length (e.g. Intel ISA), disassembler must start at a function symbol and stop at the function end.
To avoid garbage output, it will stop at a function boundary regardless how many instructions are requested.
Clients are supposed to request more if needed and merge the data.
Hi All,
I am wondering if I could get some clarification on how the disassembly command (in the disassembly service, disassembly.c) is meant to deal with cases when symbols are
loaded.
The behavior I have noticed:
Command: Disassembly disassemble “ContextID” Addr 1 {}
This will return us at least 1 instruction (even though we’ve only specified one byte).
Then, we continue to ask for more instructions e.g.:
Command: Disassembly disassemble “ContextID” Addr 500 {}
And this will return us instructions up to the given size.
However –
we have noticed, with symbols loaded, that this will reach a “limit” on the size of instructions we can ask for (i.e. we reach a point where we cannot ask for more.
This means even if we ask for: Command: Disassembly disassemble “ContextID” Addr 1000 {}
We still get the same number of instructions returned.
This happens because of the following block:
if (sym_addr_ok && sym_size_ok &&
sym_addr <= buf_addr && sym_addr + sym_size > buf_addr &&
sym_addr + sym_size <= buf_addr + buf_size) {
buf_size = sym_addr + sym_size - buf_addr;
mem_size = (size_t)buf_size;
}
I am wondering if this behavior is expected, and if so – what the purpose of it is.
Kind Regards
David Wilson
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928