mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 05:40:10 +00:00
c1c54be39e
This change is to ease the switch to the new parser and make the syntax more consistent and easy. As things were before this patch, ',' could be part of an argument of a command, but at the same time it was used as a separator when defining a new macro. This difference in how `,` is interpreter, makes parsing commands harder, as grep specifiers, arguments, etc. should be parsed differently based on whether they are inside a macro body or not. By switching to using `;` as separator in the macro body, arguments, grep specifiers, etc. can be parsed as they would be outside of a macro body, making the new parser more consistent and easier.
837 lines
31 KiB
Plaintext
837 lines
31 KiB
Plaintext
NAME=Cd4+pdi2
|
||
FILE=../bins/mach0/ls-osx-x86_64
|
||
CMDS=<<EOF
|
||
e asm.bytes=0
|
||
so
|
||
pdi 2
|
||
Cd 4
|
||
pdi 2
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x1000013d9 mov rbp, rsp
|
||
0x1000013dc push r15
|
||
0x1000013d9 .dword 0x41564157
|
||
0x1000013dd push rdi
|
||
EOF
|
||
RUN
|
||
|
||
|
||
NAME=bytes for invalid insn (#11434)
|
||
FILE=-
|
||
CMDS=<<EOF
|
||
e asm.arch=x86
|
||
e asm.bits=64
|
||
wx 60; pd 2
|
||
?e
|
||
wx 906090; pd 3
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x00000000 60 invalid
|
||
0x00000001 0000 add byte [rax], al
|
||
|
||
0x00000000 90 nop
|
||
0x00000001 60 invalid
|
||
0x00000002 90 nop
|
||
EOF
|
||
RUN
|
||
|
||
NAME=arm indirect relsub fix (#11780)
|
||
FILE=../bins/elf/analysis/arm_32_flags0
|
||
CMDS=<<EOF
|
||
e asm.bytes=false
|
||
e asm.cmt.right=true
|
||
pd 1 @ 0x000102e0
|
||
pd 1 @ 0x000102e8
|
||
?e
|
||
e asm.cmt.right=false
|
||
pd 1 @ 0x000102e0
|
||
pd 1 @ 0x000102e8
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x000102e0 ldr ip, sym.__libc_csu_fini ; [0x102f8:4]=0x10494 sym.__libc_csu_fini
|
||
0x000102e8 ldr r0, main ; [0x102fc:4]=0x10408 sym.main
|
||
|
||
; [0x102f8:4]=0x10494 sym.__libc_csu_fini
|
||
0x000102e0 ldr ip, sym.__libc_csu_fini
|
||
; [0x102fc:4]=0x10408 sym.main
|
||
0x000102e8 ldr r0, main
|
||
EOF
|
||
RUN
|
||
|
||
NAME=realign after sparse (#11810)
|
||
FILE=../bins/pe/cmd_adf_sample0.exe
|
||
CMDS=<<EOF
|
||
e asm.bytes=false
|
||
e asm.comments=false
|
||
s 0x560e67
|
||
af+ 0x00560e67 fcn.00560e67
|
||
afb+ 0x00560e67 0x00560e67 6 0x00560e7d
|
||
afb+ 0x00560e67 0x00560e7d 8 0x00560e96
|
||
afb+ 0x00560e67 0x00560e96 7 0x00560eb1
|
||
afb+ 0x00560e67 0x00560eb1 297
|
||
pdf
|
||
EOF
|
||
EXPECT=<<EOF
|
||
/ 318: fcn.00560e67 (int32_t arg_0h);
|
||
| : ; var int32_t var_1ch @ esp+0x4
|
||
| : ; var int32_t var_ch @ esp+0x14
|
||
| : ; var int32_t var_8h @ esp+0x18
|
||
| : ; var int32_t var_4h @ esp+0x1c
|
||
| : ; arg int32_t arg_0h @ esp+0x20
|
||
| : 0x00560e67 push esi
|
||
| ,==< 0x00560e68 jmp 0x560e7d
|
||
..
|
||
| `--> 0x00560e7d pop esi
|
||
| : 0x00560e7e push eax
|
||
| : 0x00560e7f push edx
|
||
| ,==< 0x00560e80 jmp 0x560e96
|
||
..
|
||
| |`--> 0x00560e96 rdtsc
|
||
| | : 0x00560e98 jmp 0x560eb1
|
||
..
|
||
| ||: 0x00560eb1 pop edx
|
||
| ||: 0x00560eb2 pop eax
|
||
| ||: 0x00560eb3 pushfd
|
||
| ||: 0x00560eb4 push eax
|
||
| ||: 0x00560eb5 mov dword [esp], ecx
|
||
| ||: 0x00560eb8 push ecx
|
||
| ||: 0x00560eb9 mov dword [esp], 0x4b7dbaf4
|
||
| ||: 0x00560ec0 mov dword [esp], ebx
|
||
| ||: 0x00560ec3 mov ebx, 0x60
|
||
| ||: 0x00560ec8 mov dword [var_8h], ebx
|
||
| ||: 0x00560ecc pop ebx
|
||
| ||: 0x00560ecd push ecx
|
||
| ||: 0x00560ece mov dword [esp], 0x7fdd7312
|
||
| ||: 0x00560ed5 or dword [esp], 0x76fe6216
|
||
| |: 0x00560edc shl dword [esp], 1
|
||
| |: 0x00560ee0 or dword [esp], 0x5677e157
|
||
| |: 0x00560ee7 sub dword [esp], 0x66a97007
|
||
| |: 0x00560eee add dword [esp], 0xd4a8fad4
|
||
| |: 0x00560ef5 xchg dword [esp], ebp
|
||
| |: 0x00560ef8 not ebp
|
||
| |: 0x00560efa xchg dword [esp], ebp
|
||
| |: 0x00560efd inc dword [esp]
|
||
| |: 0x00560f00 sub dword [esp], 0x91ea8610
|
||
| |: 0x00560f07 push ebp
|
||
| |: 0x00560f08 mov ebp, esp
|
||
| |: 0x00560f0a add ebp, 4
|
||
| |: 0x00560f10 sub ebp, 4
|
||
| |: 0x00560f16 xchg dword [esp], ebp
|
||
| |: 0x00560f19 pop esp
|
||
| |: 0x00560f1a mov dword [esp], ecx
|
||
| |: 0x00560f1d mov dword [esp], eax
|
||
| |: 0x00560f20 push 0x5a9b4939
|
||
| |: 0x00560f25 mov dword [esp], ecx
|
||
| |: 0x00560f28 mov ecx, esp
|
||
| : 0x00560f2a push ebx
|
||
| : 0x00560f2b mov ebx, 4
|
||
| : 0x00560f30 add ecx, ebx
|
||
| : 0x00560f32 pop ebx
|
||
| : 0x00560f33 sub ecx, 4
|
||
| : 0x00560f36 xor ecx, dword [esp]
|
||
| : 0x00560f39 xor dword [esp], ecx
|
||
| : 0x00560f3c xor ecx, dword [esp]
|
||
| : 0x00560f3f pop esp
|
||
| : 0x00560f40 mov dword [esp], ebx
|
||
| : 0x00560f43 push dword [arg_0h]
|
||
| : 0x00560f47 mov eax, dword [esp]
|
||
| : 0x00560f4a push esi
|
||
| : 0x00560f4b mov esi, esp
|
||
| : 0x00560f4d push edx
|
||
| : 0x00560f4e mov edx, 0x75ff55bb
|
||
| : 0x00560f53 and edx, 0x7e5d8b17
|
||
| : 0x00560f59 xor edx, 0x745d0117
|
||
| : 0x00560f5f add esi, edx
|
||
| : 0x00560f61 mov edx, dword [esp]
|
||
| : 0x00560f64 add esp, 4
|
||
| : 0x00560f67 add esi, 4
|
||
| : 0x00560f6d xchg dword [esp], esi
|
||
| : 0x00560f70 pop esp
|
||
| : 0x00560f71 push dword [var_ch]
|
||
| : 0x00560f75 push dword [esp]
|
||
| : 0x00560f78 mov ebx, dword [esp]
|
||
| : 0x00560f7b push ebx
|
||
| : 0x00560f7c mov ebx, esp
|
||
| : 0x00560f7e add ebx, 4
|
||
| : 0x00560f84 add ebx, 4
|
||
| : 0x00560f8a xchg dword [esp], ebx
|
||
| : 0x00560f8d pop esp
|
||
| : 0x00560f8e add esp, 4
|
||
| : 0x00560f91 mov dword [var_ch], eax
|
||
| : 0x00560f95 mov dword [var_4h], ebx
|
||
| : 0x00560f99 push dword [esp]
|
||
| : 0x00560f9c pop ebx
|
||
| : 0x00560f9d push ebx
|
||
| : 0x00560f9e mov ebx, esp
|
||
| : 0x00560fa0 add ebx, 4
|
||
| : 0x00560fa6 add ebx, 4
|
||
| : 0x00560fa9 push ebx
|
||
| : 0x00560faa push dword [var_1ch]
|
||
| : 0x00560fae pop ebx
|
||
| : 0x00560faf pop dword [esp]
|
||
| : 0x00560fb2 mov esp, dword [esp]
|
||
| : 0x00560fb5 mov eax, dword [esp]
|
||
| : 0x00560fb8 push ebx
|
||
| : 0x00560fb9 mov dword [esp], 0x1e8e43e4
|
||
| : 0x00560fc0 mov dword [esp], eax
|
||
| : 0x00560fc3 mov eax, esp
|
||
| : 0x00560fc5 add eax, 4
|
||
| : 0x00560fca add eax, 4
|
||
| : 0x00560fcf xchg dword [esp], eax
|
||
| : 0x00560fd2 mov esp, dword [esp]
|
||
\ `=< 0x00560fd5 jmp 0x43d3f7
|
||
EOF
|
||
RUN
|
||
|
||
NAME=pdf hidden code in sparse fix
|
||
FILE=../bins/pe/cmd_adf_sample0.exe
|
||
CMDS=<<EOF
|
||
e asm.var=false
|
||
e io.cache=true
|
||
wx 90eb09 @ 0x560e71
|
||
wx e904000000 @ 0x560e68
|
||
wx e940c5edff @ 0x560eb2
|
||
s 0x560e67
|
||
af+ 0x00560e67 fcn.00560e67
|
||
afb+ 0x00560e67 0x00560e67 6 0x00560e71
|
||
afb+ 0x00560e67 0x00560e71 3 0x00560e7d
|
||
afb+ 0x00560e67 0x00560e7d 8 0x00560e96
|
||
afb+ 0x00560e67 0x00560e96 7 0x00560eb1
|
||
afb+ 0x00560e67 0x00560eb1 6
|
||
pdf
|
||
?e
|
||
pdr.
|
||
EOF
|
||
EXPECT=<<EOF
|
||
/ 30: fcn.00560e67 ();
|
||
| : 0x00560e67 56 push esi
|
||
| ,==< 0x00560e68 e904000000 jmp 0x560e71
|
||
..
|
||
| |: ; CODE XREF from fcn.00560e67 @ 0x560e68
|
||
| `--> 0x00560e71 90 nop
|
||
| : 0x00560e72 eb09 jmp 0x560e7d
|
||
..
|
||
| : ; CODE XREF from fcn.00560e67 @ 0x560e72
|
||
| : 0x00560e7d 5e pop esi
|
||
| : 0x00560e7e 50 push eax
|
||
| : 0x00560e7f 52 push edx
|
||
| ,==< 0x00560e80 e911000000 jmp 0x560e96
|
||
..
|
||
| ||: ; CODE XREF from fcn.00560e67 @ 0x560e80
|
||
| |`--> 0x00560e96 0f31 rdtsc
|
||
| | : 0x00560e98 e914000000 jmp 0x560eb1
|
||
..
|
||
| ||: ; CODE XREF from fcn.00560e67 @ 0x560e98
|
||
| ||: 0x00560eb1 5a pop edx
|
||
\ ||`=< 0x00560eb2 e940c5edff jmp 0x43d3f7
|
||
|
||
/ 30: fcn.00560e67 ();
|
||
| 0x00560e67 56 push esi
|
||
| 0x00560e68 e904000000 jmp 0x560e71
|
||
| ----------- true: 0x00560e71
|
||
| ; CODE XREF from fcn.00560e67 @ 0x560e68
|
||
| 0x00560e71 90 nop
|
||
| 0x00560e72 eb09 jmp 0x560e7d
|
||
| ----------- true: 0x00560e7d
|
||
| ; CODE XREF from fcn.00560e67 @ 0x560e72
|
||
| 0x00560e7d 5e pop esi
|
||
| 0x00560e7e 50 push eax
|
||
| 0x00560e7f 52 push edx
|
||
| 0x00560e80 e911000000 jmp 0x560e96
|
||
| ----------- true: 0x00560e96
|
||
| ; CODE XREF from fcn.00560e67 @ 0x560e80
|
||
| 0x00560e96 0f31 rdtsc
|
||
| 0x00560e98 e914000000 jmp 0x560eb1
|
||
| ----------- true: 0x00560eb1
|
||
| ; CODE XREF from fcn.00560e67 @ 0x560e98
|
||
| 0x00560eb1 5a pop edx
|
||
\ 0x00560eb2 e940c5edff jmp 0x43d3f7
|
||
|
||
EOF
|
||
RUN
|
||
|
||
NAME=esil func cmts
|
||
FILE=../bins/elf/arm1.bin
|
||
CMDS=<<EOF
|
||
tn- __libc_start_main
|
||
e asm.emu=true
|
||
e emu.write=true
|
||
s 0x8174
|
||
af
|
||
e asm.cmt.right=true
|
||
pdf
|
||
?e
|
||
e asm.cmt.right=false
|
||
pdf
|
||
?e
|
||
agf
|
||
EOF
|
||
EXPECT=<<EOF
|
||
/ 8: fcn.00008174 ();
|
||
| 0x00008174 b80000eb bl sym.__libc_start_main ; lr=0x8178 -> 0xeb0002a4 ; pc=0x845c -> 0xe92d41f0
|
||
| ; int __libc_start_main(?, -1, ?, ?, ?, ?, -1)
|
||
\ 0x00008178 a40200eb bl sym.abort ; lr=0x817c -> 0xe92d4030 ; pc=0x8c10 -> 0xe59f62a0
|
||
\ ; void abort(void)
|
||
|
||
/ 8: fcn.00008174 ();
|
||
| ; lr=0x8178 -> 0xeb0002a4
|
||
| ; pc=0x845c -> 0xe92d41f0 sym.__libc_start_main
|
||
| ; int __libc_start_main(?, -1, ?, ?, ?, ?, -1)
|
||
| 0x00008174 b80000eb bl sym.__libc_start_main
|
||
| ; lr=0x817c -> 0xe92d4030
|
||
| ; pc=0x8c10 -> 0xe59f62a0 sym.abort
|
||
| ; void abort(void)
|
||
\ 0x00008178 a40200eb bl sym.abort
|
||
|
||
[0x00008174]> # fcn.00008174 ();
|
||
----------------------------------------------------.
|
||
| 0x8174 |
|
||
| 8: fcn.00008174 (); |
|
||
| ; lr=0x8178 -> 0xeb0002a4 |
|
||
| ; pc=0x845c -> 0xe92d41f0 sym.__libc_start_main |
|
||
| ; int __libc_start_main(?, -1, ?, ?, ?, ?, -1) |
|
||
| bl sym.__libc_start_main;[oa] |
|
||
| ; lr=0x817c -> 0xe92d4030 |
|
||
| ; pc=0x8c10 -> 0xe59f62a0 sym.abort |
|
||
| ; void abort(void) |
|
||
| bl sym.abort;[ob] |
|
||
`----------------------------------------------------'
|
||
EOF
|
||
RUN
|
||
|
||
NAME=esil func cmt refline
|
||
FILE=../bins/elf/ls
|
||
CMDS=<<EOF
|
||
e io.cache=true
|
||
e asm.emu=true
|
||
e asm.types=2
|
||
wx 7d0a7f08eb00 @ 0x5b02
|
||
pd 4 @ 0x5b02
|
||
EOF
|
||
EXPECT=<<EOF
|
||
,=< 0x00005b02 7d0a jge 0x5b0e ; rip=0x5b0e -> 0x8d4890f4 ; likely
|
||
,==< 0x00005b04 7f08 jg 0x5b0e ; rip=0x5b0e -> 0x8d4890f4 ; likely
|
||
,===< 0x00005b06 eb00 jmp 0x5b08 ; rip=0x5b08 -> 0xc30a15ff
|
||
`---> 0x00005b08 ff150ac30100 call qword [reloc.__libc_start_main] ; [0x21e18:8]=0 ; rsp=0xfffffffffffffff8 ; rip=0x0
|
||
|| ; int __libc_start_main(func: unk_size_format, -1, char **: unk_size_format, func: unk_size_format, func: unk_size_format, func: unk_size_format, -1)
|
||
EOF
|
||
RUN
|
||
|
||
NAME=aht asm.cmt.right=false fix (#12330)
|
||
FILE=-
|
||
CMDS=<<EOF
|
||
e asm.arch=x86
|
||
e asm.bits=64
|
||
e io.cache=true
|
||
wx 488b4608
|
||
"td struct ms { char b[8]; int member1; int member2; };"
|
||
aht ms.member1
|
||
e asm.cmt.right=true
|
||
pd 1
|
||
e asm.cmt.right=false
|
||
pd 1
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x00000000 488b4608 mov rax, qword [rsi + ms.member1]
|
||
0x00000000 488b4608 mov rax, qword [rsi + ms.member1]
|
||
EOF
|
||
RUN
|
||
|
||
NAME=asm.bb.line fcnline glitches fix, bblines btw bb & non-bb
|
||
FILE=../bins/elf/before-after-main
|
||
CMDS=<<EOF
|
||
e asm.bb.line=true
|
||
e asm.bytes=false
|
||
e asm.comments=false
|
||
e asm.fcnsig=false
|
||
e asm.var=false
|
||
s sym.deregister_tm_clones
|
||
aF
|
||
s sym.deregister_tm_clones-1
|
||
pd 3
|
||
?e
|
||
s sym.deregister_tm_clones+38
|
||
pd 4
|
||
?e
|
||
s entry.fini0
|
||
aF
|
||
s entry.fini0+32
|
||
pd 3
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x080483cf nop
|
||
/ (fcn) sym.deregister_tm_clones 40
|
||
| 40: sym.deregister_tm_clones ();
|
||
| 0x080483d0 mov eax, obj.completed.6891
|
||
| 0x080483d5 cmp eax, obj.completed.6891
|
||
|
||
| 0x080483f6 ret
|
||
|
|
||
0x080483f7 mov esi, esi
|
||
0x080483f9 lea edi, [edi]
|
||
|
|
||
\ 0x08048400 ret
|
||
|
||
| 0x08048470 ret
|
||
|
|
||
0x08048471 lea esi, [esi]
|
||
|
|
||
\ 0x08048478 ret
|
||
EOF
|
||
RUN
|
||
|
||
# asm.bb.line with no analysis is not supported, since backward jump targets
|
||
# can't be determined completely without analysis of the whole function
|
||
# (assuming no jumps from outside the function into the middle)
|
||
NAME=asm.bb.line no-anal
|
||
FILE=../bins/elf/lab2
|
||
CMDS=<<EOF
|
||
e asm.bb.line=true
|
||
e asm.bytes=false
|
||
e asm.comments=false
|
||
e io.cache=true
|
||
wx 907f04 @ 0x08048597
|
||
wx 75f3909090 @ 0x080485bc
|
||
s 0x08048598
|
||
pd 11
|
||
EOF
|
||
EXPECT=<<EOF
|
||
,=< 0x08048598 jg 0x804859e
|
||
| 0x0804859a cmp al, byte [esp + 0x27]
|
||
,`-> 0x0804859e je 0x80485b3
|
||
| 0x080485a0 mov dword [esp], str.Wrong
|
||
| 0x080485a7 call sym.imp.puts
|
||
| 0x080485ac mov eax, 1
|
||
,=.-> 0x080485b1 jmp 0x80485f9
|
||
|`--> 0x080485b3 add dword [esp + 0x20], 1
|
||
| : 0x080485b8 mov ebx, dword [esp + 0x20]
|
||
| `=< 0x080485bc jne 0x80485b1
|
||
| 0x080485be nop
|
||
EOF
|
||
RUN
|
||
|
||
NAME=asm.bb.line glitch fix (#12516)
|
||
FILE=../bins/elf/ls
|
||
CMDS=<<EOF
|
||
e asm.bb.line=true
|
||
e asm.bytes=false
|
||
e asm.comments=false
|
||
e io.cache=true
|
||
wx 907f03 @ 0x4232
|
||
wx 72f1909090 @ 0x424a
|
||
s main
|
||
aF
|
||
s 0x4233
|
||
pd 9
|
||
?e
|
||
pdJ 9~{}
|
||
EOF
|
||
EXPECT=<<EOF
|
||
| ,=< 0x00004233 jg 0x4238
|
||
| | |
|
||
| | 0x00004235 test rax, rax
|
||
| | |
|
||
| ,`-> 0x00004238 je 0x4243
|
||
| | |
|
||
| | 0x0000423a cmp byte [rax], 0
|
||
| | |
|
||
| ,=.-> 0x0000423d jne 0x4b1c
|
||
| ||: |
|
||
| |`--> 0x00004243 lea r12, [var_58h]
|
||
| | : 0x00004248 xor eax, eax
|
||
| | `=< 0x0000424a jb 0x423d
|
||
| | |
|
||
| | 0x0000424c nop
|
||
|
||
[
|
||
{
|
||
"offset": 16947,
|
||
"arrow": 16952,
|
||
"text": "| ,=< 0x00004233 jg 0x4238"
|
||
},
|
||
{
|
||
"offset": 16949,
|
||
"text": "| | |"
|
||
},
|
||
{
|
||
"offset": 16949,
|
||
"text": "| | 0x00004235 test rax, rax"
|
||
},
|
||
{
|
||
"offset": 16952,
|
||
"arrow": 16963,
|
||
"text": "| | |"
|
||
},
|
||
{
|
||
"offset": 16952,
|
||
"arrow": 16963,
|
||
"text": "| ,`-> 0x00004238 je 0x4243"
|
||
},
|
||
{
|
||
"offset": 16954,
|
||
"text": "| | |"
|
||
},
|
||
{
|
||
"offset": 16954,
|
||
"text": "| | 0x0000423a cmp byte [rax], 0"
|
||
},
|
||
{
|
||
"offset": 16957,
|
||
"arrow": 19228,
|
||
"text": "| | |"
|
||
},
|
||
{
|
||
"offset": 16957,
|
||
"arrow": 19228,
|
||
"text": "| ,=.-> 0x0000423d jne 0x4b1c"
|
||
},
|
||
{
|
||
"offset": 16963,
|
||
"text": "| ||: |"
|
||
},
|
||
{
|
||
"offset": 16963,
|
||
"text": "| |`--> 0x00004243 lea r12, [var_58h]"
|
||
},
|
||
{
|
||
"offset": 16968,
|
||
"text": "| | : 0x00004248 xor eax, eax"
|
||
},
|
||
{
|
||
"offset": 16970,
|
||
"arrow": 16957,
|
||
"text": "| | `=< 0x0000424a jb 0x423d"
|
||
},
|
||
{
|
||
"offset": 16972,
|
||
"text": "| | |"
|
||
},
|
||
{
|
||
"offset": 16972,
|
||
"text": "| | 0x0000424c nop"
|
||
}
|
||
]
|
||
EOF
|
||
RUN
|
||
|
||
NAME=flag-func_sig order
|
||
FILE=../bins/elf/abcde-qt32
|
||
CMDS=<<EOF
|
||
e asm.demangle=true
|
||
e asm.bytes=false
|
||
e asm.filter=false
|
||
e asm.jmpsub=false
|
||
aa
|
||
e asm.cmt.right=true
|
||
pd 1 @ 0x080493b4
|
||
pd 1 @ 0x080493ca
|
||
?e
|
||
e asm.cmt.right=false
|
||
pd 1 @ 0x080493b4
|
||
pd 1 @ 0x080493ca
|
||
EOF
|
||
EXPECT=<<EOF
|
||
| 0x080493b4 call 0x80490b0 ; sym.imp.strlen ; size_t strlen(const char *s)
|
||
| 0x080493ca call 0x80490e0 ; sym.imp.QString::fromAscii_helper_char_const___int
|
||
| ; QString::fromAscii_helper(char const*, int)
|
||
|
||
| ; sym.imp.strlen
|
||
| ; size_t strlen(const char *s)
|
||
| 0x080493b4 call 0x80490b0
|
||
| ; sym.imp.QString::fromAscii_helper_char_const___int
|
||
| ; QString::fromAscii_helper(char const*, int)
|
||
| 0x080493ca call 0x80490e0
|
||
EOF
|
||
RUN
|
||
|
||
NAME=newlined-comment-refline fix (#14627), wayward rip-relative flag fixes
|
||
FILE=../bins/elf/ls
|
||
CMDS=<<EOF
|
||
e asm.bytes=false
|
||
e asm.filter=true
|
||
(pd_tests; e asm.relsub=true; pd 15; ?e; e asm.relsub=false; pd 1 @ 0x000041ee; pd 1 @ 0x00004225)
|
||
(insn_tests; e scr.color=0; .(pd_tests); ?e; e scr.color=1; .(pd_tests))
|
||
s 0x000041e0
|
||
.(insn_tests)
|
||
?e
|
||
e io.cache=true
|
||
"wa mov rdx, [rip + 0x17792]; mov rsi, [rip + 0x1d84b]" @ 0x000041e7
|
||
"wa mov rdi, [rip + 0x147f6]" @ 0x00004225
|
||
.(insn_tests)
|
||
?e
|
||
wx 483b1592770100483b354bd80100 @ 0x000041e7 # cmp rdx, [rip + 0x17792]; cmp rsi, [rip + 0x1d84b]
|
||
wx 483b3df6470100 @ 0x00004225 # cmp rdi, [rip + 0x147f6]
|
||
.(insn_tests)
|
||
EOF
|
||
EXPECT=<<EOF
|
||
,=< 0x000041e0 je 0x421a
|
||
| 0x000041e2 mov ecx, 4
|
||
| 0x000041e7 lea rdx, [0x0001b980]
|
||
| 0x000041ee lea rsi, [0x00021a40]
|
||
| 0x000041f5 mov rdi, rax
|
||
| 0x000041f8 call 0xc660
|
||
| 0x000041fe test eax, eax
|
||
,==< 0x00004200 js 0x4ae5
|
||
|| 0x00004206 cdqe
|
||
|| 0x00004208 lea rdx, [0x0001b980]
|
||
|| 0x0000420f xor edi, edi
|
||
|| 0x00004211 mov esi, dword [rdx + rax*4]
|
||
|| 0x00004214 call 0x13c50
|
||
|`-> 0x0000421a mov qword [0x000232b0], 0x50 ; 'P'
|
||
| ; [0x232b0:8]=0
|
||
| 0x00004225 lea rdi, str.COLUMNS ; 0x18a22 ; "COLUMNS"
|
||
|
||
0x000041ee lea rsi, [rip + 0x1d84b] ; 0x21a40
|
||
0x00004225 lea rdi, [rip + 0x147f6] ; str.COLUMNS
|
||
; 0x18a22 ; "COLUMNS"
|
||
|
||
[36m,[0m[36m=[0m[36m<[0m [32m0x000041e0[0m [32mje 0x421a[0m[0m
|
||
[36m|[0m [32m0x000041e2[0m [37mmov[36m ecx[0m,[36m[36m [33m4[0m[0m[0m
|
||
[36m|[0m [32m0x000041e7[0m [37mlea[36m rdx[0m,[36m[36m [0m[[36m[33m0x0001b980[0m][36m[0m[0m[0m
|
||
[36m|[0m [32m0x000041ee[0m [37mlea[36m rsi[0m,[36m[36m [0m[[36m[33m0x00021a40[0m][36m[0m[0m[0m
|
||
[36m|[0m [32m0x000041f5[0m [37mmov[36m rdi[0m,[36m[36m rax[0m[0m[0m
|
||
[36m|[0m [32m0x000041f8[0m [1;92mcall 0xc660[0m[0m
|
||
[36m|[0m [32m0x000041fe[0m [36mtest[36m eax[0m,[36m[36m eax[0m[0m[0m
|
||
[36m,[0m[36m=[0m[36m=[0m[36m<[0m [32m0x00004200[0m [32mjs 0x4ae5[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004206[0m [37mcdqe[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004208[0m [37mlea[36m rdx[0m,[36m[36m [0m[[36m[33m0x0001b980[0m][36m[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x0000420f[0m [36mxor[36m edi[0m,[36m[36m edi[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004211[0m [37mmov[36m esi[0m,[36m dword [0m[[36mrdx [0m+[36m[36m rax[0m*[33m4[0m][36m[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004214[0m [1;92mcall 0x13c50[0m[0m
|
||
[36m|[0m[36m`[0m[36m-[0m[36m>[0m [32m0x0000421a[0m [37mmov qword[36m [0m[[36m[33m0x000232b0[0m][36m[0m,[36m[36m [33m0x50[0m[0m[31m ; 'P'
|
||
[36m|[0m [31m ; [0x232b0:8]=0[0m
|
||
[36m|[0m [32m0x00004225[0m [37mlea[36m rdi[0m,[36m[36m [0m[36mstr.COLUMNS[0m[36m[0m[0m[31m ; 0x18a22[31m ; "COLUMNS"[0m
|
||
|
||
[32m0x000041ee[0m [37mlea[36m rsi[0m,[36m [0m[[36mrip [0m+[36m[36m [33m0x1d84b[0m][36m[0m[0m[31m ; 0x21a40[0m
|
||
[32m0x00004225[0m [37mlea[36m rdi[0m,[36m [0m[[36mrip [0m+[36m[36m [33m0x147f6[0m][36m[0m[0m[31m ; str.COLUMNS
|
||
[31m ; 0x18a22[31m ; "COLUMNS"[0m
|
||
|
||
,=< 0x000041e0 je 0x421a
|
||
| 0x000041e2 mov ecx, 4
|
||
| 0x000041e7 mov rax, qword [0x0001b980] ; [0x1b980:8]=0x100000000
|
||
| 0x000041ee mov rax, qword [0x00021a40] ; [0x21a40:8]=0x18d31 str.literal
|
||
| 0x000041f5 mov rdi, rax
|
||
| 0x000041f8 call 0xc660
|
||
| 0x000041fe test eax, eax
|
||
,==< 0x00004200 js 0x4ae5
|
||
|| 0x00004206 cdqe
|
||
|| 0x00004208 lea rdx, [0x0001b980]
|
||
|| 0x0000420f xor edi, edi
|
||
|| 0x00004211 mov esi, dword [rdx + rax*4]
|
||
|| 0x00004214 call 0x13c50
|
||
|`-> 0x0000421a mov qword [0x000232b0], 0x50 ; 'P'
|
||
| ; [0x232b0:8]=0
|
||
| 0x00004225 mov rax, qword [str.COLUMNS] ; [0x18a22:8]=0x534e4d554c4f43 ; "COLUMNS"
|
||
|
||
0x000041ee mov rax, qword [rip + 0x1d84b] ; [0x21a40:8]=0x18d31 str.literal
|
||
0x00004225 mov rax, qword [rip + 0x147f6] ; str.COLUMNS
|
||
; [0x18a22:8]=0x534e4d554c4f43 ; "COLUMNS"
|
||
|
||
[36m,[0m[36m=[0m[36m<[0m [32m0x000041e0[0m [32mje 0x421a[0m[0m
|
||
[36m|[0m [32m0x000041e2[0m [37mmov[36m ecx[0m,[36m[36m [33m4[0m[0m[0m
|
||
[36m|[0m [32m0x000041e7[0m [37mmov[36m rax[0m,[36m qword[36m [0m[[36m[33m0x0001b980[0m][36m[0m[0m[31m ; [[31m0x1b980[31m:8]=0x100000000[0m
|
||
[36m|[0m [32m0x000041ee[0m [37mmov[36m rax[0m,[36m qword[36m [0m[[36m[33m0x00021a40[0m][36m[0m[0m[31m ; [[31m0x21a40[31m:8]=0x18d31 str.literal[0m
|
||
[36m|[0m [32m0x000041f5[0m [37mmov[36m rdi[0m,[36m[36m rax[0m[0m[0m
|
||
[36m|[0m [32m0x000041f8[0m [1;92mcall 0xc660[0m[0m
|
||
[36m|[0m [32m0x000041fe[0m [36mtest[36m eax[0m,[36m[36m eax[0m[0m[0m
|
||
[36m,[0m[36m=[0m[36m=[0m[36m<[0m [32m0x00004200[0m [32mjs 0x4ae5[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004206[0m [37mcdqe[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004208[0m [37mlea[36m rdx[0m,[36m[36m [0m[[36m[33m0x0001b980[0m][36m[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x0000420f[0m [36mxor[36m edi[0m,[36m[36m edi[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004211[0m [37mmov[36m esi[0m,[36m dword [0m[[36mrdx [0m+[36m[36m rax[0m*[33m4[0m][36m[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004214[0m [1;92mcall 0x13c50[0m[0m
|
||
[36m|[0m[36m`[0m[36m-[0m[36m>[0m [32m0x0000421a[0m [37mmov qword[36m [0m[[36m[33m0x000232b0[0m][36m[0m,[36m[36m [33m0x50[0m[0m[31m ; 'P'
|
||
[36m|[0m [31m ; [0x232b0:8]=0[0m
|
||
[36m|[0m [32m0x00004225[0m [37mmov[36m rax[0m,[36m qword[36m [0m[[36m[36mstr.COLUMNS[0m][36m[0m[0m[31m ; [[31m0x18a22[31m:8]=0x534e4d554c4f43[31m ; "COLUMNS"[0m
|
||
|
||
[32m0x000041ee[0m [37mmov[36m rax[0m,[36m qword [0m[[36mrip [0m+[36m[36m [33m0x1d84b[0m][36m[0m[0m[31m ; [[31m0x21a40[31m:8]=0x18d31 str.literal[0m
|
||
[32m0x00004225[0m [37mmov[36m rax[0m,[36m qword [0m[[36mrip [0m+[36m[36m [33m0x147f6[0m][36m[0m[0m[31m ; str.COLUMNS
|
||
[31m ; [[31m0x18a22[31m:8]=0x534e4d554c4f43[31m ; "COLUMNS"[0m
|
||
|
||
,=< 0x000041e0 je 0x421a
|
||
| 0x000041e2 mov ecx, 4
|
||
| 0x000041e7 cmp rdx, qword [0x0001b980] ; [0x1b980:8]=0x100000000
|
||
| 0x000041ee cmp rsi, qword [0x00021a40] ; [0x21a40:8]=0x18d31 str.literal
|
||
| 0x000041f5 mov rdi, rax
|
||
| 0x000041f8 call 0xc660
|
||
| 0x000041fe test eax, eax
|
||
,==< 0x00004200 js 0x4ae5
|
||
|| 0x00004206 cdqe
|
||
|| 0x00004208 lea rdx, [0x0001b980]
|
||
|| 0x0000420f xor edi, edi
|
||
|| 0x00004211 mov esi, dword [rdx + rax*4]
|
||
|| 0x00004214 call 0x13c50
|
||
|`-> 0x0000421a mov qword [0x000232b0], 0x50 ; 'P'
|
||
| ; [0x232b0:8]=0
|
||
| 0x00004225 cmp rdi, qword [str.COLUMNS] ; [0x18a22:8]=0x534e4d554c4f43 ; "COLUMNS"
|
||
|
||
0x000041ee cmp rsi, qword [rip + 0x1d84b] ; [0x21a40:8]=0x18d31 str.literal
|
||
0x00004225 cmp rdi, qword [rip + 0x147f6] ; str.COLUMNS
|
||
; [0x18a22:8]=0x534e4d554c4f43 ; "COLUMNS"
|
||
|
||
[36m,[0m[36m=[0m[36m<[0m [32m0x000041e0[0m [32mje 0x421a[0m[0m
|
||
[36m|[0m [32m0x000041e2[0m [37mmov[36m ecx[0m,[36m[36m [33m4[0m[0m[0m
|
||
[36m|[0m [32m0x000041e7[0m [36mcmp[36m rdx[0m,[36m qword[36m [0m[[36m[33m0x0001b980[0m][36m[0m[0m[31m ; [[31m0x1b980[31m:8]=0x100000000[0m
|
||
[36m|[0m [32m0x000041ee[0m [36mcmp[36m rsi[0m,[36m qword[36m [0m[[36m[33m0x00021a40[0m][36m[0m[0m[31m ; [[31m0x21a40[31m:8]=0x18d31 str.literal[0m
|
||
[36m|[0m [32m0x000041f5[0m [37mmov[36m rdi[0m,[36m[36m rax[0m[0m[0m
|
||
[36m|[0m [32m0x000041f8[0m [1;92mcall 0xc660[0m[0m
|
||
[36m|[0m [32m0x000041fe[0m [36mtest[36m eax[0m,[36m[36m eax[0m[0m[0m
|
||
[36m,[0m[36m=[0m[36m=[0m[36m<[0m [32m0x00004200[0m [32mjs 0x4ae5[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004206[0m [37mcdqe[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004208[0m [37mlea[36m rdx[0m,[36m[36m [0m[[36m[33m0x0001b980[0m][36m[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x0000420f[0m [36mxor[36m edi[0m,[36m[36m edi[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004211[0m [37mmov[36m esi[0m,[36m dword [0m[[36mrdx [0m+[36m[36m rax[0m*[33m4[0m][36m[0m[0m[0m
|
||
[36m|[0m[36m|[0m [32m0x00004214[0m [1;92mcall 0x13c50[0m[0m
|
||
[36m|[0m[36m`[0m[36m-[0m[36m>[0m [32m0x0000421a[0m [37mmov qword[36m [0m[[36m[33m0x000232b0[0m][36m[0m,[36m[36m [33m0x50[0m[0m[31m ; 'P'
|
||
[36m|[0m [31m ; [0x232b0:8]=0[0m
|
||
[36m|[0m [32m0x00004225[0m [36mcmp[36m rdi[0m,[36m qword[36m [0m[[36m[36mstr.COLUMNS[0m][36m[0m[0m[31m ; [[31m0x18a22[31m:8]=0x534e4d554c4f43[31m ; "COLUMNS"[0m
|
||
|
||
[32m0x000041ee[0m [36mcmp[36m rsi[0m,[36m qword [0m[[36mrip [0m+[36m[36m [33m0x1d84b[0m][36m[0m[0m[31m ; [[31m0x21a40[31m:8]=0x18d31 str.literal[0m
|
||
[32m0x00004225[0m [36mcmp[36m rdi[0m,[36m qword [0m[[36mrip [0m+[36m[36m [33m0x147f6[0m][36m[0m[0m[31m ; str.COLUMNS
|
||
[31m ; [[31m0x18a22[31m:8]=0x534e4d554c4f43[31m ; "COLUMNS"[0m
|
||
EOF
|
||
RUN
|
||
|
||
NAME=lea section flag bracket fix
|
||
FILE=../bins/elf/analysis/ls-alxchk
|
||
CMDS=<<EOF
|
||
s 0x5e6e
|
||
e scr.color=0
|
||
pd 1
|
||
e scr.color=1
|
||
pd 1
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x00005e6e 488d3d339b01. lea rdi, section..fini_array ; 0x1f9a8
|
||
[32m0x00005e6e[0m [33m48[37m8d[33m3d[33m33[37m9b[37m01[37m.[0m [37mlea[36m rdi[0m,[36m[36m [0m[36msection..fini_array[0m[36m[0m[0m[31m ; 0x1f9a8[0m
|
||
EOF
|
||
RUN
|
||
|
||
NAME=pi no-color rip-relative addr fix
|
||
FILE=../bins/elf/ls
|
||
CMDS=<<EOF
|
||
e scr.color=0
|
||
s 0x000041e0
|
||
pi 15
|
||
EOF
|
||
EXPECT=<<EOF
|
||
je 0x421a
|
||
mov ecx, 4
|
||
lea rdx, [0x0001b980]
|
||
lea rsi, [0x00021a40]
|
||
mov rdi, rax
|
||
call 0xc660
|
||
test eax, eax
|
||
js 0x4ae5
|
||
cdqe
|
||
lea rdx, [0x0001b980]
|
||
xor edi, edi
|
||
mov esi, dword [rdx + rax*4]
|
||
call 0x13c50
|
||
mov qword [0x000232b0], 0x50
|
||
lea rdi, str.COLUMNS
|
||
EOF
|
||
RUN
|
||
|
||
NAME=esil call no-fcn-name cmt alignment
|
||
FILE=../bins/elf/analysis/arm-ls
|
||
CMDS=<<EOF
|
||
e asm.bytes=false
|
||
e emu.pre=true
|
||
e emu.str=true
|
||
pd 1 @ 0x00011ee4
|
||
EOF
|
||
EXPECT=<<EOF
|
||
0x00011ee4 bl 0x2258c ; 0x2258c(0x19ac0, 0x25c0c, 0x0, 0x372cc)
|
||
EOF
|
||
RUN
|
||
|
||
NAME=bin.str.enc no-guess with initial null
|
||
FILE=../bins/elf/utfbe&bom
|
||
CMDS=<<EOF
|
||
e asm.bytes=false
|
||
e asm.offset=false
|
||
e asm.cmt.off=false
|
||
aar
|
||
(pdenc enc; e bin.str.enc=$0; pd 1)
|
||
(pdstr bits; s `axt obj.utf$0be~[1]`; .(pdenc guess); .(pdenc utf$0le); .(pdenc utf$0be))
|
||
.(pdstr 16)
|
||
?e
|
||
.(pdstr 32)
|
||
EOF
|
||
EXPECT=<<EOF
|
||
mov esi, obj.utf16be
|
||
mov esi, obj.utf16be ; u"\u5500\u5400\u4600\u3100\u3600\u4200\u4500"
|
||
mov esi, obj.utf16be ; ub"UTF16BE"
|
||
|
||
mov esi, obj.utf32be
|
||
mov esi, obj.utf32be ; U"\U55000000\U54000000\U46000000\U33000000\U32000000\U42000000\U45000000"
|
||
mov esi, obj.utf32be ; Ub"UTF32BE"
|
||
EOF
|
||
RUN
|
||
|
||
NAME=bin.str.enc guess bom, asm.cmt.off=0/1
|
||
FILE=../bins/elf/utfbe&bom
|
||
CMDS=<<EOF
|
||
e asm.bytes=0
|
||
e asm.offset=0
|
||
e asm.cmt.off=0
|
||
e bin.str.enc=guess
|
||
aar
|
||
(pdstr flag; s `axt obj.$0~[1]`; pd 1)
|
||
.(pdstr utf8_bom)
|
||
.(pdstr utf16le_bom)
|
||
.(pdstr utf16be_bom)
|
||
.(pdstr utf32le_bom)
|
||
.(pdstr utf32be_bom)
|
||
?e
|
||
e asm.cmt.off=1
|
||
.(pdstr utf32be_bom)
|
||
e asm.cmt.off=off
|
||
.(pdstr utf32be_bom)
|
||
EOF
|
||
EXPECT=<<EOF
|
||
mov esi, obj.utf8_bom ; "\ufeffUTF8_BOM"
|
||
mov esi, obj.utf16le_bom ; u"\ufeffUTF16LE_BOM"
|
||
mov esi, obj.utf16be_bom ; ub"\ufeffUTF16BE_BOM"
|
||
mov esi, obj.utf32le_bom ; U"\ufeffUTF32LE_BOM"
|
||
mov esi, obj.utf32be_bom ; Ub"\ufeffUTF32BE_BOM"
|
||
|
||
mov esi, obj.utf32be_bom ; 0x4041e0 ; Ub"\ufeffUTF32BE_BOM"
|
||
mov esi, obj.utf32be_bom ; Ub"\ufeffUTF32BE_BOM"
|
||
EOF
|
||
RUN
|
||
|
||
NAME=no-anal asm.symbol from fcn mid
|
||
FILE=../bins/elf/analysis/tiny1
|
||
CMDS=<<EOF
|
||
e asm.symbol=true
|
||
e asm.bytes=false
|
||
e asm.offset=false
|
||
e asm.comments=false
|
||
s entry0 + 2
|
||
pd 2
|
||
?e
|
||
s segment.LOAD0 + 83
|
||
pd 4
|
||
?e
|
||
s entry0
|
||
pd 3
|
||
EOF
|
||
EXPECT=<<EOF
|
||
entry0 + 2 xor eax, eax
|
||
entry0 + 4 inc eax
|
||
|
||
segment.LOAD0 + 83 ~ add byte [ebx + 0x40c0312a], dh
|
||
entry0 + 0 ;-- entry0:
|
||
entry0 + 0 mov bl, 0x2a
|
||
entry0 + 2 xor eax, eax
|
||
entry0 + 4 inc eax
|
||
|
||
entry0 + 0 ;-- entry0:
|
||
entry0 + 0 mov bl, 0x2a
|
||
entry0 + 2 xor eax, eax
|
||
entry0 + 4 inc eax
|
||
EOF
|
||
RUN
|