* introduce r_bin_open_buf
* fix r_bin_file_delete to use bf->id and not fd. This was used
inconsistently and the function was just wrong.
* rewrite r_bin_reload to just reuse the existing bf->buf
* fix some memory leaks
In linux_attach_single_pid there is a check to avoid calling PT_ATTACH
multiple times on an already traced pid, which is an operation that
should be done only one time. The old code supposedly tried to set the
options only the first time you attach to a process, however when
debugging a process through the io_ptrace plugin, the process uses
TRACEME and the code never set the options of ptrace to intercept the
process before dying, amongst other things.
This patch addresses this issue by just always setting ptrace options.
Those options could be changed by the user during the life of the debug
session, so it's not an operation that should be done only one time.
* handle 8051 ANAL_OP DISASM
The 8051 assembler has been R_APId, #included in the local scope, and
called to fill op->mnemonic, which stops a bunch of warnings from
appearing whenever a bunch of disassembly appears on the screen.
The disassembler is called because of comments in r_anal.h: op->mnemonic
should contain the entire disassembly, not just the mnemonic.
Here's hoping the mnemonics and arguments will get split eventually.
* typdef some RAnal enums
In trying to make my analysis push out more info, it's difficult to
understand what all these ints mean, while ACTUALLY they should be
filled with enum values. By using the enum names, that's made clear
immediately.
r2's style is typedef over `enum name`, so that's what I did.
the typedef-instead-of-int I added here isn't consistently propagated,
and has caused warnings about unhandled cases-in-switch, at least some
of which should just get a default: case added, but I'd rather leave it
to the domain experts, or my future self when I become that domain
expert.
* refactor 8051 optype switch into table
it's pretty much static data with very meagre duplication, putting it in
a switch-case is unwieldy.
* add cycle info to 8051 opcode analysis
* add more basic 8051 anal info
op->cond, eob, nopcode, family, id
they seem mostly useless, but it's not much work to add, so...
* use ANAL_OP_MASK_VAL
* fixup! handle 8051 ANAL_OP DISASM
* fixup! use ANAL_OP_MASK_VAL
* Revert "use ANAL_OP_MASK_VAL"
:)
Clearly I was using MASK_VAL incorrectly, the only hint to its use was:
> // It fills RAnalop->dst/src info
so even though it's named "VAL", it might not actually need
to fill RAnalop->val...
Nor ptr, and definitely not jump and fail, which means we don't have use
for it yet! Not until I actually implement ->dst/src