Re: [patch] Disassembly improvements

Pedro Alves
2013-10-10T15:13:36Z

On 10/10/2013 03:52 PM, Pedro Alves wrote:
> On 10/10/2013 02:57 PM, Abid, Hafiz wrote:
>>>>
>>>> Hmm, this seems to miss making sure LEN doesn't read beyond the original
>>>> requested memory range. It'd be good to add that.
>> Changed to following line which should take care of this.
>> unsigned int length = min (len, info->buffer_length);
>
> But it seems to me that will just disable the optimization for
> buffer line > 1.
>
> LEN here I think will the disassembler considers to be the maximum
> length of an instruction for the arquitecture it is disassembling.
> We want to read _more_ than that from memory in one go, otherwise, we'll
> not be buffering anything. What we do not want, is for that over
> fetching to read beyond the range that was passed to gdb_disassembly.
>
> I think we'll need to derive from "struct disassemble_info",
> and add the original range to that new struct, or record that info
> directly in "struct disassemble_info", which is in include/dis-asm.h.

I now noticed there's a struct disassemble_info->application_data field,
which GDB currently uses to put the gdbarch in. We could put a
disasm.c specific structure there instead.

--
Pedro Alves