* The emitted esil for jalr was incorrect in the case where `rd` and
`rs1` are equal, since then `rs1` is written to as `rd` before adding
the immediate.
For example, `jalr ra ra 0x42` was lifted to the following esil:
4,$$,+,ra,=,ra,66,+,pc,=
While this does correctly set rd to the return address after the call,
pc is not correctly set according to `pc <- ra + 0x42`, but instead
`pc <- pc + 4 + 66`.
This commit flips the order of setting `pc` and `rd`, so that `rd` is
read from before it is written to.
* According to the spec, the auipc instruction's immediate is a
20-bit upper immediate, which means it should be left-shifted
by 12 similar to the lui instruction:
> AUIPC forms a 32-bit offset from the 20-bit U-immediate,
> filling in the lowest 12 bits with zeros, adds this offset
> to the address of the AUIPC instruction, then places the
> result in register rd.
* Add support for listing parsers, bits and add `Lp` command
* Populate option fields for `asm.parser` and `asm.bits` instead of printing, now tab autocompletion works
* Use `r_str_newf()` function instead of snprintf for updating `asm.bits`
* Add test case for Lp command
kvm_openfiles failed to open /dev/mem without root on fbsd, the special value
"/dev/null" should be used as non root since we don't directly access kernel memory.
* Support more output modes for class inheritence graph.
* Refactor codexrefs and importxrefs graphs.
* Add ag_w for the commands using new mechanism.
* Separate drawable graph from r_graph.
* Fix back-reference to templated operator functions
* Fix back-reference to templated names
* Support demangling rvalue references
* Support demangling 'std::nullptr_t' type
* Support demangling function types inside templates
* Support demangling array types inside templates
* Support demangling empty templates
* Support demangling compiler generated statics
* Support demangling thunk functions
* Unwrap quoted strings when passing args to newer handlers ##newshell
When a user wraps an argument, it means like in SH that he wants the
command to consider the argument as one single arg, even if composed by
multiple words. The same applies for r2newshell. So far we did not
unwrap quoted strings to maintain compatibility with old shell, but
doing this unwrapping is one of the nice feature of newshell.
* Add tests for quoting/unquoting
* Adjust tests with `w` for newshell/oldshell
* Fix asm/anal IT block for ARM
* Fix indent + missing spaces
* Fix ARM asm patch breaking test
* Remove forgotten debug printf
* Moved anal patch to separate function anal_ITblock()
* Changed to RIOBind + fix code based on comments
* Fix issue with io/rasm
* Switched to HT, still need to invalidate HT
* Add routine to track and clean ITblock
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
* Convert R_CMD_DESC_TYPE_GROUP to INNER
* Avoid confusing "group_" prefixes by splitting cmddesc ##newshell
Create "group" command descriptor and give them their own help, to avoid
dupping fields such as group_summary, group_args_str, etc. By having a
separate help structure for the grouping node we make the cmd_api code
easier because it doesn't need to distinguish between
group_summary/summary, group_args_str/args_str, etc. and we avoid few
bytes for each command descriptor help structure, since most of them
did not use group_* fields.
* Other simplification in cmd_api due to split GROUP/exec cb.
* Handle R_CMD_DESC_TYPE_GROUP in r_cmd_call_parsed_args
* Better use of the R_SOCKET_PROTO_DEFAULT and add _NONE ##http
* Fix regressions in: r2 -C and =+ ##r2pipe
Introduced in 04edfa82c1
* Implement sleep command ##shell
* Add tests for the webserver and remoting
* Implement daemon directive in rarun2, fix http test ##rarun2
* Fix socket timeout on Windows (patch by @GustavoLCR) ##socket
* Missing http.root is not a reason to not start the webserver ##http
* Fix r2 -C, =!=0, replace curl with r2 in the webserver test ##http
* Honor anal.in/from/to in aae, optimize db/formats/mach0/thumb ##anal
* Bug fixes and performance improvements
Co-authored-by: pancake <pancake@nopcode.org>
* Mark http test as broken until properly fixed
* Fix return type of `signal`
* Mark V850 pseudo test as broken
Co-authored-by: Anton Kochkov <xvilka@gmail.com>
* Add GROUP RCmdDesc type and fix where the args_str is shown
* Adjust color of `[?]`
* Differentiate between cmd<?> and cmd[?]
<?> when cmd is not valid by itself
[?] when cmd is valid but there are also other sub-commands available
* Fix usage for commands like `w` that are both commands and groups
* Do not automatically switch to detail=2 for leaf commands
* Fix test due to change in `?`/`??` behaviour
* x86 cmp/sub esil: Support bitsize of 64
* Fix pij tests
* Don't shift if bitsize is 0
* Don't esilprint anything if bitsize is invalid
* Use %u instead of %d
* Check whether bitsize is 0
* Implement r_cons_set_title for Windows ##cons
* Implement ?et command to change terminal title ##cons
* Apply Windows fix from @a1ext
Co-authored-by: pancake <pancake@nopcode.org>
* Set LD_PRELOAD for unit tests
* Declare failed debug tests as broken if no assertion or Sanitizer in output
* Check for ASAN=1 in cmd_pipe test
* Set asan: true in the GitHubCI matrix
* Fix ttyname-related runtime error
* Upgrade asan build to Ubuntu 20.04
* Quick fix for reg/arena.c runtime error
Merge sort uses cmp (a, b) < 0 for its first test branch, and insertion
sort cmp (a, b) > 0 ; which means the 0 boundary goes in one case in one
branch, and in the other sort function in the other branch.
It makes it possible to support compare function that return true/false
instead of -1/0/1; although this isn't an acceptable use of
RListComparator, this prevents future bugs from appearing, because this
works with insertion sort, but not merge sort.
The main advantage of this patch is that both sort functions should sort
equal elements the same way. This stability is important for zignatures
for example.
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).
* Correctly get the address of the PLT entry for a symbol. If the symbol
was not yet added to the .got.r2 section, then take the first available
address (vaddr), otherwise retrieve it from the hashtable.
* Avoid showing wrong relocations when relocations are already replaced
libr.a is built with all the files required to build against r2, so that
includes also SDB. As SDB already has a file named json.c, the new json
parser in r_util collides with it.
* fix typo in anal_arm esil (does not affect esil execution)
* add af flag setting and sof op for sub overflow, change borrow
* remove the break that was 'breaking' everything, fix warning
* add new sign extension operator and use it to handle signedness in imul
* work on expressions for idiv, div, imul, mul, remove and just modify sub/cmp
* add clz and reorder the sign extension arguments to be in line with all other ops
* add support for many arm64 instructions
* add sign extension to all ldr*s instructions
* make numerous changes to fix REV*, SXT*, LSL, LSR, ASR, SDIV, MOVN and others, to be detailed in PR
* add sxt* to shifted_register_append, use it to fix opcall and ldr / str
* remove unnecessary commented code
* add some comments
* add clz and reorder the sign extension arguments to be in line with all other ops
* add sign extension to all ldr*s instructions
* make numerous changes to fix REV*, SXT*, LSL, LSR, ASR, SDIV, MOVN and others, to be detailed in PR
* add sxt* to shifted_register_append, use it to fix opcall and ldr / str
* fix wrong type check in esil_signext
* change borrow flag back to the way it was
* add example comment to esil_signext
* unbreak movk
* format mask in sub, cmp, and movk as hex
* add test for esil signext operator
* use ULL instead of (ut64) cast in shifts
* Add dmhtm for tcache mangling pointers
* Add dmhfm for fastbins with mang ptrs
* Add dmhfm <n> for fastbins
* Pointer mangling support to dmh
* Fix spacing for PROTECT_PTR
* Add fastbins checks for dmh
* Clean code for next_pointer
* Use ternary operator when possible
* Add dbg.glibc.demangle option
* Set correct initial_brk for multi-glibc support
* Remove comments and unneeded variables
* Remove 'm' commands, use demangle variable
* Update description of dbg.glibc.demangle
* Test for tcache 2.32 and remove old ones
* Force tests
* Solve insidious bug of filenames
* Fix dmh test and more tcache testing
* Remove unused variables
* Ensure num->value is saved before anything else, otherwise it may change
r_config_get_i calls r_num_math, which sets the num->value, thus losing
the return value of the last command.
* Make r_core_cmd_str_pipe use the new parser when enabled