Commit graph

10197 commits

Author SHA1 Message Date
pancake
5186afdbe4 Only attach io.pid when its different 2016-06-16 22:56:02 +02:00
pancake
4e67a31087 Fix some more =!pid cmd parsing issues 2016-06-16 22:53:16 +02:00
pancake
565c97f8f5 Fix =!pid for io.w32dbg 2016-06-16 22:53:10 +02:00
Joshua J. Drake
fb820f9c8e Fixes #4875: Refactor process listing (#5144)
* Fixes #4875: Refactor process listing
* Move procfs-based process listing into linux_debug.c, guarded by __linux__
* Provide a warning and eprintf a TODO on the remaining platforms.
* Break reusable parts into linux_get_proc_pid and call it as needed.
* Add/remove comments for clarity
* Address feedback and re-enable non-Linux
2016-06-16 22:39:11 +02:00
Lev Aronsky
db8414d186 Fixed order of arguments in ESIL representation of MUL. 2016-06-16 22:33:16 +02:00
UsusDei
5e7c93fc37 Add asm.hints and handle CDOV deoptimization
CDIV deoptimization
===================

This patch implements hints in the disassembler that
aim to assist the user in reading compiler-optimized divisions
by analysing the involved magic number.

Background
==========

Since integer divisions are usually very expensive on most architectures,
compilers try very hard to substitute them with cheaper operations.

One of the more advanced substitutions is described in the book __Hacker's Delight__,
chapter 10.
An actual implementation of the described algorithm in LLVM can be found in the
functions: `TargetLowering::BuildSDIV()` and `APInt::magic()`.

The optimization approximately transforms e.g.

```asm
xor edx, edx
idiv 39
```

into

```asm
mov eax, edi
mov edx, 0xd20d20d3
imul edx
lea eax, [rdx + rdi]
sar edi, 0x1f
sar eax, 5
sub eax, edi
```

Reading the optimized version and __seeing__ the constant 39 seems difficult.
Therefore I try to provide a small hint to the user.

Limitations
===========

* The current implementation only takes the magic number into account,
  therefore it may result in false positives.

* Due to the nature of the optimization, the given hint may be off by a power of two.
  Fixing this would require to analyse the following shift instructions.

* The hint is only shown in the line containing the magic number.
  The user still has to know which of the following instructions belong to the optimization.

TODO
====

* Implement the corresponding analysis for unsigned integers

* Implement the corresponding analysis for 64-bit integers.

* Improve the heuristic by also looking at the next few instructions.
  ( I don't really know how to iterate over the instructions in the disassember
  in a non-deprecated way. Maybe someone can drop me a hint? )

* Implement an exact analysis using the actual dataflow in radeco and use it
  to revert the optimization. ( I suppose this is outside the scope of radare )
