Commit Graph

21535 Commits

Author SHA1 Message Date
GustavoLCR
bae726b716
Fix prompt autocompletion when in graph mode (#17797)
* Fix prompt autocompletion when in graph mode
* Don't enter interactive graph mode if `scr.interactive=false`
2020-10-23 14:41:14 +08:00
Liumeo
7dafe64be5
Fix MSVC warning 'void' function returning a value (#17819) 2020-10-23 13:21:09 +08:00
David CARLIER
b1996da031
Setting ASLR support for DragonFlyBSD ##util (#17810)
Enable calls for rarun2
2020-10-22 16:26:53 +08:00
pancake
3fffa6f7e1
Fix #17804 - This has-main code in swift-sd.c is already in libdemangle (#17812)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-22 16:26:32 +08:00
Anton Kochkov
ade2fe1a02 Fix _ALIGN macro redefinition 2020-10-22 13:37:25 +08:00
Anton Kochkov
afba51ce98 Fix format warnings in libr/core 2020-10-22 13:37:25 +08:00
Liumeo
4287408a3e
Fix ARM64 db/tools/ragg2 (#17801) 2020-10-19 18:21:49 +08:00
eagleoflqj
9fb7fc3bcd fix travis arm64 db/tools/rasm2 2020-10-19 11:55:37 +02:00
Anton Kochkov
21907a565e Fix format string warnings 2020-10-19 11:50:06 +02:00
Riccardo Schirone
735b36ba51 Remove trailing whitespace 2020-10-19 11:50:06 +02:00
Liumeo
4a6b69b2d2
Fix ARM64 test_r2pipe_404 (#17796) 2020-10-19 12:47:31 +08:00
GustavoLCR
5f7f1b07cf
Fix #17790 - Fix crash when recovering MSVC RTTI on 32-bit host (#17794) 2020-10-19 12:28:01 +08:00
Fabian Freyer
9e586bf3b4
Fix incorrect esil of RISC-V jalr insn ##emu (#17788)
* 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.
2020-10-16 12:53:05 +08:00
Fabian Freyer
e4d7f656ca
Fix incorrect esil of RISC-V auipc insn ##emu (#17787)
* 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.
2020-10-16 12:52:42 +08:00
GustavoLCR
79de725396
Fixes for MSVC demangling (#17783)
* Support demangling nested names
* Support demangling RTTI operator codes
* Fix parsing function pointers with access modifier
2020-10-16 12:52:01 +08:00
Khairul Azhar Kasmiran
fb9aec2eb3
Fix pxd asan crash (#17789) 2020-10-15 18:14:03 +08:00
Riccardo Schirone
81e487429f
Use -Wno-cpp to avoid errors on #warning (#17785) 2020-10-14 16:57:07 +08:00
GustavoLCR
623c4819d6
Fix some warnings in WinDBG plugin (#17784) 2020-10-14 14:51:11 +08:00
pancake
6b6f88efd3
Speedup r2pipe-spawn: r2 -0 sets scr.prompt=0 do not autocomplete or log ##r2pipe (#17767) 2020-10-13 22:45:45 +02:00
Riccardo Schirone
1e58692071
Fix incorrect uses of printf-like functions ##refactor (#17648) 2020-10-13 16:26:15 +02:00
pancake
a761eb1d5a
Add initial function prelude support for v850 ##anal (#17779) 2020-10-13 15:45:24 +02:00
pancake
7c9280866d
Fix and improve ?e? help message (#17765) 2020-10-13 15:44:39 +02:00
Aswin C
e08b963ada
Improve help under v? ##cons (#17743) 2020-10-13 14:27:36 +02:00
Riccardo Schirone
741d22ed61
Use -Werror when building in CI (#17781) 2020-10-13 12:42:57 +02:00
Riccardo Schirone
ce143ac837
Do not free ds->opstr after r_parse_immtrim (#17728)
There is no new allocation in r_parse_immtrim, so it is not required to
free the "previous" string.
2020-10-13 12:40:35 +02:00
Vasilij Schneidermann
e3999b7fcd
Add help string for path input prompt (#17742) 2020-10-13 12:48:49 +08:00
pancake
34285a1ed4
Set v850 disassembler when opening v800 ELF files ##bin (#17778) 2020-10-13 02:30:11 +02:00
tantei3
6c89716d44
Add support for listing parsers, bits and add Lp command ##shell (#17741)
* 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
2020-10-10 17:38:01 +08:00
pancake
dbd1f867f1
BLR on arm64 is an RCALL, not an UCALL ##anal (#17769)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-10 17:35:51 +08:00
pancake
b42fe2c807
Complete v850 instruction descriptions ##asm (#17764)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-10 12:14:49 +08:00
junchao-loongson
91529d744c
Improve mips.gnu esil ##anal (#17722) 2020-10-10 12:13:19 +08:00
pancake
c521a6290c
Move spc700 asm,bin plugins to radare2-extras ##asm (#17762)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-10 12:11:29 +08:00
pancake
583b79fb87
Autocomplete 'ls' with TAB as its done for cd, rm, .. ##shell (#17775)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-10 12:10:19 +08:00
pancake
85e684d5b8
Fix build race condition introduced in 0ba897f5c9 (#17773)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-10 00:36:10 +08:00
pancake
131bb22a25
Capitalize all messages in /a? and fix 5 warnings (#17766)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-09 12:55:30 +08:00
Vasilij Schneidermann
e4b0139e56
Add JSON variants of pxd[1,2,4,8] commands (#17744) 2020-10-09 12:53:51 +08:00
laydervus
8e0d869468 Show raw bytes in pdj when invalid 2020-10-09 12:34:17 +08:00
officialcjunior
d240f4c1ce Remove example.syscall-file ##build 2020-10-09 12:33:42 +08:00
yossizap
8872019a23 Show child processes in *bsd dp ##debug 2020-10-09 12:32:18 +08:00
yossizap
7522b2c9cc Fix dp 0 not showing other processes on freebsd ##debug 2020-10-09 12:32:18 +08:00
yossizap
e32ad7091c Fix FreeBSD dp permission denied failure ##debug
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.
2020-10-09 12:32:18 +08:00
karliss
bdb88df38c
Graph refactor ##refactor (#17631)
* 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.
2020-10-06 10:57:51 +08:00
GustavoLCR
02edb130d7 Fixes for MSVC name demangling
* 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
2020-10-06 10:54:29 +08:00
Florian Märkl
16a91fbe5a Fix eprinf -> eprintf 2020-10-05 21:22:58 +08:00
yossizap
9bced66d7b
Fix FreeBSD step error ##debug (#17749) 2020-10-05 10:01:47 +08:00
plaets
452b3ce902
Fix #17746 (buffer overflow in brainfuck disassembler) ##asm (#17747) 2020-10-04 14:17:02 +02:00
pancake
b4a6b3ab20
Add remaining =A0 in regprofiles for calling convention ##anal (#17735) 2020-10-01 13:56:47 +02:00
Aswin C
fd99114bca
Rename asm.filter to asm.sub.names ##cons (#17737)
* Rename `asm.filter` to `asm.sub.names`
* Rename tests for `asm.filter`
2020-10-01 10:13:58 +08:00
GustavoLCR
87b7be75e3
Fix rafind2 -m/-i/-E on Windows (#17740) 2020-10-01 10:13:38 +08:00
Riccardo Schirone
187f314c49
Unwrap quoted strings when passing args to newer handlers ##newshell (#17732)
* 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
2020-09-30 14:25:38 +08:00
Azox
1287f7443f
FIX ARM IT block ##anal (#17509)
* 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>
2020-09-30 13:45:01 +08:00
Florian Märkl
f56046e32a
Add setters for CC self and error and Tests ##anal (#17704)
* Add setters for CC self and error and Tests ##anal
* Purge sdb_cc on anal purge ##anal
* Add non-nonsensical syntax for self/err CC
2020-09-30 13:39:20 +08:00
Riccardo Schirone
72baf0da5c
Split GROUP RCmdDesc and regular ones ##newshell (#17726)
* 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
2020-09-30 13:38:30 +08:00
Khairul Azhar Kasmiran
0e1fa7c341
Do partial =h test on Windows (without /cmd and using curl) (#17729)
* Properly default http.root on Windows
* Do partial =h test on Windows (without /cmd and using curl)
2020-09-29 21:23:26 +08:00
Jing Xia
b3c0e42426
Fix inverted help for /ai and /aI ##doc (#17719) (#17725) 2020-09-29 11:21:00 +02:00
phakeobj
1aba692eb6
Treat error as a format string instead of a string literal (#17731) 2020-09-29 12:36:59 +08:00
Aswin C
45c0024300
Rename asm.var.sub to asm.sub.var ##cons (#17717)
* Rename `asm.var.sub` to `asm.sub.var`
* Rename tests for `asm.var.sub`
2020-09-28 17:51:38 +08:00
Florian Märkl
8fea09e21d
Use Ht instead of SDB for pcache ##io (#17716) 2020-09-27 12:22:18 +02:00
Khairul Azhar Kasmiran
9100440fae
Fix possible use of dangling pointer due to calling r_anal_pin_fini() followed by r_anal_pin_init() (#17720) 2020-09-27 12:21:50 +02:00
Florian Märkl
3f81a40844
Kill RIODesc.obsz ##io (#17715) 2020-09-27 10:01:23 +02:00
pancake
aa7de006e6 Fix TinyCC build ##build 2020-09-27 13:33:26 +08:00
Florian Märkl
ae0b5e503f
Purge Pins on r_anal_purge ##anal (#17703) 2020-09-27 12:39:50 +08:00
Riccardo Schirone
c7b3dc9e65
Remove sig_t because not used (#17712) 2020-09-25 15:37:33 +02:00
pancake
62c2128b6f
Better use of the R_SOCKET_PROTO_DEFAULT and add _NONE (#17644)
* 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>
2020-09-25 19:51:23 +08:00
Riccardo Schirone
83d3e7bf18
Mark tests as broken until properly fixed (#17711)
* 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>
2020-09-25 17:30:29 +08:00
Riccardo Schirone
ea7da3366b
Add parse_v850_pseudo to meson build (#17710) 2020-09-25 16:51:03 +08:00
pancake
e28ce2990d
Implement the v850.pseudo RParser plugin ##disasm (#17687) 2020-09-24 17:56:16 +02:00
Riccardo Schirone
9b59074787
Automatically group sub-commands ##newshell (#17663)
* 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
2020-09-24 17:50:52 +02:00
pancake
46aff1ec53
Implement ab./ablj/abl,/ablq - list all the basic blocks ##anal (#17680) 2020-09-24 17:23:23 +02:00
pancake
7c76d85031 Add tests for RTable using r2 commands 2020-09-24 17:19:25 +02:00
pancake
e13753e6d0 Support strings in /ne/ and /eq/ RTable.filter ##util 2020-09-24 17:19:25 +02:00
pancake
6ce78c6149 Implement /head, /tail and /page in RTable API ##util 2020-09-24 17:19:25 +02:00
pancake
43ff1e4189 Support boolean columns in RTable ##util 2020-09-24 17:19:25 +02:00
pancake
454d7ada78 Support :simple in RTable.tostring() ##util 2020-09-24 17:19:25 +02:00
pancake
f71ec729ba
Always register the derived CC from the reg profile ##anal (#17685) 2020-09-24 17:17:15 +02:00
Damien Zammit
2a0d8fbe59
Install r2sdb, detect R2_HOME_SDB_FCNSIGN for r2extras custom CC ##build
* cc: Add autodetection for R2_HOME_SDB_FCNSIGN new location of custom calling conventions
* Fix r_file_exists not expanding tilde path
* r2sdb: Install executable
2020-09-24 12:26:53 +02:00
Florian Maerkl
8842de91e5 Kill RAnal.sdb_fcns because it is unused now ##refactor 2020-09-24 12:12:42 +02:00
Florian Maerkl
5e50ed7f11 Remove noperational axt for vars ##refactor 2020-09-24 12:12:42 +02:00
Florian Maerkl
e6cefa903a Directly apply Callee Args in Type Matching ##anal 2020-09-24 12:12:42 +02:00
pancake
63803c57dd
Fix scrolling with L in mini graph mode ##visual (#17700) 2020-09-24 09:47:54 +02:00
phakeobj
89e1618e3c
Fix #17353 - Remove duplicated implementation of uleb128 in mach0 ##bin (#17489) 2020-09-24 09:47:23 +02:00
Alexis Ehret
ec6a52e8a9
Fix 3 lgtm warnings (#17465) 2020-09-24 09:37:41 +02:00
Khairul Azhar Kasmiran
2293d29308
x86 cmp/sub: Properly generate esil for bitsize of 64 ##anal (#17665)
* 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
2020-09-24 12:14:43 +08:00
Florian Märkl
022324029d
Add Global Import API (#17692)
* Add Tests and Make it strict
2020-09-24 02:15:22 +02:00
GustavoLCR
22468fdc0a
Support demangling MSVC managed pointer types ##bin (#17694)
* Demangle __clrcall calling convention
* Transform a giant macro to a function for sanity sake
* Add tests
2020-09-23 16:40:10 +02:00
Florian Märkl
78e30b3ac7
Refactor Variable Constraints out of SDB ##anal (#17693) 2020-09-23 09:40:39 +02:00
pancake
19f941509b
Fix rasm2 -L bits field for 4 and 0-bit plugins ##asm (#17686) 2020-09-23 13:31:56 +08:00
Florian Märkl
1c485e8bfc
Rename r_sign_anal_additem to r_sign_add_item and add r_sign_get_item ##signatures (#17691) 2020-09-22 14:09:17 +02:00
pancake
c9e98e4645
Implement tcc-* commmand to unload all calling conventions ##anal (#17688) 2020-09-22 10:03:37 +02:00
Anton Kochkov
b905e7a3b0
Fix forward declaration of RCore (#17689) 2020-09-22 09:40:06 +02:00
junchao-loongson
ca9b6ac1a0
Set asm.cpu for mips.gnu derived from the ISA defined in the ELF ##bin (#17555) 2020-09-21 16:58:07 +02:00
Aswin C
61a1e15af5
Fix rj and add tests (#17682) 2020-09-21 16:17:33 +02:00
pancake
e33535080d
Allow to set asm.bits when using the r2ghidra asm/anal plugins ##disasm (#17679) 2020-09-21 16:10:32 +02:00
Kārlis Seņko
7042ae727b Refactor r_str_split_lines to use size_t. 2020-09-21 07:48:17 +03:00
Kārlis Seņko
d02e74485f Fix leak in dwarf processing. 2020-09-21 07:48:17 +03:00
pancake
2cf9c91518
Implement tms320.pseudo to fix another arm64 test ##asm (#17613)
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2020-09-21 11:51:04 +08:00
Dennis Goodlett
61d9be3ff1
Fix zig add type ##signatures (#17653)
Co-authored-by: Dennis Goodlett <dennis@hurricanelabs.com>
2020-09-21 00:04:05 +02:00
Florian Märkl
659f54aad1
Kill RAnal.sdb_fcnsign (#17669) 2020-09-19 17:24:45 +02:00
Florian Märkl
3d9ce08c19
Fix RAnalFunction leaking imports (#17670) 2020-09-18 08:50:36 +02:00
GustavoLCR
6fb41501ff Minor optimization for type analysis
* Reserve a big enough hashtable to avoid rehashing
2020-09-18 00:21:59 +02:00
GustavoLCR
b5eb956ba2 Don't pollute debug trace after aft 2020-09-18 00:21:59 +02:00
pancake
51c83e01f3
Implement r_str_cat and other random code cleanups (#17632) ##util 2020-09-18 00:20:26 +02:00
pancake
75d80417e1
Fix glitch when asm.hint.pos < 1 in visual ARM ##disasm (#17667)
Co-authored-by: pancake <pancake@nopcode.org>
2020-09-17 18:48:05 +02:00
Aswin C
549784d73f
Implement rj ##json (#17443) 2020-09-17 18:10:07 +02:00
junchao-loongson
17a1cf6a77
Fix anal_mips_cs some compile warning (#17664) 2020-09-17 17:54:33 +02:00
karliss
0222bfe238
Use sdb_set instead of sdb_querys (aaaa is now 7x faster) (#17640) ##performance 2020-09-17 14:15:41 +02:00
pancake
3e5677bd7c Refactor and prefix with R_BIN_ELF_ defines in .h ##bin 2020-09-17 12:38:25 +02:00
pancake
ba9960cffd Dynamic ELF libs can also have relocs ##bin
* Make 32 and 64 bit reloc writes more generic
2020-09-17 12:38:25 +02:00
pancake
63031cc3e9 Add basic support for arm and arm64 ELF relocs ##bin 2020-09-17 12:38:25 +02:00
pancake
b261f2ed5d Define as words more sections in ELF ##bin 2020-09-17 12:38:25 +02:00
Riccardo Schirone
159b63e9a7
Correctly check whether esil_str is available (#17660) 2020-09-17 09:31:28 +02:00
pancake
f15f1af521
Fix spacing bugs when parsing the calling convention signatures (#17651) ##types 2020-09-16 19:17:54 +02:00
pancake
413437e2b6
Move arp gdb into arpg, improve error and parsing + tests ##debug (#17658) 2020-09-16 19:16:24 +02:00
Khairul Azhar Kasmiran
73317d4955
r_reg_get_bytes: Return NULL if there are no bytes in the arena for the given regset type (#17657) 2020-09-16 18:14:43 +08:00
Florian Märkl
178f69b643
Refactor Labels out of SDB ##anal (#17621) 2020-09-16 09:54:33 +02:00
Riccardo Schirone
75a80741ee
Make root a argv RCmdDesc ##newshell (#17326) 2020-09-15 15:27:10 +02:00
Florian Märkl
456b0fdf09
Add API for getting Atomic and Typedef Types and remove broken !size (#17599) 2020-09-15 13:31:38 +02:00
Keegan S
36e9314832
Fix #17638 - Fix http server by using TCP in RSocket's protocol ##remote (#17641)
Co-authored-by: meme <meme@users.noreply.github.com>
2020-09-15 11:22:04 +02:00
pancake
797b937175
Implement touch command ##shell (#17645) 2020-09-15 11:11:41 +02:00
Khairul Azhar Kasmiran
d9057505dc
Set RPATH/RUNPATH on r2 libs too if local (#17639) 2020-09-15 09:16:14 +02:00
pancake
2ad2744796
Implement arcc command using the new r_reg_profile_to_cc API ##types (#17618) 2020-09-15 00:59:56 +02:00
pancake
18af675e05
Show ESIL execution cost information in ao and aoj ##anal (#17585) 2020-09-14 10:44:19 +02:00
pancake
4249c71e82
Parse ansi->html properly in pdJ ##disasm (#17628) 2020-09-14 10:21:31 +02:00
Anisse Astier
50eac99601
Add minimal armv7 and aarch32 VFP and NEON support ##esil (#17462) 2020-09-14 09:57:05 +02:00
Dennis Goodlett
67cc898770
Fix multiple bugs in matching ##signatures (#17607)
Co-authored-by: Dennis Goodlett <dennis@hurricanelabs.com>
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2020-09-13 23:11:29 +02:00
GustavoLCR
5c96166e2b
Fix MSVC template demangling with ref to mangled symbol (#17601) ##bin
* Fix not adding the template name as an abbreviation
* Add test
2020-09-13 22:38:51 +02:00
Francesco Tamagni
67e79f0bb3 Fix ObjC ivar parsing ##bin 2020-09-13 22:36:38 +02:00
Francesco Tamagni
3c4fc3fc26 Support ObjC small method lists ##bin 2020-09-13 22:36:38 +02:00
Francesco Tamagni
90f4ba69b5 Support iOS 14.x dyld shared cache ##bin 2020-09-13 22:36:38 +02:00
Francesco Tamagni
e74b004239 Add support for new macOS kernelcache ##bin 2020-09-13 22:36:38 +02:00
Florian Märkl
ceac3124fb
Add r_strbuf_initf() ##util (#17634) 2020-09-13 10:08:56 +02:00
Aswin C
871857df1a
Use PJ in iAj ##json (#17636) 2020-09-13 09:58:17 +02:00
Florian Märkl
5ccf9fd482
Fix heap oob read in bbget() (#17633) 2020-09-12 13:59:26 +02:00
pancake
dc6a06b75e
Implement RCons.setTitle() for Windows and add ?et command ##cons (#17624)
* 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>
2020-09-11 21:28:09 -05:00
Khairul Azhar Kasmiran
fe5b80d615
Fix asan r2pipe test by updating libasan and using LD_PRELOAD (#17594)
* 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
2020-09-11 18:47:27 +08:00
Riccardo Schirone
ec21daa6c2
Fix crash when running iA while head_flag is not defined (#17630) 2020-09-11 11:41:09 +02:00
Aswin C
f16a5b1ab7
Remove an unnecessary blank space in c? ##cons (#17620)
* Remove an unnecessary blank space in `c?`
* Sort the help messages in `c?`
2020-09-10 12:01:33 +08:00
pancake
6ead7f0eea
Avoid close(-1) in r2pipe (#17617)
* Do not close(-1)
* Remove commented code

Co-authored-by: pancake <pancake@nopcode.org>
2020-09-10 11:56:58 +08:00
pancake
226517b516
Implement ?== operator to compare strings ##shell (#17612) 2020-09-09 15:51:11 +02:00
pancake
f21ebbf85a
Fix #17558 - Honor hex.offset in prc, pxAv and p=e ##print (#17615) 2020-09-09 15:50:37 +02:00
Anisse Astier
a4c76ff641
Bring merge sort and insertion sort cmp function semantics together (#17473) ##util
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.
2020-09-09 15:45:34 +02:00
Riccardo Schirone
2318e1afcc Use SSL_get_error only if SSL is being used 2020-09-09 15:39:33 +02:00
Riccardo Schirone
3e3efcc005 Test compilation with various capstone versions ##build
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).
2020-09-09 15:39:33 +02:00
pancake
410db8175b
x86.as is only suposed to work on x86, add env var for custom use ##asm (#17610)
Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2020-09-09 16:41:28 +08:00
Dennis Goodlett
e4653e5d31
Remove r_sign_item_dup ##signatures (#17608) 2020-09-09 09:59:59 +02:00
pancake
63b4c48f61
Fix all the projects tests failing with asserts (#17609) 2020-09-08 15:48:28 +02:00
junchao-loongson
e51bf7a980
Improve mips.cs esil (fix mips32, update mthi) ##anal (#17595) 2020-09-08 11:59:57 +02:00
Riccardo Schirone
272265a4c3
Fix ELF R_X86_64_PLT32 relocation entries patching (#17587) ##bin
* 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
2020-09-08 09:52:35 +02:00
Zi Fan
9e38afe782
Fix clang-cl build error (#17604)
Co-authored-by: Zi Fan Tan <zifan.tan@sjsu.edu>
2020-09-07 19:55:28 +02:00
Anisse Astier
0f6b27f62f
Variable printf arguments: let compiler help with formatting (#17461)
Attribute supported by both GCC and Clang.
2020-09-07 18:38:36 +08:00
junchao-loongson
9c17df8df3
Fix ESIL sign extension operator bug ##esil (#17578) 2020-09-07 12:30:13 +02:00
FXTi
0c35a4443e
Extend ESIL VM's stack size from 32 to 256. (#17566) ##esil 2020-09-07 12:17:51 +02:00
Zi Fan
ea1151d143
Escape environment vars in the default rarun profile (#17441) ##debug 2020-09-07 11:16:57 +02:00
Dennis Goodlett
e7b86490e1
Disable offset zig by default ##signautres (#17591) 2020-09-06 20:50:21 +02:00
GustavoLCR
70ab5c8e88
Fix null deref in fuzzed xtr after 080bf4918c (#17602) 2020-09-06 14:28:09 +02:00
Florian Märkl
7f0bc9b418 Rename r_anal_base_type fcns and update usages 2020-09-06 12:36:42 +02:00
Florian Märkl
d1bcbcf041 Move member initialization of RAnalBaseType to new 2020-09-06 12:36:42 +02:00
pancake
737eacdc13
Implement aof comment to filter esil expression using the DFG API ##esil (#17600) 2020-09-06 12:36:17 +02:00
GustavoLCR
080bf4918c
Fix #17590 - Fix invalid deref in print_types_format (#17592)
Make sure streams are in their proper index for `r_list_get_n` by appending a NULL item when necessary
2020-09-05 19:04:41 +02:00
David CARLIER
15e73666b2
Implements r_sys_aslr for NetBSD ##port (#17588)
ASLR on NetBSD is also settable via sysctl call.
2020-09-04 21:52:16 +02:00
GustavoLCR
52d5b867aa
Fix step over for windbg plugin (#17586) 2020-09-04 15:56:11 -03:00
pancake
052f97dd24
Fix #17506 - r2 http://example.org works again ##io (#17514) 2020-09-04 16:01:03 +02:00
Riccardo Schirone
f8d6db74b5
Split cmd_write function to make it easier transition to argv style (#17370) 2020-09-04 14:36:39 +02:00
GustavoLCR
f46b1749b3
Fix #17581 - Fix append to file on Windows (#17584)
* Fix append to file on Windows

* Test from @ret2libc
2020-09-03 19:13:42 -03:00
Khairul Azhar Kasmiran
a08337f7c7
Fix 'anal && op && len > 0' assertion in asan build (#17579)
* Check for 'i < iend' at end of r_core_anal_esil loop

* Use 'cur_addr >= ctx->end_addr' instead as per @ret2libc
2020-09-03 23:45:47 +08:00
Alexis Ehret
22482f6ac3
Fix 2 last critical LGTM errors (#17451)
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2020-09-03 16:23:19 +08:00
mscherer
42f90d5df5
Return empty string when slurping a empty file (#17520) 2020-09-03 09:46:17 +02:00
pancake
4d2a83e575
Fix #17492 - EOF when alt+e is pressed on Linux systems ##cons (#17513) 2020-09-03 09:00:25 +02:00
pancake
74c4a36656
Fix 'call start' register confusion warning ##asm (#17573)
Co-authored-by: pancake <pancake@nopcode.org>
2020-09-03 14:45:09 +08:00
junchao-loongson
dd8204ac35
Fix the translation error of MIPS SRA instruction to ESIL ##anal (#17562) 2020-09-03 12:39:54 +08:00
VVS
992404ade9
Fix ESIL movi.n immediate value parsing ##emu (#17557)
Co-authored-by: BlackVS <vvs@coders.in.ua>
2020-09-03 11:33:23 +08:00
Dennis Goodlett
749b2e7095
Add zb score threshold variable ##signatures (#17545) 2020-09-03 10:52:21 +08:00
GustavoLCR
2128795d94
Takeover variables when splitting functions ##anal (#17560) 2020-09-03 07:44:36 +08:00
junchao-loongson
31c525b14a
Fix GP calculation when there are multiple entries ##anal (#17538) 2020-09-03 07:43:24 +08:00
Riccardo Schirone
abfda31e66
Fix a bunch of warnings (#17575) 2020-09-02 19:54:17 +08:00
GustavoLCR
62eb8e62da
Fix afvd using wrong var offsets (#17572) 2020-09-02 13:49:14 +02:00
HoundThe
eca62ba4db
Fix big endian DWARF parsing ##bin (#17503) 2020-09-02 11:01:16 +08:00
HoundThe
2b96c39e90
Don't add already existing parent class ##anal (#17537) 2020-09-02 10:58:15 +08:00
Riccardo Schirone
8344b7c304
Rename new json parser file to json_indent to avoid collisions (#17569) ##build
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.
2020-09-02 04:56:54 +02:00
David CARLIER
46874bae17
Fixes r_sys_pid_to_path for Haiku using proper team_id/pid_t ##util (#17571) 2020-09-02 04:55:56 +02:00
Anton Kochkov
43feee7a51
Fixes for old glibc (Debian Etch) (#17564) 2020-09-01 17:05:50 -05:00
aemmitt-ns
ec173d40d6
ESIL signedness and other extensions ##esil (#17436)
* 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
2020-09-02 00:03:24 +02:00
GustavoLCR
443fc06500
Fix wrong calling convetion in io_windbg.c (#17570) 2020-09-01 17:02:08 -05:00
abcSup
d967a68bce Bring back aets+ and aets- commands 2020-09-02 06:00:38 +08:00
abcSup
16c5017898 Fix ESIL tracing to be consistent with debug tracing ##anal 2020-09-02 06:00:38 +08:00
HoundThe
f01711583a
Fix compilation warnings ##dwarf (#17544) 2020-09-01 00:48:03 +08:00
Khairul Azhar Kasmiran
580f1e97bd
Propagate parse_ext_opcode() error (#17559) 2020-09-01 00:45:47 +08:00
meowmeowxw
3ffe3f88d2
Add commands to parse mangling pointers glibc heap ##heap (#17534)
* 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
2020-09-01 00:45:12 +08:00
GustavoLCR
7e28739835
Expose TEB address as a flag on Windows ##debug (#17551)
* Also log the TEB address on thread start
2020-08-31 14:52:03 +08:00
GustavoLCR
2d91290434
Fix some cc assertions (#17552) 2020-08-31 12:43:21 +08:00
Khairul Azhar Kasmiran
ef0beed4b1
fcn_recurse: Fix dangling pointers if r_anal_op's setting of asm.bits is fully processed (#17547) 2020-08-30 12:15:31 +08:00
HoundThe
0b671bc357
Fix resource leaks in dwarf.c and dwarf_process.c (#17521) 2020-08-28 23:18:49 +08:00
Khairul Kasmiran
730e4b11bc r_reg_get_name_idx: Don't treat empty reg name differently from other invalid reg names 2020-08-28 23:14:09 +08:00
Anton Kochkov
14bc6586fc Fixes for <=glibc-2.2 versions 2020-08-28 23:04:39 +08:00
pancake
e54b8d0092 Rename bin.demanglecmd to cmd.demangle ##config 2020-08-28 20:34:44 +08:00
Riccardo Schirone
850bf37886
Fix #17494 - Pass the whole input string to r_core_cmd_str_pipe ##newshell (#17533)
* 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
2020-08-28 13:13:23 +02:00
junchao-loongson
087e5652b3
Improve iA command for MIPS/ELF ##bin (#17516) 2020-08-28 11:11:34 +02:00
Dennis Goodlett
e5a979fc01 Honor zign vars in zbr ##signatures 2020-08-28 13:30:39 +08:00
Dennis Goodlett
43586303d2 Add NULL deref gaurd on empty bbs list 2020-08-28 13:30:39 +08:00
junchao-loongson
ac1f0d13b5
Fix #9821 - Add JALR JR shortcat support when the target address can be calculated ##anal (#17498) 2020-08-28 13:30:17 +08:00