radare2/test/new/db/cmd/cmd_graph

357 lines
6.3 KiB
Plaintext
Raw Normal View History

NAME=one node
FILE=-
EXPECT=<<EOF
agraph.nodes=title1
agraph.nodes.title1.body=base64:Ym9keTE=
agraph.nodes.title1.w=0x16
agraph.nodes.title1.h=0x4
EOF
CMDS=<<EOF
agn title1 body1
aggk~nodes=
aggk~nodes.title1.body
aggk~nodes.title1.w
aggk~nodes.title1.h
EOF
RUN
NAME=two nodes
FILE=-
EXPECT=<<EOF
agraph.nodes=Title with super long text and space,title2
agraph.nodes.Title with super long text and space.body=base64:Ym9keTE=
agraph.nodes.title2.body=base64:U3VwZXJMb25nQm9keVdpdGhBTG90IE9mIHRleHQgYW5kIHNwYWNlcw==
agraph.nodes.Title with super long text and space.w=0x2a
agraph.nodes.Title with super long text and space.h=0x4
agraph.nodes.title2.w=0x2c
agraph.nodes.title2.h=0x4
EOF
CMDS=<<EOF
agn "Title with super long text and space" body1
agn title2 "SuperLongBodyWithALot Of text and spaces"
aggk~nodes=
aggk~nodes.Title with super long text and space.body=
aggk~nodes.title2.body=
aggk~nodes.Title with super long text and space.w
aggk~nodes.Title with super long text and space.h
aggk~nodes.title2.w
aggk~nodes.title2.h
EOF
RUN
NAME=base64 body
FILE=-
EXPECT=<<EOF
agraph.nodes.title1.body=base64:aGVsbG8gd29ybGQ=
EOF
CMDS=<<EOF
agn title1 base64:aGVsbG8gd29ybGQ=
aggk~nodes.title1.body=
EOF
RUN
NAME=long base64 body
FILE=-
EXPECT=<<EOF
agraph.nodes.title1.body=base64:dGhpcyBpcyBhIHZlcnkgbG9uZyB0ZXh0IHRoYXQgd2hlbiBlbmNvZGVkIHdpbGwgY2F1c2UgYSAKIGluIHRoZSBiYXNlNjQ=
EOF
CMDS=<<EOF
agn title1 base64:dGhpcyBpcyBhIHZlcnkgbG9uZyB0ZXh0IHRoYXQgd2hlbiBlbmNvZGVkIHdpbGwgY2F1c2UgYSAKIGluIHRoZSBiYXNlNjQ=
aggk~nodes.title1.body=
EOF
RUN
NAME=two nodes same title
FILE=-
EXPECT=<<EOF
agraph.nodes=title1
agraph.nodes.title1.body=base64:Ym9keTE=
agraph.nodes.title1.w=0x16
EOF
CMDS=<<EOF
agn title1 body1
agn title1 "Super long body with something"
agn title1 "Super super super long body to do tests........"
aggk~nodes=
aggk~nodes.title1.body=
aggk~nodes.title1.w=
EOF
RUN
NAME=remove node
FILE=-
EXPECT=<<EOF
EOF
CMDS=<<EOF
agn title1 body1
agn- title1
aggk~nodes=
aggk~nodes.title1
EOF
RUN
NAME=remove node with title that contain spaces
FILE=-
EXPECT=<<EOF
EOF
CMDS=<<EOF
agn "Title with spaces" body1
agn- "Title with spaces"
aggk~nodes=
aggk~nodes.Title with spaces
EOF
RUN
NAME=remove non-existent node
FILE=-
EXPECT=<<EOF
agraph.nodes=Title with spaces
agraph.nodes.Title with spaces.body=base64:Ym9keTE=
EOF
CMDS=<<EOF
agn "Title with spaces" body1
agn- NotValid
aggk~nodes=
aggk~nodes.Title with spaces.body=
EOF
RUN
NAME=remove edge
FILE=-
EXPECT=<<EOF
agraph.nodes=Title with spaces,Title with spaces 2
EOF
CMDS=<<EOF
agn "Title with spaces" body1
agn "Title with spaces 2" body2
age- "Title with spaces" "Title with spaces 2"
aggk~nodes=
aggk~nodes.Title with spaces.neighbours=
EOF
RUN
NAME=get graph of a function
FILE=../bins/elf/analysis/hello-linux-x86_64
BROKEN=1
EXPECT=<<EOF
agraph.nodes=0x400410
EOF
CMDS=<<EOF
af
aggk $$~nodes=
EOF
RUN
NAME=no selected node in non-interactive
FILE=-
EXPECT=<<EOF
.--------------------.
| title1 |
| body1 |
`--------------------'
EOF
CMDS=<<EOF
agn title1 body1
agg
EOF
RUN
NAME=agf one
FILE=-
EXPECT=<<EOF
[0x00000000]> # fcn.00000000 ();
----------------------.
| 0x0 |
| (fcn) fcn.00000000 5 |
| push ebp |
| mov ebp, esp |
| pop ebp |
| ret |
`----------------------'
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
e asm.calls=false
"wa push ebp;mov ebp,esp;pop ebp;ret"
af
agf
EOF
RUN
NAME=agg one
FILE=-
EXPECT=<<EOF
.--------------------.
| 0x0 |
| push ebp |
| mov ebp, esp |
| pop ebp |
| ret |
`--------------------'
EOF
CMDS=<<EOF
agn 0x0 base64:cHVzaCBlYnAKbW92IGVicCwgZXNwCnBvcCBlYnAKcmV0
agg
EOF
RUN
NAME=graph size
FILE=-
EXPECT=<<EOF
agraph.w=0
agraph.h=0
agraph.w=22
agraph.h=7
EOF
CMDS=<<EOF
aggk~agraph.w=
aggk~agraph.h=
agn title1 body1
aggk~agraph.w=
aggk~agraph.h=
EOF
RUN
NAME=graph size with edges
FILE=-
EXPECT=<<EOF
EOF
CMDS=<<EOF
agn title1 body1
agn title2 "body2 long body with a lot of spaces and dots...."
agn title3 body3
age title1 title2
age title2 title3
age title1 title3
age title3 title1
aggk~agraph.w=0x35
agg | head -2 | tail -1 | tr -d " " | grep "=----------------="
EOF
RUN
NAME=graph size with self-referenced bb
FILE=-
EXPECT=<<EOF
EOF
CMDS=<<EOF
agn title1 body1
age title1 title1
aggk~agraph.w=0x16
aggk~agraph.h=0x4
EOF
RUN
NAME=graph title
FILE=-
EXPECT=<<EOF
This is the graph title
.--------------------.
| title1 |
| body1 |
`--------------------'
EOF
CMDS=<<EOF
agn title1 body1
e graph.title=This is the graph title
agg
EOF
RUN
NAME=print r2 commands to create graph
FILE=-
EXPECT=<<EOF
agn "title3" base64:dGhpcyBpcyBteSBib2R5CndpdGggbmV3bGluZXM=
agn "title2" base64:Ym9keTI=
agn "title1" base64:Ym9keTE=
age "title3" "title1"
age "title1" "title2"
EOF
CMDS=<<EOF
agn title1 body1
agn title2 body2
agn title3 base64:dGhpcyBpcyBteSBib2R5CndpdGggbmV3bGluZXM=
age title1 title2
age title3 title1
agg*
EOF
RUN
NAME=graph self-ref block
FILE=-
EXPECT=<<EOF
.----.
| |
|.--------------------.
|| title1 |
|| body1 |
|`--------------------'
| v
| |
`----'
EOF
CMDS=<<EOF
agn title1 body1
age title1 title1
agg
EOF
RUN
NAME=with anal.nopskip
FILE=../bins/elf/analysis/ls-alxchk
EXPECT=<<EOF
EOF
CMDS=<<EOF
e anal.nopskip=true
aaa
s 0x00011390
agf > /dev/null
EOF
RUN
NAME=super mario block (#8788)
FILE=../bins/elf/analysis/hello-android-mips
EXPECT=<<EOF
[0x0008049c]> # super_mario_fix ();
--------------------------------------------.
| 0x8049c |
| 8: super_mario_fix (); |
| ; segment.ehdr |
| lui v0, 8 |
| ; "\u00a2\u00a2\u00a2World" sym..rodata |
| addiu a0, v0, 0x510 |
`--------------------------------------------'
[0x0008049c]> # super_mario_fix ();
-----------------------------.
| 0x8049c |
| 8: super_mario_fix (); |
| ; segment.ehdr |
| lui v0, 8 |
| ; "...World" sym..rodata |
| addiu a0, v0, 0x510 |
`-----------------------------'
EOF
CMDS=<<EOF
e emu.str=true
s 0x0008049c
af+ 0x0008049c super_mario_fix
afb+ 0x0008049c 0x0008049c 8
e io.cache=true
wx c2a2c2a2c2a2 @ 0x80510
e bin.str.enc=utf8
agf
e scr.strconv=asciidot
agf
EOF
RUN
NAME=agf
FILE=../bins/mach0/ls-osx-x86_64
EXPECT=<<EOF
EOF
CMDS=<<EOF
af
agf > /dev/null
EOF
RUN