Skip to content

Commit

Permalink
Fix all dwarf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Nov 22, 2016
1 parent d9e21ff commit 8b8475b
Showing 1 changed file with 73 additions and 30 deletions.
103 changes: 73 additions & 30 deletions t/pdf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ EXPECT=' ;-- main:
| sym.main ();
| ; var int local_4h @ rbp-0x4
| ; DATA XREF from 0x0040045d (entry0)
| 0x0040052d 55 push rbp ; dwarftest.c:4
| 0x0040052d 55 push rbp ; dwarftest.c:4 {
'
run_test

Expand All @@ -37,24 +37,24 @@ BROKEN=
FILE=/tmp/r2-regressions/dwarftest
IGNORE_ERR=1
ARGS=
BROKEN=1
BROKEN=
CMDS='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)
EXPECT=' ;-- main:
/ (fcn) sym.main 44
| sym.main (int arg_fch);
| ; arg int arg_fch @ rbp+0xfc
| 0x0040052d 55 push rbp ; dwarftest.c:4 {
'
run_test

NAME="pdf dwarf invalid main with dir.source"
BROKEN=1
BROKEN=
FILE=/tmp/r2-regressions/dwarftest
IGNORE_ERR=1
ARGS=
Expand All @@ -66,11 +66,11 @@ 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)
EXPECT=' ;-- main:
/ (fcn) sym.main 44
| sym.main (int arg_fch);
| ; arg int arg_fch @ rbp+0xfc
| 0x0040052d 55 push rbp ; dwarftest.c:4 {
'
run_test

Expand All @@ -92,31 +92,35 @@ EXPECT=' ;-- main:
/ (fcn) sym.main 44
| sym.main (int arg_fch);
| ; arg int arg_fch @ rbp+0xfc
| 0x0040052d 55 push rbp ; dwarftest.c:4 { ; dwarftest.c:4
| 0x0040052d 55 push rbp ; 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
| 0x00400535 c745fc000000. mov dword [rbp-0x4], 0x0 ; dwarftest.c:7 for (i = 0; i < 5; i++) { ; [0xfc:4]=0
| ,=< 0x0040053c eb0e jmp 0x40054c
| .--> 0x0040053e bfe4054000 mov edi, str.dwarftest ; dwarftest.c:8 printf ("dwarftest\n"); ; "dwarftest" @ 0x4005e4 ; dwarftest.c:8
| .--> 0x0040053e bfe4054000 mov edi, str.dwarftest ; dwarftest.c:8 printf ("dwarftest\n"); ; "dwarftest" @ 0x4005e4
| || 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
| || 0x00400548 8345fc01 add dword [rbp-0x4], 0x1 ; dwarftest.c:7 for (i = 0; i < 5; i++) {
| || ; JMP XREF from 0x0040053c (sym.main)
| |`-> 0x0040054c 837dfc04 cmp dword [rbp-0x4], 0x4 ; [0xfc:4]=0 ; dwarftest.c:7
| |`-> 0x0040054c 837dfc04 cmp dword [rbp-0x4], 0x4 ; [0xfc:4]=0
| `==< 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
| 0x00400552 b800000000 mov eax, 0x0 ; dwarftest.c:11 return 0;
| 0x00400557 c9 leave ; dwarftest.c:12 }
\ 0x00400558 c3 ret
'
run_test

NAME="pdf dwarf dir.source"
NAME="pdf dwarf abspath"
BROKEN=
FILE=/tmp/r2-regressions/dwarftest
IGNORE_ERR=1
ARGS=
CMDS='e asm.dwarf=true
CMDS='
e asm.dwarf=true
e asm.dwarf.file=true
e asm.dwarf.abspath=true
e scr.interactive=false
e dir.source=/tmp/r2-regressions
e dir.source=
e asm.comments=true
e asm.arch=x86.udis
e asm.varsub=false
e anal.eobjmp=false
Expand All @@ -127,19 +131,58 @@ EXPECT=' ;-- main:
/ (fcn) sym.main 44
| sym.main (int arg_fch);
| ; arg int arg_fch @ rbp+0xfc
| 0x0040052d 55 push rbp ; dwarftest.c:4 { ; dwarftest.c:4
| 0x0040052d 55 push rbp ; /tmp/r2-regressions/.//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
| 0x00400535 c745fc000000. mov dword [rbp-0x4], 0x0 ; /tmp/r2-regressions/.//dwarftest.c:7 for (i = 0; i < 5; i++) { ; [0xfc:4]=0
| ,=< 0x0040053c eb0e jmp 0x40054c
| .--> 0x0040053e bfe4054000 mov edi, str.dwarftest ; dwarftest.c:8 printf ("dwarftest\n"); ; "dwarftest" @ 0x4005e4 ; dwarftest.c:8
| .--> 0x0040053e bfe4054000 mov edi, str.dwarftest ; /tmp/r2-regressions/.//dwarftest.c:8 printf ("dwarftest\n"); ; "dwarftest" @ 0x4005e4
| || 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
| || 0x00400548 8345fc01 add dword [rbp-0x4], 0x1 ; /tmp/r2-regressions/.//dwarftest.c:7 for (i = 0; i < 5; i++) {
| || ; JMP XREF from 0x0040053c (sym.main)
| |`-> 0x0040054c 837dfc04 cmp dword [rbp-0x4], 0x4 ; [0xfc:4]=0 ; dwarftest.c:7
| |`-> 0x0040054c 837dfc04 cmp dword [rbp-0x4], 0x4 ; [0xfc:4]=0
| `==< 0x00400550 7eec jle 0x40053e
| 0x00400552 b800000000 mov eax, 0x0 ; /tmp/r2-regressions/.//dwarftest.c:11 return 0;
| 0x00400557 c9 leave ; /tmp/r2-regressions/.//dwarftest.c:12 }
\ 0x00400558 c3 ret
'
run_test

NAME="pdf dwarf without dir.source"
BROKEN=
FILE=/tmp/r2-regressions/dwarftest
IGNORE_ERR=1
ARGS=
CMDS='e asm.dwarf=true
e asm.dwarf.file=true
e asm.dwarf.abspath=false
e scr.interactive=false
e dir.source=
e asm.comments=false
e asm.arch=x86.udis
e asm.varsub=false
e anal.eobjmp=false
e anal.nopskip=true
af@main
pdf@main'
EXPECT=' ;-- main:
/ (fcn) sym.main 44
| sym.main (int arg_fch);
| ; arg int arg_fch @ rbp+0xfc
| 0x0040052d 55 push rbp ; 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++) {
| ,=< 0x0040053c eb0e jmp 0x40054c
| .--> 0x0040053e bfe4054000 mov edi, str.dwarftest ; dwarftest.c:8 printf ("dwarftest\n");
| || 0x00400543 e8c8feffff call sym.imp.puts
| || 0x00400548 8345fc01 add dword [rbp-0x4], 0x1 ; dwarftest.c:7 for (i = 0; i < 5; i++) {
| |`-> 0x0040054c 837dfc04 cmp dword [rbp-0x4], 0x4
| `==< 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
| 0x00400552 b800000000 mov eax, 0x0 ; dwarftest.c:11 return 0;
| 0x00400557 c9 leave ; dwarftest.c:12 }
\ 0x00400558 c3 ret
'
run_test
exit 1
exit 1

0 comments on commit 8b8475b

Please sign in to comment.