Do not use #include <capstone/..>
This ensures compatibility with both capstone v3 and capstone as
installed on most distributions, where the pkg-config file of capstone
already adds -I/usr/include/capstone (with that dir directly containing
the headers).
* Avoid duplication of SDB headers in libr/include
SDB is an external project and as such it should live in shlr. However,
for simplicity in dealing with the include flags, the SDB headers were
copied in libr/include as well. This patch just keeps the SDB files
confined in shlr/sdb and make sure various r_* libs use the headers from
there.
* Fix pkgconfig file generation
* Do not check with r_return_ if the convention is present
Let's just assume the NULL default in such a case, so that architectures
for which we don't have a defined calling convention can still be
processed somehow by the analysis code. It won't be precise, but it's
better than nothing.
Also add a warning message so users are aware when the calling
convention is not defined.
* Fix oob-read when # is at the end of the cmd string
* Do not set TMPDIR when the new value is the empty string
When TMPDIR is set to empty value, clang+ld behaves in weird ways and
you cannot compile files from within the r2 shell (e.g. when using #!c
or #!cpipe)
* Use meson and add -lasan to pkgconfig files when sanitizer are used
Detailed description
I've confirmed #16433 (comment) (including the nasm rax -> eax bug) and thus this pr
makes the x86_64 assembler use the MOV B8+ encoding (MOV r64, imm64) when the immediate
is between 0x80000000 and 0xffffffff for both:
Consistency with GNU assembler. It actually does seem to be the expected encoding.
This does mean that mov eax, 0xffffffff and mov rax, 0xffffffff will have very different semantics.
* Wrong type of arguments to formatting function root/shlr/mpc/mpc.c
* Overflow in uncontrolled allocation size ./libr/socket/run.c
* Multiplication result converted to larger type ./libr/core/cmd_print.c
* Multiplication result converted to larger type ./libr/bin/p/bin_dyldcache.c
* Multiplication result converted to larger type ./libr/core/linux_heap_glibc.c
* Multiplication result converted to larger type ./libr/core/visual.c
* Comparison of narrow type with wide type in loop condition ./libr/core/p/core_java.c
* Fix various warning -Wall ./libr/core/p/core_java.c
* Multiplication result converted to larger type ./libr/bin/format/mach0/mach0.c
* Multiplication result converted to larger type ./libr/util/print.c
* Multiplication result converted to larger type ./libr/asm/asm.c
* Fix small warning python
* Fix type error and declaration inside loop
* Reset mpc
* replace size_t
* Fix space missing, type and format
* 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
8051 natively uses an '@' prefix for indirect access, which is
a bit awkward is r2, so it should also support the bracket syntax:
xrl a, @r0
xrl a, [r0]
Additionally, I refactored the argument tokenization so that it's all done
up-front, making everything easier to work with, saving about 800 LOC.