My wishlist of features to be added to libdasm

10 views
Skip to first unread message

silvio...@gmail.com

unread,
May 14, 2009, 8:44:09 PM5/14/09
to libdasm
This is just to make a note of some suggestions. I don't expect them
to be implemented (if at all) until a much later date.

1) A rather large problem with libdasm is it doesn't take in a buffer
length as an argument. This means if you are disassembling a buffer,
the disassembly will happily go past the end of that buffer for the
last instruction if it doesn't terminate perfectly at the boundary.
Really, these types of instructions should be truncated, and an
illegal instruction returned. A fix for this probably requires a
change to the API to take in a buffer size argument.

2) Provide a callback mechanism for FETCH* memory instructions. This
can be handy sometimes. In my own hacked version of libdasm, I can
pass in an address argument instead of a buffer, and FETCH* uses a
callback with that address. The only real problem I have with my own
code is efficiency. The result of a fetch is almost never stored as a
temporary and reused, so it generates alot of extra calls to the
callbacks when I'd really like to avoid it. I'm not entirely sure if
other people will find the callback mechanism useful, so consider this
suggestion a more optional wish.. Though I'd really appreciate all the
fetches to be stored in temporaries. This would also result in faster
execution on big endian machines since FETCH* does some extra work on
those architectures.

PS. The hacked solution I have for 1) in my own code currently is to
use 2) when there is less than 13 bytes (max instruction length for
32bit) left in the buffer to disassemble. Then a callback in 2)
throws an exception (c++) if its out of bounds. Very hacky.
Reply all
Reply to author
Forward
0 new messages