2016-06-16 22:22:58 +02:00
pancake
48e5f8fc7e Fix ELF crash (null deref when missing shdr 2016-06-16 22:18:10 +02:00
Joshua J. Drake
176054c006 Fix ELF section size validation (#5148) 2016-06-16 16:43:04 +02:00
Joshua J. Drake
285cd3b32f Minor tweaks to breakpoint handling
* Fix "dbm" help string
* Save <module>+<offset> as the name when using dbm
* Fix allocation patterns for "module"
* Remove commented out code
* White space fixes
2016-06-16 12:36:17 +02:00
pancake
d3cae9d5a9 Show classname for static methods in DEX 2016-06-16 12:30:38 +02:00
pancake
b843aaf054 Fix imports and enhance parsing virtual methods in DEX 2016-06-16 05:04:00 +02:00
pancake
1111c00ea2 Better names for virtual Dalvik methods 2016-06-16 02:42:54 +02:00
pancake
b50a06f57c Load virtual methods from Dex files 2016-06-16 02:33:59 +02:00
pancake
5c14841299 Support op->family and some op->cycle for anal.arm64 2016-06-16 01:43:41 +02:00
Jeffrey Crowell
2f6d778aef cleanup usages of r_str_newf to meet style guide 2016-06-15 19:42:03 +00:00
Sven Steinbauer
d45101eebe Add offset support to add instruction (#5137)
support syntax for

add eax, [ecx]
add ecx, [eba +/- 3]
2016-06-15 15:33:14 +02:00
pancake
794c60bf18 Fix #5138 - huge load times for fuzzed versioninfo ELFs 2016-06-15 15:30:51 +02:00
pancake
0e9e80c578 Fix #5138 - crash in elf parser 2016-06-15 15:13:41 +02:00
pancake
84aa6782f1 Add trailing newline in afbj 2016-06-15 13:41:45 +02:00
Riccardo Schirone
04190287c1 core: fix uber confusing indentation in cmd_anal "afl" command 2016-06-15 11:15:42 +02:00
pancake
1bdcb740dc Fix regressions introduced in last commit 2016-06-15 00:23:44 +02:00
pancake
e032a48cbe Fix latest 26 COVs 2016-06-14 23:47:58 +02:00
Álvaro Felipe Melchor
7fa01a72ed add breakpoints into project file 2016-06-14 23:34:42 +02:00
pancake
2582e5fd0e Fix #5134 - rahash2 -K entropy was randomized by uninitalized values 2016-06-14 20:29:49 +02:00
robbje
a772452d27 Cgs (#5126)
* refactor function listing code

* adhere to style guide

* use tabs instead of spaces

* recover default behaviour for afi commands

* work in commentary and fix the two regression tests I broke

* some more cosmetic changes

* shorten function names
2016-06-14 17:54:17 +02:00
pancake
f5cb1db49b Fix identifying classes#.dex as DEX (not a BIOS) 2016-06-14 17:00:42 +02:00
pancake
6bd3f5199b Fix #4980 - Fix apk:// and implement ipa:// 2016-06-14 14:36:15 +02:00
pancake
e4af7f9b23 Fixes for ELF/Thumb detection handling 2016-06-14 14:36:03 +02:00
pancake
ecef139c99 Fix io.ptrace.write on ARM 2016-06-10 05:27:21 +02:00
pancake
1bb7efd76c Some more COV checks in socket.run 2016-06-14 04:00:30 +02:00
pancake
21a01d08fe Fix warnings in debug.linux.coredump 2016-06-10 04:20:28 +02:00
pancake
e9f14cb4a0 Fix 4b85cff331 util.calc regression 2016-06-14 03:22:43 +02:00
pancake
8d9e4a7836 Fix double close in thread-list and non-null terminated string in debug.linux.core 2016-06-14 03:10:47 +02:00
pancake
7ff42b590f Fix build and bring back java memleak to avoid crash 2016-06-14 02:54:27 +02:00
pancake
69e7b3df28 Fix UAF in bin.psxexe 2016-06-14 02:44:52 +02:00
pancake
59f94c63aa Fix some critical COVs in RBin 2016-06-14 02:42:24 +02:00
pancake
69d62e85c3 Fix deadcode in rbuf 2016-06-14 02:30:22 +02:00
pancake
46433dbf53 Fix some COVs in util/file 2016-06-14 02:22:14 +02:00
pancake
4b85cff331 Fix buffer overflow in r_num_math 2016-06-14 02:19:20 +02:00
pancake
010c2c68ab Fix all COVs in r_io 2016-06-14 02:14:52 +02:00
pancake
702394caf9 Fix string flags realignment in disasm 2016-06-14 01:52:46 +02:00
pancake
f8b5a6602a Boolify anal.xrefs/projects 2016-06-14 01:40:46 +02:00
pancake
56af25e5b5 Update r_core_sysenv_end 2016-06-14 01:33:46 +02:00
pancake
eda7899adc Various enhancements to aae 2016-06-14 01:30:40 +02:00
pancake
ed06c5bcb6 Fix arm64 analysis issue 2016-06-14 00:13:04 +02:00
radare
60ac486de1 Merge pull request #5117 from radare/arm-fixes
ARM fixes
2016-06-13 17:26:16 +02:00
pancake
e935aca270 Set esil->address before calling esil.parse 2016-06-13 15:05:48 +02:00
Ahmed Mohamed Abd El-MAwgood
0027246ec4 Fixing arguments docs 2016-06-13 13:09:46 +02:00
pancake
c883c0354f Simplify some arm esil expressions 2016-06-13 11:57:21 +02:00
pancake
3861032686 LDR PC is considered UJMP 2016-06-13 11:31:08 +02:00
pancake
8a82e5cae6 Implement 'cbz' in armass-thumb 2016-06-13 11:12:20 +02:00
pancake
3d9bea75ab Fixing some ARM regressions 2016-06-13 10:13:28 +02:00
pancake
889ff52f37 Bring back the previous disasm changes 2016-06-12 23:42:40 +02:00
pancake
b829244c19 Fixes for thumb/arm string references and endian refptr 2016-06-12 23:42:37 +02:00
Lukas Dresel
8f6c4716e0 Fixed 64bit enum support for structures where size was calculated incorrectly (#5122)
* Implemented 8 byte enumeration format size

Bug found with
po elf64
pf [4]? (elf_shdr)h

Notice how the name of the next section overlaps in address with the previous
section's entsize

* Adjusted coding style
2016-06-12 23:40:58 +02:00
Ahmed Mohamed Abd El-MAwgood
13d8e65426 Enhancing comments for vars/aegs (#5127)
Adding locality properity to variable and argument comments

the old implementation made use of the standard r_meta functions to create comments using the frame offset as the address. this caused problems because more than one function might have variable at the same offset (with respect to each ones stackframe). so they will overwride each others comments.

adding `base64:` feature

prevening CC from processing var/args comment (in wrong manner)
2016-06-12 23:39:40 +02:00
pancake
3081b3b5d6 Fix ? floating point values 2016-06-12 22:50:20 +02:00
Maijin
f3ee978361 Fix typo Cr -> Cv
@oddcoder
2016-06-11 12:55:09 +02:00
megabug
534cc69a79 Fix trimbits (#5120) 2016-06-11 12:09:39 +02:00
Ahmed Mohamed Abd El-MAwgood
b7c4d1eeb0 enabling Commenting using both index as well as name (#5118) 2016-06-11 11:07:58 +02:00
Jeffrey Crowell
7c3fb53a5e fix disassembling 'backwards'
(e.g. pd -5) producing wrong output

fixes #5105
2016-06-11 10:59:42 +02:00
Ahmed Mohamed Abd El-MAwgood
2d76ac0383 Implementing comments on arguments and vars (#5115) 2016-06-10 18:08:12 +02:00
Sven Steinbauer
deebcc5f46 Add check for 64bit overflow (#5116) 2016-06-10 17:02:51 +02:00
pancake
11fde024c0 Fix asm.emu issue 2016-06-10 16:31:37 +02:00
pancake
d1b5737a59 Add anal.vinfunr 2016-06-10 15:31:38 +02:00
pancake
b25c520428 Do not realign non-code ARM symbols (strings and such) 2016-06-10 12:18:32 +02:00
pancake
3ffffd367f Only show fcn bit mode if different than current one 2016-06-10 10:57:43 +02:00
Jeffrey Crowell
412f81590c note a caveat in r_str_ichr 2016-06-10 03:11:26 +00:00
Jeffrey Crowell
ef59d3aa7f make a note of TODO in str.c 2016-06-10 02:17:31 +00:00
Jeffrey Crowell
3e8a0cc693 replace usage of killed r_str_trim 2016-06-10 01:12:07 +00:00
Jeffrey Crowell
50417301a9 fix description of r_str_word_set0 2016-06-09 23:47:41 +00:00
Jeffrey Crowell
32037244ce kill r_str_trim 2016-06-09 23:43:46 +00:00
Jeffrey Crowell
4cd58acaca comment more string functions, kill some duplicated functions. 2016-06-09 23:43:46 +00:00
HummyPkg
b9aea669d3 Background web server does not honour port parameter 2016-06-09 23:43:42 +02:00
pancake
c65edef137 Always store fcn->bits info on analyze 2016-06-09 23:34:55 +02:00
pancake
91e6b11b11 Add another noreturn function for uclibc 2016-06-09 23:34:52 +02:00
Jeffrey Crowell
ed47ce4fb3 add missing ; in debug_native.c 2016-06-09 21:16:02 +00:00
leberus
6b1a46be23 Add: Generate Coredump - added support for threads and x86 (#5104)
* Add: Generate Coredump - added support for threads and x86

* Fix: debug_native.c allow coredump for i386 too
2016-06-09 22:23:39 +02:00
Joshua J. Drake
a4b21680d8 Re-work r_debug_native_map_get to fix issues (#5108)
* Fixes #4972
* Check more return values
* Improve error reporting
* Minor formatting fixes
2016-06-09 22:12:16 +02:00
pancake
2ca927caea Add anal.vinfun for aav (only grab values outside function boundaries) 2016-06-09 21:52:25 +02:00
Jeffrey Crowell
1b1578e25e fix accidental commit that broke hex2int 2016-06-09 18:40:52 +00:00
Jeffrey Crowell
98d258339a more r_util comments 2016-06-09 18:16:47 +00:00
Jeffrey Crowell
b4c39b5b35 begin adding some documentation to r_str functions
r_util needs some documentation if it is to be unit tested.
2016-06-09 17:42:27 +00:00
Álvaro Felipe Melchor
f018c2e727 Fix #5106 2016-06-09 18:17:51 +02:00
Jeffrey Crowell
4d5630ed30 make r_str_replace_char_once actually do only once 2016-06-09 00:11:59 -04:00
pancake
8340b342c4 Fix crash in last commit 2016-06-08 23:33:31 +02:00
Karol Harasim
df8fba3364 Get rid of global ESIL vars in disasm.c (#5102) 2016-06-08 21:16:00 +02:00
Jeffrey Crowell
a25ef5b3bb remove duplicate char counting functions in r_util 2016-06-08 16:40:44 +00:00
Ahmed Mohamed Abd El-MAwgood
000c602348 FIX #5096 (#5101) 2016-06-08 18:13:36 +02:00
reenz0h
832abcca8c pX command removal (#5099)
pX command is a left off from some old docs. Removing it from help message 'p?'
2016-06-08 12:43:07 +02:00
pancake
dba2fe70f0 Fix w32 build 2016-06-08 11:59:19 +02:00
pancake
10bbfc7d22 Trim strbits by block 2016-06-08 11:51:52 +02:00
pancake
6e68c8de6b Use /m as default webui on all platforms 2016-06-08 09:32:54 +02:00
Jeffrey Crowell
a1bdabf787 fix offbyone in r_str_bits64
manifested in odd numbers having leading 1
2016-06-08 01:48:43 -04:00
Jeffrey Crowell
0e688df308 style fixup for str.c r_util.h 2016-06-08 01:39:07 -04:00
Jeffrey Crowell
f92b37956a fix eval command truncating binary to 8 bits
closes #4975

add new function r_str_bits64 to convert any number to a 64bit binary
value.
2016-06-08 01:31:55 -04:00
pancake
8b78da200e Implement 'ecoj' command to list themes in JSON format 2016-06-07 23:19:42 +02:00
pancake
95af521700 Fix #5087 - properly reload project files 2016-06-07 22:38:29 +02:00
monosource
15f22752b4 Add _R to document pxA (#5095) 2016-06-07 14:00:48 +02:00
Sven Steinbauer
00e964e9b6 Add support to mov for negative immediates (#5090)
mov eax, -3
2016-06-07 12:23:44 +02:00
Sven Steinbauer
6e4a1b55b1 Error if moving 64bit val to 32bit reg (#5088)
mov eax, 0x1122334455667788 now errors if trying to assemble with -b64.
2016-06-07 11:01:35 +02:00
pancake
24aec5be8c Fix all latest COVs 2016-06-07 10:03:04 +02:00
pancake
0845add4cf Implement relocs for ELF-powerpc 2016-06-07 00:12:45 +02:00
pancake
e8b8831b83 Fix elf-ppc endian bit 2016-06-06 23:18:21 +02:00
Álvaro Felipe Melchor
ecb0734988 Fix #5069 2016-06-06 22:58:07 +02:00
pancake
eb9feef231 Fixes for powerpc endian in mach0 and other issues 2016-06-06 22:57:22 +02:00
Álvaro Felipe Melchor
649748a8f2 Fix #5074 2016-06-06 22:40:34 +02:00
pancake
6b3fea1344 Fix #5068 - stack overflow in bin.xbe 2016-06-06 17:42:56 +02:00
pancake
608b79d2b4 Finally fix the build on osx-ppc 2016-06-06 17:30:07 +02:00
pancake
4f51606b6d More osx-ppc build fixes.. 2016-06-06 16:55:15 +02:00
pancake
5903bc0d10 Fix #5083 - null deref in armass 2016-06-06 16:53:56 +02:00
pancake
bd5e22c17e Some more osx-ppc fixes 2016-06-06 16:20:03 +02:00
pancake
c04b32e6aa Fix GCC warning in anal.gb 2016-06-06 16:06:57 +02:00
pancake
b53d065504 Update sdb and cleanup r2pipe-w32 2016-06-06 14:40:58 +02:00
Karol Harasim
c1eb8253c2 Add support for 'pf [size]D' (#5063) 2016-06-06 10:36:09 +02:00
pancake
12d8fbca15 Fix crash in aoe 2016-06-06 10:16:26 +02:00
chinmaydd
68a7fb5ebd Adds initial support for aoe and aor 2016-06-06 09:49:48 +02:00
Ahmed Mohamed Abd El-MAwgood
7f48af3332 re construction argument/var commands (#5082)
afa for base pointer arguments/vars
afe for stack pointet arguments/vaes
afv for registers
fixing the J and \0 suffix
using the right register indexer
fixng the negative offsets of afa
fixing the afa afe afv views of pdf
fixing errors in aa
fixing the stack bases arg/var
fixing the varsub
fixing afa*
fixing afat
making afx- space neutral
enabling register renaming at varsub
updating the built-in help
adding r_reg as dependency for r_parse
2016-06-06 00:33:42 +02:00
oblique
f06e11b6f4 Fix warnings (#5078)
* Fix gcc warnings

* Fix strtoull return
2016-06-06 00:33:11 +02:00
Jack Baker
d3b85151ba Change inline asm constraints to "r" (#5065) (#5073) 2016-06-04 20:32:11 +02:00
oblique
5b13a92c50 behelit theme: Better color for swi (#5080) 2016-06-04 16:51:59 +02:00
pancake
fc058e7501 Honor escapechars in rarun2 setenv 2016-06-04 10:04:14 +02:00
dx
58c5a333c0 Fix a few anal leaks (#5076)
Mostly sdb_get() calls turned into sdb_const_get(), but there are
others.
2016-06-03 15:33:08 +02:00
pancake
2702c3f346 Initial regload support for linux-x32/64 coredumps 2016-06-02 14:16:57 +02:00
Anton Kochkov
24c0dfc961 Do not include coredump.h for non x86 2016-06-02 08:07:12 +03:00
Anton Kochkov
c7f1f7a87b Add missing header for linux coredump 2016-06-02 07:55:31 +03:00
Anton Kochkov
68ef35f635 Uniform name RUndos -> RIOUndos (for bindings) 2016-06-02 07:34:06 +03:00
pancake
d3394d5a7a Fix latest 28 COVs 2016-06-02 03:19:31 +02:00
pancake
03294af32b Fix null deref in libr_asm and add lang-python r2pm pkg 2016-06-02 02:45:38 +02:00
pancake
95b2e511f5 Fix some warnings 2016-06-01 12:23:10 +02:00
Rene Laemmert
2740e74e49 added cursor to undo seek history (#5054)
* added cursor to undo seek history

* cleanup the mentioned parts
2016-06-01 12:16:00 +02:00
Sven Steinbauer
63dd8590d7 Refactor mov assembly for nz (#5057)
* reg offset code consolidated to single location and simplified
* Refactor `getreg` for `arg` and `arg2` to use `r0` and `r1` throughout
        `mov` case

Should clean it up a little.
2016-06-01 12:15:33 +02:00
pancake
7ab3bbb91c Fix some trailing spaces in pf 2016-06-01 12:13:09 +02:00
pancake
88b71663c0 Fix more trailing spaces in dwarf and comments 2016-05-31 23:37:17 +02:00
pancake
f915412293 Fix some trailing spaces in asm.dwarf 2016-05-31 22:13:54 +02:00
Karol Harasim
d190e0d3c3 Add description for Xtensa instructions 2016-05-31 21:48:18 +02:00
pancake
2bd189255e Remove trailing spaces in px 2016-05-31 21:23:55 +02:00
Karol Harasim
b226545595 Fix use before initialization. (#5052) 2016-05-31 17:17:31 +02:00
pancake
2138ca700c Fix #5019 - registers are now accessible by index 2016-05-31 14:11:09 +02:00
Karol Harasim
cdd4f70814 Add support for pch (2 byte C dump mode) (#5047) 2016-05-31 13:35:31 +02:00
Álvaro Felipe Melchor
fa15260d21 some refactoring in pe format code (#5039) 2016-05-31 12:16:57 +02:00
Karol Harasim
92018cc381 Add ah. command to show hints in current offset. Fix ah? too. (#5045) 2016-05-31 11:50:35 +02:00
oblique
be4b061eda r_str_ansi_crop: Reset color on new line (#5048)
Fixes #5036
2016-05-31 11:50:12 +02:00
pancake
27ae76a7dc Show licenses in rlang plug listing 2016-05-31 10:39:34 +02:00
pancake
176a735927 Add cmdf callback and license in RLang 2016-05-31 02:32:30 +02:00
Álvaro Felipe Melchor
8939958569 Fix #5040
oob read in init_dynamic_section elf format code
2016-05-30 21:51:18 +02:00
pancake
c64eeaa266 Initial implementation of asm.assembler to select different assembler plugin than the disasm 2016-05-30 18:53:32 +02:00
pancake
e458901033 Fix jmptbl regression 2016-05-30 15:30:55 +02:00
pancake
cd776862ef Fix some trailing spaces in pc 2016-05-30 13:19:03 +02:00
Karol Harasim
c34181af02 Disasm refactorings. (#5043) 2016-05-30 12:35:39 +02:00
oblique
f8836c19b5 Fix glitch in disasm (#5031) 2016-05-30 04:22:20 +02:00
Duncan Ogilvie
216de66e68 fixed jcc (#5034) 2016-05-30 04:21:02 +02:00
Duncan Ogilvie
021a3ea8b2 Update x86 (#5035) 2016-05-30 04:20:29 +02:00
Duncan Ogilvie
18ffea18cc added/fixed various cmovXX opcodes (#5033)
As per the Intel manual:

```
CMOVcc - Conditional Move:
| Opcode          | Instruction       | Op/En| 64-Bit Mode| Compat/Leg Mode| Description                            
| 0F 47 /r        | CMOVA r16, r/m16  | RM   | Valid      | Valid          | Move if above (CF=0 and ZF=0).         
| REX.W + 0F 43 /r| CMOVAE r64, r/m64 | RM   | Valid      | N.E.           | Move if above or equal (CF=0).         
| 0F 42 /r        | CMOVB r16, r/m16  | RM   | Valid      | Valid          | Move if below (CF=1).                  
| REX.W + 0F 46 /r| CMOVBE r64, r/m64 | RM   | Valid      | N.E.           | Move if below or equal (CF=1 or ZF=1). 
| 0F 42 /r        | CMOVC r16, r/m16  | RM   | Valid      | Valid          | Move if carry (CF=1).                  
| REX.W + 0F 44 /r| CMOVE r64, r/m64  | RM   | Valid      | N.E.           | Move if equal (ZF=1).                  
| 0F 4F /r        | CMOVG r16, r/m16  | RM   | Valid      | Valid          | Move if greater (ZF=0 and SF=OF).      
| REX.W + 0F 4D /r| CMOVGE r64, r/m64 | RM   | Valid      | N.E.           | Move if greater or equal (SF=OF).      
| 0F 4C /r        | CMOVL r16, r/m16  | RM   | Valid      | Valid          | Move if less (SF!= OF).                 
| REX.W + 0F 4E /r| CMOVLE r64, r/m64 | RM   | Valid      | N.E.           | Move if less or equal (ZF=1 or SF!= OF).
| 0F 46 /r        | CMOVNA r16, r/m16 | RM   | Valid      | Valid          | Move if not above (CF=1 or ZF=1).      
| REX.W + 0F 42 /r| CMOVNAE r64, r/m64| RM   | Valid      | N.E.           | Move if not above or equal (CF=1).     
| 0F 43 /r        | CMOVNB r16, r/m16 | RM   | Valid      | Valid          | Move if not below (CF=0).              
| REX.W + 0F 47 /r| CMOVNBE r64, r/m64| RM   | Valid      | N.E.           | Move if not below or equal (CF=0 and   
|                 |                   |      |            |                | ZF=0).                                 
| 0F 43 /r        | CMOVNC r16, r/m16 | RM   | Valid      | Valid          | Move if not carry (CF=0).              
| REX.W + 0F 45 /r| CMOVNE r64, r/m64 | RM   | Valid      | N.E.           | Move if not equal (ZF=0).              
| 0F 4E /r        | CMOVNG r16, r/m16 | RM   | Valid      | Valid          | Move if not greater (ZF=1 or SF!= OF).  
| REX.W + 0F 4C /r| CMOVNGE r64, r/m64| RM   | Valid      | N.E.           | Move if not greater or equal (SF!= OF). 
| 0F 4D /r        | CMOVNL r16, r/m16 | RM   | Valid      | Valid          | Move if not less (SF=OF).              
| REX.W + 0F 4F /r| CMOVNLE r64, r/m64| RM   | Valid      | N.E.           | Move if not less or equal (ZF=0 and    
|                 |                   |      |            |                | SF=OF).                                
| 0F 41 /r        | CMOVNO r16, r/m16 | RM   | Valid      | Valid          | Move if not overflow (OF=0).           
| REX.W + 0F 4B /r| CMOVNP r64, r/m64 | RM   | Valid      | N.E.           | Move if not parity (PF=0).             
| 0F 49 /r        | CMOVNS r16, r/m16 | RM   | Valid      | Valid          | Move if not sign (SF=0).               
| REX.W + 0F 45 /r| CMOVNZ r64, r/m64 | RM   | Valid      | N.E.           | Move if not zero (ZF=0).               
| 0F 40 /r        | CMOVO r16, r/m16  | RM   | Valid      | Valid          | Move if overflow (OF=1).               
| REX.W + 0F 4A /r| CMOVP r64, r/m64  | RM   | Valid      | N.E.           | Move if parity (PF=1).                 
| 0F 4A /r        | CMOVPE r16, r/m16 | RM   | Valid      | Valid          | Move if parity even (PF=1).            
| REX.W + 0F 4B /r| CMOVPO r64, r/m64 | RM   | Valid      | N.E.           | Move if parity odd (PF=0).             
| 0F 48 /r        | CMOVS r16, r/m16  | RM   | Valid      | Valid          | Move if sign (SF=1).                   
| REX.W + 0F 44 /r| CMOVZ r64, r/m64  | RM   | Valid      | N.E.           | Move if zero (ZF=1).
```

* fixed typo

* or -> nor
2016-05-30 04:20:19 +02:00
oblique
238cf897b8 Fix ptr comment colorization (#5032) 2016-05-30 04:20:04 +02:00
pancake
4de809061a Add MJMP optype, pxt command and enhance anal.jmptbl for x86-64 (wip) 2016-05-30 04:18:48 +02:00
pancake
71537eedf0 LEA instructions get hotkeys in visual disasm too 2016-05-30 02:12:17 +02:00
pancake
16d0396b8f Fix /A, add MJMP optype, and op.reg for UJMP 2016-05-30 00:38:35 +02:00
Álvaro Felipe Melchor
c1d2e0223e Fix #5037
oob write in anal_x86_cs.c
2016-05-29 21:51:41 +02:00
Ahmed Mohamed Abd El-MAwgood
0c2b3d7391 removing trailing spaces from t commands (#5028) 2016-05-29 11:37:59 -04:00
Sushant Dinesh
f5ca358aee Fixes x86 to ESIL lifting memory operands (#5029)
Closes #5027
Closes #4431
2016-05-29 12:11:04 +02:00
Chinmay Deshpande
1cffc55fe0 Adds autocompletion for afan (#5016)
* Adds autocompletion for afan

* Removes duplication
2016-05-29 10:38:17 +02:00
pancake
78a26275e1 Monitor opcodes are not traps in dalvik 2016-05-29 01:35:41 +02:00
oblique
dc8bf4d6e8 Add 'floc' in palette's keys (#5025) 2016-05-29 00:06:12 +02:00
oblique
f4e81720b6 Add behelit theme (#5026) 2016-05-28 23:04:30 +02:00
oblique
d692aa441e lookup_rgb now looks for the extended colors only
We do this because non-extended colors usually are used by users
to change the theme of their terminal, so they will be different from
the default ones.
2016-05-28 14:58:28 +02:00
oblique
e6381db6b4 Initialize 256 color table in the correct place
Because `color_table` was initialized only in `unrgb`, `rgb` was returning
values only from `approximate_rgb`. So if we call `rgb(0x5f, 0x87, 0xff)` it
will return `75` (i.e 5fafff) instead of `69`.
2016-05-28 14:58:28 +02:00
oblique
416edaea45 ANSI 256 colors have RGB values from 0 until 5 inclusive, not 0 until 6 2016-05-28 14:58:28 +02:00
Sven Steinbauer
c58689bae1 Fixes for mov op for nz assembler (#5020)
A number of fixes and updates to the `mov` command for the nz assembler
including:

* handling of `esp` register in more cases
* able to handle negative offsets for target register both byte and word
* able to handle negative offsets for target with immediate value as
        source, both byte and word
* refactor mov block of code to be more consistent (further work needed)
2016-05-27 18:11:01 +02:00
hummypkg
60a7e601cc add some missing MIPS pseudo instructions, fix others (#5022) 2016-05-27 16:12:27 +02:00
@bezjaje
dcac88091b Fixed typo in setting "gp" value in disasm (#5017) 2016-05-27 13:24:42 +02:00
pancake
62ca3a6d63 Fix #5021 - dbc argument parsing issue 2016-05-27 13:14:43 +02:00
Sushant
86b19bf7df Fixes esil mips signed compare 2016-05-27 15:56:20 +05:30
Sushant
75adfbdc6c Fixes esil signed comparisons when size != 64 2016-05-27 15:21:03 +05:30
Sushant Dinesh
b7a81e88b2 Fixes esil comparison instructions and of computation (#5015)
- esil comparison functions esil_(bigger/smaller/bigger_eq/smaller_eq/cmp) are
now consistent in setting vars for flag computation as well as pushing the
result of a signed comparison onto esil stack.
2016-05-26 18:38:40 +02:00
Ahmed Mohamed Abd El-MAwgood
f65e56364a Adding colors to r2 2048 (#4994) 2016-05-26 16:58:02 +02:00
Karol Harasim
be26c2d402 Increase DEBUG_ABBREV_CAP from 16 to 32. (#5014) 2016-05-26 16:57:29 +02:00
Sushant Dinesh
2adcea4a85 Esil internal set (#5012)
* Generalizes set/unset

- This commit makes set/unset more generic by allowing any value to be assigned
to a register (as opposed to just 0/1 before) without any side effects.
- $[0-9]* represents a value to be set, in decimal representation, without
having any side effects of changing esil vars old, cur and lastsz and hence
not affecting the flag computations. Example: Set rax to 100. ("$100,rax,=").
2016-05-26 16:56:46 +02:00
pancake
2d3a69b7a0 Fix linux-arm build 2016-05-26 12:29:24 +02:00
NikolaiHampton
2c50dd0c59 Memory efficient implemenation of Levenshtein Distance for radiff2 (add -V)
Implemented the iterative two matrix row version from here: https://en.wikipedia.org/wiki/Levenshtein_distance
and here: http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm

Memory usage was originally 200Gig for a couple of 100K files ~(sizeA*sizeB), now about ~(sizeB*2)...
2016-05-26 11:03:01 +02:00
@bezjaje
a38b176ba4 ESIL: poke_some bugfix (#5009)
* ESIL: poke_some bugfix

* + code style
2016-05-26 00:02:19 +02:00
pancake
132b173b87 Refactoring $B and decompose $F into $FB $FE $FS and $FI + code cleanup 2016-05-25 23:34:06 +02:00
Sergei Trofimovich
36db36f85e libr/socket/run.c: fix use of uninitialized value (#5010)
Noticed by gcc:
 * QA Notice: Package triggers severe warnings which indicate that it
 *            may exhibit random runtime failures.
 * run.c:65:5: warning: ‘p’ is used uninitialized in this function [-Wuninitialized]

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2016-05-25 22:00:52 +02:00
Roi Martin
45c36da9c3 Save scr.highlight in project files (#5008) 2016-05-25 18:20:50 +02:00
Sven Steinbauer
76a4e0ca7a Add support for immediate word for sub (#5006)
`nz` now generates the correct opcode when using a word as an immediate
in the `sub` instruction with a register + offset as the target

Also adds support for word register offsets and refactors that portion
of the code a little

For 32bit only so far
2016-05-25 17:22:00 +02:00
Roi Martin
6a07243934 Fix warning 2016-05-25 16:11:04 +02:00
Roi Martin
45efee7855 Do not output highlighted text when saving projects (#5004) 2016-05-25 16:03:41 +02:00
jvoisin
4b8af71ef4 Removed a duplicate loopne and loopnz entry
removed a duplicate `loopne` and `loopnz` entry
2016-05-25 15:24:13 +02:00
@bezjaje
3b7ab317f6 ESIL: generic endian-agnostic memory write in poke (#5001) 2016-05-25 10:37:33 +02:00
pancake
58cc6558ce Release 0.10.3 - codename: Bleeding Tooth 2016-05-25 01:32:30 +02:00
Roi Martin
66b53e049b Fix regression @.. 2016-05-25 01:24:52 +02:00
pancake
ba2011bdb9 Fix linux build on kernels < 3.2 2016-05-25 01:13:35 +02:00
pancake
18016c4ce7 Fix some warnings introduced recently 2016-05-25 00:44:41 +02:00
Sven Steinbauer
547f8bbc5c Infer fixes Round 2 (#4993) 2016-05-24 22:22:15 +02:00
ls80x
cf358e6c7d Listen patch 2016-05-24 21:47:21 +02:00
Jeffrey Crowell
2a77791616 add 64bit xchg instruction
still broken for the special case of xchg (E|R)ax, r(32|64)

but will add that next
2016-05-24 15:13:37 +00:00
Roman Valls Guimerà
6f66ba9b84 Typo "intro"->"into memory" (#4991) 2016-05-24 16:07:38 +02:00
pancake
d9636a9738 Fix some more clang analyzer warnings and cleanup 2016-05-24 14:54:34 +02:00
pancake
c36b299073 Fix some null deref and rarun2 chroot escape vuln 2016-05-24 12:32:45 +02:00
Anton Kochkov
41b7557ec8 Fix CID 1293557
Fix CID 1293561
Fix CID 1293546
Fix CID 1293547
Fix CID 1356007
Fix CID 1356016
Fix CID 1356015
Fix CID 1293558
Fix CID 1293565
2016-05-24 12:39:11 +03:00
Anton Kochkov
4ce37e8083 Fix CID 1356013, 1356012 2016-05-24 10:59:16 +03:00
Anton Kochkov
636a1fea00 Fix CID 1356011 2016-05-24 10:57:17 +03:00
Anton Kochkov
caade12229 Fix CID 1338307 2016-05-24 09:04:34 +03:00
Anton Kochkov
c9ef702fc7 Fix CID 1171363 2016-05-24 09:03:15 +03:00
Anton Kochkov
efc5a6bc23 Fix CID 1356009 2016-05-24 09:01:35 +03:00
Anton Kochkov
9ff4056539 Fix CID 1356017 2016-05-24 08:59:26 +03:00
Anton Kochkov
5bc6323591 Fix CID 1356008 2016-05-24 08:57:36 +03:00
Anton Kochkov
f6b18bcb56 Fix CID 1356018 2016-05-24 08:54:39 +03:00
Roi Martin
6dca1e31bb Avoid searching out of bounds 2016-05-24 03:13:06 +02:00
pancake
fc61108f72 Fix pvj - make /enyo and /p happy 2016-05-24 03:09:24 +02:00
pancake
613d7e488d Fix afvj | json_pp 2016-05-24 02:39:39 +02:00
pancake
86213ba555 Fix #4915 - avoid naming functions as registers 2016-05-24 01:47:09 +02:00
pancake
403b2c2257 Update release-notes script 2016-05-24 01:12:22 +02:00
Roi Martin
00626b9b02 Add temporary range operator @.. (#4986) 2016-05-23 23:41:39 +02:00
Álvaro Felipe Melchor
1f4e005991 added izqq/izzqq in r2 to list only strings 2016-05-23 22:54:00 +02:00
gk
0461e567e9 Fix #4927 - Add rabin2 -qqz to list only strings (no offsets or sizes) 2016-05-23 22:53:40 +02:00
pancake
b28d5e0a9c Fix android build 2016-05-23 21:54:42 +02:00
Álvaro Felipe Melchor
fb52d91d95 fix oob in seek line 2016-05-23 22:07:32 +02:00
Anton Kochkov
ab2db9544b Fix android build - never include <bits/uio.h> 2016-05-23 21:58:57 +03:00
andrey.torsunov
2c25a8d503 Reduce memory leak for commands: oo, doo 2016-05-23 20:17:41 +02:00
Sushant Dinesh
cf456f4414 Fixes to ESIL (#4951)
- Reverted ADD and ADC to set flags based on internal variables
- Fixed calculation of carry and zero flags from internal vars
- Revert "ESIL: add floating point instructions (#4794)"
  This reverts commit 964d12b392. Since we
  decided that floating point operations will be implemented using separate
  ops, these unions are no longer needed. This commit introduced a regression
  in setting esil->old and esil->cur
- Style fixes
2016-05-23 16:39:54 +02:00
pancake
6c35a016cf More fixes fore core-linux 2016-05-14 17:32:04 +02:00
Sven Steinbauer
8da8ad740f Cleanup fixes
* For commit comments and compiler errors
* Fixes for PR comments
* fix some "infer fixes" commits

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-23 11:25:44 +02:00
Sven Steinbauer
5cbcdf1da7 Infer fixes for bin
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-23 11:25:44 +02:00
Sven Steinbauer
599b6553e4 Infer fixes for asm
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-23 11:25:44 +02:00
Sven Steinbauer
9e6d4f2709 Anal infer fixes
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-23 11:25:44 +02:00
Sven Steinbauer
eef32d0260 First few fixes for infer scans
Fixes a few memleaks and several NULL dereferences

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-23 11:25:44 +02:00
Roi Martin
4cf81df3bc Fix #1476: respect search.from and don't seek on /m (#4973) 2016-05-23 11:25:17 +02:00
Oscar Salvador Vilardaga
89218c49af Fix useless pnote pointer and small fix in linux-core-dump 2016-05-23 11:24:14 +02:00
pancake
2f908ce238 Fix 22 covs in linux-core-dump 2016-05-23 11:19:29 +02:00
Roi Martin
ff24d2921c Fix #4205: hex search + binmask + small bs (#4970) 2016-05-23 00:07:25 +02:00
Ahmed Mohamed Abd El-MAwgood
23f4f00b78 fixing the tp (#4968)
bug
tp unsigned char * ebp + 0x25
it will be difficult to differ from the address and the type
but this way we will use `=` as way to differ
2016-05-22 12:28:05 +02:00
pancake
3c1462f876 Fix the tp test 2016-05-21 19:51:41 +02:00
zlowram
60b62560f1 Added anal hints to specify type base on disasm 2016-05-21 19:47:49 +02:00
pancake
0e04dbfe93 Fix #4954 - Fix crash in i8051 esil->reil 2016-05-21 16:27:11 +02:00
pancake
4de93b2703 Fix coredump file generation 2016-05-21 15:11:16 +02:00
pancake
7ad752f038 Remove the sandbox and fix more bugs in linux-core 2016-05-21 14:40:09 +02:00
pancake
64201e9c34 Fix format string for the linux-core 2016-05-21 14:35:43 +02:00
pancake
987020ece3 Fix build and more cleanup for linux-coredump 2016-05-21 14:13:33 +02:00
pancake
98246ac212 Fix memleaks, syntax, author and other bugs in linux-coredump 2016-05-21 13:36:33 +02:00
Oscar Salvador Vilardaga
876f3fd547 Initial coredump support for Linux-x86-64 (no threads yet)
* http://man7.org/linux/man-pages/man5/core.5.html
* Able to dump the header and the program headers
* Checks /proc/[pid]/coredump_filter to know which maps should be dumped
* Check for bit 6 to 0 (priv/share anon mappings, priv/share file-backed, elf hdr, priv/share huge pages)
* Missing: priv/share DAX pages
2016-05-21 12:27:13 +02:00
hummypkg
9043c1faeb Allow local variable detection for mips (#4960) 2016-05-21 12:24:42 +02:00
pancake
38d6822ebe Use negative arithmetic instead of ossitive overflow on arm64 displacement substract ESIL 2016-05-20 18:19:18 +02:00
pancake
b8af249dc4 Press any key in Vv: 2016-05-20 17:20:06 +02:00
pancake
1aff4b141d Fix #4959 - Fix linewrap in Vv 2016-05-20 17:11:29 +02:00
pancake
5ae9f9b17f Fix endian issue in the ELF parser 2016-05-19 17:28:01 +02:00
pancake
48d5e668eb No more linux-ppc blindfixing. This one is for real 2016-05-19 16:21:57 +02:00
Anton Kochkov
cc39d55be2 Fix PowerPC check in defines 2016-05-19 13:46:41 +03:00
pancake
52bfedc5ce Avoid null deref in info->arch 2016-05-19 12:30:20 +02:00
pancake
7f80a159c3 More powerpc blindfixing 2016-05-19 12:27:58 +02:00
Hamish Coleman
608c3b587f arcompact: Implement most carry codes (#4949) 2016-05-19 10:33:00 +02:00
pancake
a8d33e75a6 Add ?V? and ?Vq commands 2016-05-19 03:42:23 +02:00
Riccardo Schirone
23fee01ebd core/disasm: fix wrong reflines/fcnlines to the left of var/arg defs 2016-05-19 01:58:53 +02:00
Riccardo Schirone
8727840e90 anal/fcn: use getter/setter to access the size of a RAnalFunction
This is one of the first steps to improve analysis. This way we'll have
one single place to change if we want to change the meaning of the
"size" field. (size -> realsize)
2016-05-19 01:50:50 +02:00
Riccardo Schirone
8306463ae2 core/visual: fix cursor that jumps to wrong (next) instruction
When you use the cursor and press ENTER to jump to a target which is not
visible, it will go to the next instruction after the right target.
This patch should fix that behaviour.
2016-05-19 01:46:45 +02:00
pancake
c967514443 Add support for quiet and json listing of rasm2 -L and e asm.arch=? 2016-05-19 00:38:33 +02:00
pancake
b3093c516c Blind fix the powerpc debugger build 2016-05-16 08:37:40 +02:00
Jeffrey Crowell
f96f7802ae s/c-link/c-like in pdc help 2016-05-18 14:54:28 -04:00
hummypkg
a6bc0b39f5 Fix pseudo-code fro mult(u) - add mfhi, mflo, mul; implement ESIL mul op (#4943) 2016-05-18 15:58:04 +02:00
zlowram
bba1d404ca Added '?' message for wop command (#4942) 2016-05-18 15:50:24 +02:00
hummypkg
77a6d2a9f6 fix pseudo output for MIPS sw ... (xx) (#4941) 2016-05-18 14:15:28 +02:00
pancake
3973bc01a0 Fix #4926 - Add prz 2016-05-18 12:21:49 +02:00
pancake
4e9985d97c Initial work to support #4939 2016-05-18 12:19:27 +02:00
hummypkg
c54760269b Fix MIPS pseudo code for move op. (#4940) 2016-05-18 12:12:53 +02:00
pancake
6f243c47d7 Fix valgrind issues in Cs 2016-05-18 12:08:57 +02:00
pancake
3c0feea6cb Fixes for http.homeroot 2016-05-18 12:03:07 +02:00
Ahmed Mohamed Abd El-MAwgood
f7c47bf575 fixing all Use-after-free errors reported by llvm (#4924) 2016-05-18 11:41:12 +02:00
pancake
7f6029f17c Fix OR x86.nz test 2016-05-18 11:17:26 +02:00
pancake
2fd754a76c Fix #4938 - Implement 'or REG, NUM' in the x86.nz assembler 2016-05-18 10:48:48 +02:00
Sven Steinbauer
901b145f33 Inline r_swap_* functions [fix #4895] (#4902) 2016-05-18 10:13:26 +02:00
Hamish Coleman
afed79c033 Minor arc + arcompact cleanups and whitespace, ending with anal_arc fully indented (#4937) 2016-05-18 10:02:35 +02:00
Joshua J. Drake
79d57a4084 Don't override a user's cmd.prompt setting (#4933) 2016-05-18 10:01:39 +02:00
Jeffrey Crowell
1c69a920b6 rm free of iterator, fix leak 2016-05-17 23:44:14 -04:00
pancake
21bb0d8050 Fix Cs/Cz parameters parsing 2016-05-18 02:29:41 +02:00
Riccardo Schirone
bcf696ea14 core/cmd_meta: remove very old code that breaks metadata tests (#4935) 2016-05-18 01:26:12 +02:00
pancake
045faa6b10 Do not show xrefs in pds 2016-05-17 23:41:49 +02:00
pancake
f1a0a3eaab Fix black nodes problem with ag 2016-05-17 17:41:07 +02:00
aaSSfxxx
4362f17b1f Compute RIP-relative calls 2016-05-17 17:00:32 +02:00
pancake
f2ff8de7b9 Initialize proper fields of the RAnalOp.avr struct 2016-05-17 16:39:05 +02:00
Ahmed Mohamed Abd El-MAwgood
cd3ce9ab4e Fixing overflow in the string array 2016-05-17 14:44:52 +02:00
Riccardo Schirone
d102ed6732 core/visual: fix cmd_visual test case
Without this patch, if you run a visual command that involve the
cursor directly, the cursor will not be set.
2016-05-17 13:18:23 +02:00
Riccardo Schirone
5b92204c27 asm/arch/avr: do not print space if there are no operands 2016-05-17 13:18:23 +02:00
pancake
f11eac73a9 Fix calloc(0) in mach0 spotted by clang-analyzer 2016-05-17 12:23:39 +02:00
Riccardo Schirone
eb8e9aaad1 core/cmd_meta: it can build again 2016-05-17 11:17:29 +02:00
pancake
39947f0865 Fix #4912 - Add rarun2 option to specify timeout signal to be sent 2016-05-17 10:41:33 +02:00
pancake
2e06158c71 Handle -- in rarun2 2016-05-17 10:36:33 +02:00
Hamish Coleman
c80611e9bf Update anal_arc to more closely match the styleguide. (#4916)
Use the sys/indent.sh script and address most of the changes it suggests

* whitespace fixes
* change all the sex_nn stub functions to macros
2016-05-17 10:26:36 +02:00
@bezjaje
a254108be0 MIPS esil small fixes, this will unbreak esil/mips regressions (#4917)
+ fixed "sub" operands order
+ fixed "add" typo (was implemented using "-" instead of "+")
2016-05-17 10:25:38 +02:00
Anton Kochkov
c75b584c7e Fix CID 1355257 2016-05-17 10:15:51 +03:00
Anton Kochkov
f943afe94a Fix CID 1355259 2016-05-17 10:12:41 +03:00
pancake
34cd4f62b1 Fix pzF tests 2016-05-17 01:05:32 +02:00
pancake
8ffa7e2b62 Fix all p*0 tests 2016-05-17 00:37:47 +02:00
pancake
52b0b0141b Bring back the --true|false-- in pdr 2016-05-17 00:12:42 +02:00
pancake
c94145242f Fix #4739 - Do not run cmd.bp twice 2016-05-16 23:17:03 +02:00
pancake
2db1f73583 Fix #4836 - bb0 size issue 2016-05-16 23:07:29 +02:00
Álvaro Felipe Melchor
f6a0cfbcb9 fix pxw endian issue 2016-05-16 23:05:06 +02:00
dequis
5d6c3ac947 libr/util/sys.c: Wrap the other backtrace() call with an #ifdef
I accidentally broke musl builds with that workaround.
2016-05-16 21:52:05 +02:00
Hamish Coleman
5f40ac8ad6 Implement jump delay analysis (#4901)
* Add archinfo details
* Add register profile details
* Show jump delay analysis - allows writing regression tests

* Fix decoded size of four-byte NOP
* Fix bugs found writing regresion tests:
** Jumps are not relative
** cut-and-paste error with some calls

* mark an illegal load destination
* Remove special case for the ignored aa field in load
* Factor mode_zz handing into its own function
2016-05-16 21:48:52 +02:00
pancake
28f64c83b9 Fix #4897 - Rename /# into /h 2016-05-16 21:48:22 +02:00
Joshua J. Drake
fed2998627 Fix "pxrj" output (#4908) 2016-05-16 21:07:05 +02:00
Anton Kochkov
49912c0226 Do not use backtrace if it's not available 2016-05-16 12:42:49 +03:00
pancake
50a46a954f Sort bbs by offset in pdr and drop the noisy true/false 2016-05-16 04:39:58 +02:00
Sushant Dinesh
8ffca4d175 Adds ESIL for x86: CMOVcc instructions (#4884) 2016-05-16 04:07:23 +02:00
dx
cbac4c38e1 libr/util/sys.c: Avoid malloc() calls in the signal handler (#4896)
Using functions like malloc() in async signal handlers is unsafe, and
may result in deadlocks.

Turns out that backtrace() is not safe either because its initialization
code uses dlopen() and malloc() and others, but this can be workarounded
by calling it once outside of a signal handler.
2016-05-16 04:06:59 +02:00
pancake
9cb987c091 Enhance afl output with color and fcnsize vs fcnrange hints 2016-05-16 04:06:45 +02:00
pancake
c627fb3bec Add colors in afll and fix max stack 2016-05-16 03:46:23 +02:00
pancake
dad8b434c4 Show real function size by default in afl 2016-05-16 03:06:39 +02:00
pancake
f3e6f386bf Fix RCons.less first line not shown 2016-05-16 02:59:42 +02:00
pancake
5239a8c599 Fix #4789 #4621 #4598 - implement afll : a verboser function list 2016-05-16 02:56:48 +02:00
pankajkataria
9a6c6e9e60 Updated-afl 2016-05-16 02:15:28 +02:00
pancake
d9cdd29268 Fix endian issue in crc16 and crc32 2016-05-16 02:08:59 +02:00
pancake
5683e45cb2 Move hash commands from # to ph 2016-05-16 02:08:55 +02:00
Álvaro Felipe Melchor
6b827c1563 Fix #4796 - Add dbm aka module relative breakpoints 2016-05-16 01:00:11 +02:00
pancake
a2fb171a37 Add R2PM_WWWROOT, update www-t and add http.homeroot r2 var 2016-05-16 00:59:29 +02:00
pancake
411cad06e2 Update r2pm manpage and fix #4843 2016-05-15 23:54:47 +02:00
Álvaro Felipe Melchor
6ea6301846 fix indentation mach-o/loader.h 2016-05-15 23:41:39 +02:00
Álvaro Felipe Melchor
aad08a0002 fix oob parse_signature in mach 2016-05-15 23:41:39 +02:00
pancake
1ea99fd31c Update to acr 0.10.2 and show HOST BUILD TARGET in REPORT 2016-05-15 23:02:59 +02:00
pancake
80ea7427bb Indentation fixes around the previous commit and beyond 2016-05-15 10:40:57 +02:00
Joshua J. Drake
29c2670039 Fix #4560: Handle recoils well with swstep=true
When resuming after (during) recoil from a breakpoint, the swstep
implementation would fail to advance. In short, the debugger would immediately
interrupt again because r_bp_restore was re-setting the original breakpoint
just before continue. The following changes fix this issue:

1. Modify r_bp_get_in to stop including the byte after a breakpoint. This was
causing r_bp_recoil to fail because it thought there was already a breakpoint
on the next instruction.

2. Pass the real breakpoint address (pc - dbg->bpsize) to r_bp_recoil so
that r_bp_get_in can work properly. Stop adding the b->size there to keep it
going too.

3. Add a state flag to core->dbg to track that we are in the midst of a recoil.

4. When continuing from recoil (in r_debug_continue_kill), restore all
breakpoints except the one we just hit (with the new r_bp_restore_except) to
avoid hitting it again. Once we move past this instruction, that breakpoint
will be set again.
2016-05-15 10:19:24 +02:00
pancake
23dcb486ea Fix some minor memory leaks, Properly make check_fcn public 2016-05-15 02:43:10 +02:00
pancake
942e3e0da5 Fix #4862 - Fix all pending covs 2016-05-15 02:04:40 +02:00
pancake
65ffbb12ce Fix wwwroot for android 2016-05-14 16:27:58 +02:00
pancake
83c3f5cd3f Add v alias for V 2016-05-14 16:42:41 +02:00
Riccardo Schirone
c169073c74 Fix #4080 : remove assumption that functions are contiguous
* anal/p/anal_java: remove function that does nothing

* anal/fcn: workaround for java analysis
2016-05-14 16:37:24 +02:00
Ahmed Mohamed Abd El-MAwgood
7ab187841f Add initial support for asm.calls 2016-05-14 11:04:07 +02:00
pancake
22989f1ce9 Workaround for x86.nz inc [eax] 2016-05-14 10:59:54 +02:00
pancake
02eb896897 Handle data refs in dalvik analysis 2016-05-14 10:40:03 +02:00
Riccardo Schirone
1c7119401a core/graph: improve layer assignment algorithm
It should fix some layer problem on some binaries like ls-linux64 and in
the presence of self-loop. The previous algorithm could assign the same
layer to two nodes that are connected with an edge (and it should never
happen, because they have to be on different layers).

This patch uses the topological sort of a graph to assign the layer.
2016-05-14 10:37:55 +02:00
Damien Zammit
79728e837d Fix #4879 - warnings in esil 2016-05-14 10:33:09 +02:00
Joshua J. Drake
83baa272c8 Try for C99 compatibility per xvkilka's comments 2016-05-14 08:42:56 +03:00
Joshua J. Drake
fad425ec06 Fix perror calls that already pass the function name 2016-05-14 08:42:56 +03:00
Joshua J. Drake
83a76b7158 Propagate location information in perror
The "r_sys_perror" function previously would use "perror" on UNIX resulting in
location information of the "perror" callsite being shown. Renaming
"r_sys_perror" to "r_sys_perror_str" and replacing the original identifier with
a macro ensures that the displayed information is useful.

Further, this addreses a TODO that makes this functionality work on both
Windows and UNIX by moving these macros outside of the UNIX #if. The (now)
"r_sys_perror_str" is already implemented for both platforms. Let's use it!
2016-05-14 08:42:56 +03:00
Álvaro Felipe Melchor
647b4f29b5 Fix #4808 2016-05-13 21:52:28 +02:00
pancake
d898e8e201 Fix segfault in swift demangler 2016-05-13 17:53:31 +02:00
Sven Steinbauer
074b327c1c Fix #3644 : Add SIB addressing support to nz compiler 2016-05-13 11:45:54 +02:00
pancake
f18be0bb99 Fix several pointer arithmetic issues in r_endian.h 2016-05-13 11:45:00 +02:00
Sven Steinbauer
278c868693 Add autocomplete for wxf
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-13 11:33:16 +02:00
Riccardo Schirone
d9e3a290c1 libr: fix compilation warnings
libr/util/graph: add some comments to the API
2016-05-13 09:57:55 +02:00
rene
695d9a0d04 added shortcuts for every node in graph view
fixes mentioned in the pr
fixed the Vp issue mentioned in the pr
fixes the mentioned parts
changed reallocation size

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-12 23:49:30 +02:00
Rakholiya Jenish
a13d46b295 fix CID 1355197, 1355198 and 1355199
cleanup

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-12 23:10:37 +02:00
Hamish Coleman
a876fa504e Arcompact coverity changes
* fixed invalid compare

* Attempt to fix coverity's detection of 'Suspicious implicit sign extension'
2016-05-12 04:32:15 +02:00
Jaime Peñalba
5924510994 ESIL gb fixes
* ESIL gb: fix for loading or adding from sp+offset

* ESIL gb: fix for stores to [hl] not using proper source register
2016-05-12 04:31:09 +02:00
Álvaro Felipe Melchor
56099e9b67 fix issue when checking for oob - coverity scan 2016-05-11 23:14:51 +02:00
Rakholiya Jenish
502870f07b list all encoders/decoders supported by woE/woD and rahash2 -E/-D (fix #4851)
list all encoders/decoders supported by woE/woD and rahash2 -E/-D (fix #4851)
2016-05-11 22:25:54 +02:00
pancake
8b61811a75 Do not set asm.bits depending on CPSR to give more freedom to the user 2016-05-11 15:38:26 +02:00
SkUaTeR
75ea9cea3c Fix w32 debugger 2016-05-11 13:09:40 +02:00
pancake
3d89f2cc21 Add RAnal.Stack.RESET and handle it for arm64 2016-05-11 12:59:32 +02:00
Sven Steinbauer
45093ffb49 Fix #4751 - Add wxf command 2016-05-11 11:58:26 +02:00
Rene Laemmert
47fd9f7169 Added pushf* and popf* for x86 esil 2016-05-11 11:38:06 +02:00
pancake
9a86edb6b3 Use '0' in visual to seek at the beginning of the function and fix r2 -AAAAA 2016-05-11 04:25:16 +02:00
pancake
0baacfe852 Fix use of aae in aaaa 2016-05-11 04:09:39 +02:00
pancake
242fd0309d Add arm64 support for aae 2016-05-11 04:07:51 +02:00
pancake
1afb3b1e62 Handle SVC in anal.arm64 2016-05-11 03:06:42 +02:00
pancake
35ec317f2f Support shift << and >> in RNumCalc 2016-05-11 00:28:42 +02:00
Sven Steinbauer
5ad7b9e2f2 Expand on error message for unsigned OSX binary
If r2 is unsigned the message the user gets when trying to debug with it
isn't clear as to what the problem is. Add a line to suggest most likely issue and go see the docs to get a cert.
2016-05-10 22:16:14 +02:00
Riccardo Schirone
15c1197636 util/print: use screen_bounds to store the first non visible address 2016-05-10 22:15:24 +02:00
Sven Steinbauer
97a8fe9657 Make graphviz config options clearer 2016-05-10 22:12:50 +02:00
pancake
b4bb247791 Add nop for arm64 assembler 2016-05-10 11:22:13 +02:00
Hamish Coleman
302b9a559c Arcompact whitespace (#4839)
* Minor whitespace cleanups
* Follow styleguide for switch statement indenting
2016-05-10 02:40:49 +02:00
pancake
1b135bc93a Fix #4710 - Fix command injection in swift-demangle 2016-05-10 00:50:09 +02:00
pancake
cf94e318ac Fix #4795 - pcp for > 256 blocks 2016-05-10 00:39:31 +02:00
pancake
eabe6512f2 Fix #4815 - Implement HexII print format (ref: http://corkami.googlecode.com/svn/trunk/src/HexII/) 2016-05-10 00:18:21 +02:00
Álvaro Felipe Melchor
b7cc6c04d7 LDID parse signature in mach0 binaries
* added iC command to show signature info

in the case of mach it shows entitlements

* added rabin2 -OC to get signature info from binary

* change swap to r_read_bleX new API

* change eprintf to r_cons_printf

* add const char in plg->signature
2016-05-09 23:42:28 +02:00
pancake
9100a21da5 Fix #4831 - aeim creates a section for io.sectonly=true 2016-05-09 23:23:45 +02:00
pancake
919424f5ed Several bug fixes for the arm32 esil emulation and static analysis 2016-05-09 23:08:25 +02:00
pancake
7c0dd4ef23 Fix indentation issues in anal.arc 2016-05-09 19:21:34 +02:00
Hamish Coleman
6091894ac8 Improved Arcompact anal module
The rewrite the ARCompact analyser code started because I noticed that the
older code was really not decoding the binary I was working on properly.

Specific things that I noticed were:
* Scrolling backwards scrolled forwards
* Jump targets were shown from apparently random opcodes
* Analysis really didnt find anything
* The anal code was essentially hardcoded for big endian targets (and mine
  was not, so instruction decoding was largely misfiring)

I read the ARCompactISA Programmers Reference guide and implemented decoding
for most instructions.  Specifically, I ensured that all the instructions that
had limm data were decoded with the correct length and that all the jump or
branch targets were correctly calculated.

As I have not previously looked at anal plugins before, I expect I have
messed up a bunch of the assumptions that the anal system makes.

Among the issues that I still have is that the analysis will find
instructions (and thus xrefs, functions, etc) in "unaligned" locations.
This might just be an artifact of the fact that not all my data is marked
as data, but it feels like there might be something I have missed.

Still remaining TODO are most of the 32bit general purpose instructions.

* BUG: missing break in switch
* Implement missing general instructions in ARCompact anal
* Only set op->fail on jump instructions for ARCompact
* ARCompact: analyse calculated pointers and immediate values in load/store/move instructions
* Address styleguide issues
* Remove unnecessary brackets
* Use standard endian swapping functions
* The maximum instruction length is only 8 bytes, adjust the de-swizzler appropriately
* BUG: I'm an idiot, fix the array size
* Move the opcode 4 General Operations to its own function for clarity
* Bring back the quick and dirty debug output by consolidating all decoded fields into a structure
* Factor out common code used in genops jumps and calls
* Remove some magic numbers by using defines for the registers
* Missed a field when converting to the struct
* Record the size of the opcode
2016-05-09 19:05:11 +02:00
pancake
a64622606c Do not show analysis messages when -q 2016-05-09 19:01:37 +02:00
Ahmed Mohamed Abd El-MAwgood
d4e4bcf6f4 off by one calculating string start (#4828) 2016-05-09 17:38:11 +02:00
pancake
735ec47da4 Fix #4816 - load libraries if bin.libs=true (wip) 2016-05-09 17:24:12 +02:00
Rakholiya Jenish
82574209b1 rc6 support (#4826)
fix warning
2016-05-09 16:51:26 +02:00
Ahmed Mohamed Abd El-MAwgood
00faea8023 FIX #4782: adding afCa to r_core_anal_all (#4805) 2016-05-09 16:04:54 +02:00
Sushant Dinesh
e31c778ccd Fixes MOVSD (#4811) 2016-05-09 15:27:18 +02:00
Sven Steinbauer
766b9ec4f0 Add support for dword offsets (#4825)
* Add support for dword offsets to internal assembler

Internal assembler produces incorrect opcodes for offsets that were
greater than a short.

    rasm2 "mov eax, [eax + 1337]"
    8b8039

This adds support for values >127.

    rasm2 "mov eax, [eax + 1337]"
    8b8039050000

producing the same output as the `nasm` assembler.

* Fix support for negative short and dword offsets

Handle negative offsets for `mov` instructions both short and dword
sizes.

* Whitespace fixes

* Remove rogue character

Remove the reogue `:` that got into the code
2016-05-09 15:25:20 +02:00
pancake
91a052f971 Fix #4817 - Deprecate file.analyze 2016-05-09 11:33:17 +02:00
pancake
8a05a74cfb Fix #4819 - honor arrows in V! 2016-05-09 11:13:37 +02:00
pancake
47b861b975 Update seek command help 2016-05-09 10:58:06 +02:00
pancake
7676272b18 Add sj and s= commands 2016-05-09 10:39:19 +02:00
Damien Zammit
9cb03bab32 Cleanup endianness in crc32 and xxhash 2016-05-09 08:56:48 +02:00
Damien Zammit
5e1ad580db build: fix warnings 2016-05-08 12:21:11 +02:00
Damien Zammit
5995ef75e7 x86.cs: Fix POPA{LW} esil 2016-05-08 00:10:06 +02:00
pancake
cafc19f5a3 Demangle two more tests in Swift 2016-05-08 00:09:14 +02:00
Damien Zammit
964d12b392 ESIL: add floating point instructions (#4794) 2016-05-07 12:32:06 +02:00
Rakholiya Jenish
3019bb477c Add support for punycode via woE and woD and rahash2
Also add aes-cbc support by getting IV from user
2016-05-07 12:31:13 +02:00
Jeffrey Crowell
056f8a7efa fix div by 0 and memleak in elf.c
CID 1338361
CID 1355149
2016-05-07 00:39:28 -04:00
Álvaro Felipe Melchor
6c7d91c5c4 Fix #4749 - fix parsing dynamic section 2016-05-06 22:24:41 +02:00
Sven Steinbauer
7c0b3eb64a Fix #4745 incorrect assembly for x86 mov (#4791) 2016-05-06 16:08:41 +02:00
pancake
51955396c2 Add comparator demangling in swift-sd 2016-05-06 10:39:44 +02:00
Damien Zammit
632dccc217 Remove LIL_ENDIAN macro and configure option
TODO: Remove other endian cruft from:
- hashing algs
- judy
- squashfs
- grub
- tms320

Signed-off-by: Damien Zammit <damien@zamaudio.com>
2016-05-06 10:21:55 +02:00
pancake
abf63d018f Fix memleak reported by coverity 2016-05-05 16:30:55 +02:00
pancake
4b42e27969 Fix b64 warnings 2016-05-05 16:06:15 +02:00
Ahmed Mohamed Abd El-MAwgood
f6c24f426f Adding support for handling sp registers at parsing 2016-05-05 15:48:00 +02:00
pancake
bbb7b8412b Implement experimental cmdback in rap server and client 2016-05-05 01:20:23 +02:00
pancake
7d49075504 Cleanup io.rap 2016-05-05 00:04:44 +02:00
pancake
a32357f55a Cleanup rtr.c 2016-05-04 23:32:29 +02:00
Ahmed Mohamed Abd El-MAwgood
d08de89727 Add support for esp register in afCa afCa 2016-05-04 22:20:58 +02:00
Rene Laemmert
0595fbf4f6 Fix #4760 removed aap from aaaa 2016-05-04 22:19:50 +02:00
pancake
84ab4792fa Fix #4653 - =[fd][cmd] is working again 2016-05-04 20:08:38 +02:00
pancake
adb70234ff Fixes for asm.fcnlines and endian issues for esil + disasm 2016-05-04 17:13:44 +02:00
Damien Zammit
af0a865d9f WIP - Totally remove host endianness dependence
- Adds endian aware functions
- Removes references to host endian
- Uses binary detected endianness else tries LE and restricts by RAsmPlugin
- Fixes gdb debugger endianness when debugging BE qemu gdbserver

Signed-off-by: Damien Zammit <damien@zamaudio.com>
2016-05-04 23:42:17 +10:00
pancake
1b29487ba6 Fix all swift demangler oob reads 2016-05-04 15:32:57 +02:00
pancake
1f82c105fb Fix doublefree and regprofile for FreeBSD 2016-05-04 13:28:53 +02:00
Riccardo Schirone
ed80f726f6 core/graph: remove esil modes
core/cmd_debug: use just one if instead of two nested
2016-05-04 10:18:20 +02:00
Jeffrey Crowell
9bdbe5c472 fix mips regprofile (s8/s9 arent real, t8/t9 are):
closes #4772
2016-05-03 23:49:38 -04:00
pancake
63c7880c35 Fix #4770 - Honor graph.from|to in agc 2016-05-04 01:59:11 +02:00
Sven Steinbauer
9d68cf74f8 Colour current graphviz nodes and make colors configurable
Colours current node in Graphviz output (`ag` command) 'lightblue'.

Add `graph.gv.current` option to config with default to `false`

* White space fixes

Spaces before parens

* Make GV colour configurable

Using existing colours from the palette. Changes boxes from
`lightgray` to `gray` and allows settings for traced boxes, box colour,
and current box colour.
2016-05-04 00:50:33 +02:00
pancake
d4cf8292b0 Fix io.0xff bug 2016-05-04 00:47:35 +02:00
pancake
4546355af3 Add support for ascii-art debug tracing call graphs 2016-05-04 00:43:08 +02:00
pancake
bbc3e4e24e Fix aggi;V, agc* and add proper callgraph support in V 2016-05-04 00:11:28 +02:00
pancake
08310a99cd Add io.0xff to define the value to fill unallocated area 2016-05-03 23:09:00 +02:00
pancake
a83d9c1827 export MAKE in sys/install.sh 2016-05-03 22:29:56 +02:00
pancake
32fc67d63e Add support to demangle function extensions for Swift 2016-05-03 22:25:40 +02:00
Fabian Yamaguchi
122e1d55a8 Fix #4726 - Make sure that the destination register is not reported as "read" in an ESIL eq operation 2016-05-03 19:42:00 +02:00
pancake
bac256c65c Add support for protocol extension in Swift demangler 2016-05-03 05:26:23 +02:00
Jeffrey Crowell
9518841434 refactor includes (#4757) 2016-05-03 04:52:41 +02:00
pancake
5014da9f1c Fix crash and autodetection in Swift demangler 2016-05-03 04:45:17 +02:00
pancake
6261fe32fb bugfixes + testsuite for the Internal Swift demangler 2016-05-03 04:31:36 +02:00
Maijin
179b1243bd Add p8f command 2016-05-03 03:29:43 +02:00
Álvaro Felipe Melchor
149c7567ed improve arm/thumb detection for .so 2016-05-02 23:00:53 +02:00
Álvaro Felipe Melchor
e805d701db Fix #4649 2016-05-02 18:24:34 +02:00
pancake
1f7db90e41 Priorize keystone plugins and other random changes 2016-05-02 02:46:01 +02:00
pancake
e18e1ffd36 Fix aav for 64bit pointers 2016-05-01 23:00:08 +02:00
Ahmed Mohamed Abd El-MAwgood
eb185abff4 adding intital support to --omit-frame-pointer FIX #3735 (#4742)
* adding intital support to --omit-frame-pointer FIX #3735

* makeing afCa arch independent to some extent
2016-05-01 14:48:04 +02:00
v14dz
3226ec5b08 Remove duplicate 'q' option displayed in the visual define menu (Vd) (#4740) 2016-05-01 14:47:44 +02:00
pancake
b417da6d4d Add setarch/(from|to).string simplified RAsm APIs 2016-04-29 11:30:38 +02:00
Riccardo Schirone
3c2355ab27 cons/hud: remove duplicated code in strmatch and fix bug with spaces 2016-04-29 11:05:58 +02:00
Rakholiya Jenish
9991f05e85 fix POP and POPF (#4733) 2016-04-28 19:02:51 +02:00
Rakholiya Jenish
e9efad51e4 fix XCHG output while memory access (#4732) 2016-04-28 18:59:45 +02:00
rene
f8c7c8a95b fixes pushal and adds popal for x86 2016-04-28 17:20:42 +02:00
pancake
b9eca47b02 Add regprofile for linux-powerpc (via @crowell) 2016-04-28 14:37:29 +02:00
pancake
af78b8e37f More osx-ppc build fixes. Almost there 2016-04-28 14:33:51 +02:00
pancake
360280a9b2 Fixes for the previous commit 2016-04-28 14:12:11 +02:00
Davide Balzarotti
86760900b1 Added color support for the hud.
- Fix issue #3570

* new matching algorithm (list of space-separated words, case insensitive)
  - Fix bug #4704
* refactoring some code
* updated copyright
2016-04-28 14:02:22 +02:00
Sergey Anufrienko
73af2ed183 x86 esil: add NEG opcode (#4731) 2016-04-28 13:57:40 +02:00
Andrey Torsunov
60de2dc6b4 Fix couple of memory leaks. Issue #2772. (#4725) 2016-04-28 10:47:50 +02:00
pancake
534bc9ddf8 Use VBlp to preview a class method 2016-04-28 03:17:16 +02:00
pancake
4fdd8fa82d Properly restore swapbits 2016-04-28 01:50:18 +02:00
pancake
33fee7f734 Autodetect thumb code in af 2016-04-28 01:38:11 +02:00
pancake
2e58923b84 Add grep mode and colors to VB 2016-04-28 01:24:49 +02:00
pancake
c7d37b3e43 Enhance the VB class list cursor 2016-04-28 00:15:12 +02:00
Riccardo Schirone
e8e5d92d4d core/graph: update help to explain undocumented commands 2016-04-27 23:35:19 +02:00
Sergey Anufrienko
9956454135 don't add op to esil vm, use xor (#4729) 2016-04-27 17:18:54 -04:00
pancake
938f135180 Fix repeatable macro calls 2016-04-27 22:30:29 +02:00
Ayman Khamouma
b8aadff071 make macros repeatable 2016-04-27 22:18:51 +02:00
pagabuc
356160ec5c This fixes #3666 and applies the spacing convention on function def and call (#4727) 2016-04-27 22:17:19 +02:00
Sergey Anufrienko
5807c310fc add bitwise complement ops to ESIL; add NOT opcode to X86 (#4728) 2016-04-27 22:16:49 +02:00
Riccardo Schirone
26fc8f92ef libr: remove some unused variables and functions 2016-04-27 12:59:45 +02:00
rene
33bc23cbb5 added the usage of anal.autoname option 2016-04-27 12:45:34 +02:00
pancake
6dfb95e9c5 Drop some unsupported debug features for osx-ppc 2016-04-27 11:40:42 +02:00