Skip to content

Commit

Permalink
Add test for dir.source in asm.dwarf
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Oct 29, 2015
1 parent 8247a5e commit 3498217
Showing 1 changed file with 62 additions and 6 deletions.
68 changes: 62 additions & 6 deletions t/dwarf/pdf
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,31 @@ e anal.nopskip=true # if set to true it fucks the test
af@main # full analysis fuckups main
pd 1 @main'
EXPECT='/ (fcn) sym.main 44
| ; arg int arg_31_4 @ rbp+0xfc
| ;-- main:
| ;-- sym.main:
| 0x0040052d 55 push rbp ; /tmp/r2-regressions/.//dwarftest.c:4 int main(void)
| ; arg int arg_31_4 @ rbp+0xfc
| ;-- main:
| ;-- sym.main:
| 0x0040052d 55 push rbp ; dwarftest.c:4 int main(void)
'
run_test

NAME="pdf dwarf invalid main with dir.source"
BROKEN=1
FILE=/tmp/r2-regressions/dwarftest
IGNORE_ERR=1
ARGS=
CMDS='e dir.source=/tmp/r2-regressions
e asm.dwarf=true
e asm.arch=x86.udis
e anal.eobjmp=false
e asm.varsub=false
e anal.nopskip=true # if set to true it fucks the test
af@main # full analysis fuckups main
pd 1 @main'
EXPECT='/ (fcn) sym.main 44
| ; arg int arg_31_4 @ rbp+0xfc
| ;-- main:
| ;-- sym.main:
| 0x0040052d 55 push rbp ; dwarftest.c:4 int main(void)
'
run_test

Expand All @@ -51,9 +72,9 @@ BROKEN=
FILE=/tmp/r2-regressions/dwarftest
IGNORE_ERR=1
ARGS=
BROKEN=1
CMDS='e asm.dwarf=true
e scr.interactive=false
e dir.source=/tmp/r2-regressions
e asm.arch=x86.udis
e asm.varsub=false
e anal.eobjmp=false
Expand All @@ -63,7 +84,7 @@ pdf@main'
EXPECT='/ (fcn) sym.main 44
| ; arg int arg_31_4 @ rbp+0xfc
| ;-- main:
| ;-- sym.main:
| 0x0040052c 55 push rbp ; dwarftest.c:4
| 0x0040052d 55 push rbp ; /tmp/r2-regressions/.//dwarftest.c:4 int main(void)
| 0x0040052e 4889e5 mov rbp, rsp
| 0x00400531 4883ec10 sub rsp, 0x10
Expand All @@ -81,6 +102,41 @@ EXPECT='/ (fcn) sym.main 44
| 0x00400557 c9 leave ; /tmp/r2-regressions/.//dwarftest.c:12 .return 0;
\ 0x00400558 c3 ret
'
run-test

NAME="pdf dwarf dir.source"
BROKEN=
FILE=/tmp/r2-regressions/dwarftest
IGNORE_ERR=1
ARGS=
CMDS='e asm.dwarf=true
e scr.interactive=false
e dir.source=/tmp/r2-regressions
e asm.arch=x86.udis
e asm.varsub=false
e anal.eobjmp=false
e anal.nopskip=true
af@main
pdf@main'
EXPECT='/ (fcn) sym.main 44
| ; arg int arg_31_4 @ rbp+0xfc
| ;-- main:
| 0x0040052d 55 push rbp ; dwarftest.c:4 { ; dwarftest.c:4
| 0x0040052e 4889e5 mov rbp, rsp
| 0x00400531 4883ec10 sub rsp, 0x10
| 0x00400535 c745fc000000. mov dword [rbp-0x4], 0x0 ; dwarftest.c:7 for (i = 0; i < 5; i++) { ; [0xfc:4]=0 ; dwarftest.c:7
| ,=< 0x0040053c eb0e jmp 0x40054c
| | 0x0040053e bfe4054000 mov edi, str.dwarftest ; dwarftest.c:8 printf ("dwarftest\n"); ; "dwarftest" @ 0x4005e4 ; dwarftest.c:8
| | 0x00400543 e8c8feffff call sym.imp.puts
| | 0x00400548 8345fc01 add dword [rbp-0x4], 0x1 ; dwarftest.c:7 for (i = 0; i < 5; i++) { ; dwarftest.c:7
| | ; JMP XREF from 0x0040053c (sym.main)
| `-> 0x0040054c 837dfc04 cmp dword [rbp-0x4], 0x4 ; [0xfc:4]=0 ; dwarftest.c:7
| 0x00400550 7eec jle 0x40053e
| 0x00400552 b800000000 mov eax, 0x0 ; dwarftest.c:11 return 0; ; dwarftest.c:11
| 0x00400557 c9 leave ; dwarftest.c:12 } ; dwarftest.c:12
\ 0x00400558 c3 ret
'
run-test

mkdir -p /tmp/r2-regressions/

Expand Down

0 comments on commit 3498217

Please sign in to comment.