NAME=agfj resolv reloc symbols
FILE=bins/elf/ls
CMDS=<<EOF
aa 2> /dev/null
aac 2> /dev/null
sf loc.0000f190
agfj~reloc.free
EOF
EXPECT=<<EOF
[{"name":"loc.0000f190","offset":61840,"ninstr":7,"nargs":0,"nlocals":0,"size":23,"stack":8,"type":"loc","blocks":[{"offset":61840,"size":23,"colorize":0,"ops":[{"offset":61840,"esil":"rbx,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"push rbx","disasm":"push rbx","bytes":"53","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["loc.0000f190"],"xrefs":[{"addr":53124,"type":"DATA"},{"addr":54437,"type":"CODE"}]},{"offset":61841,"esil":"rdi,rbx,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rbx, rdi","disasm":"mov rbx, rdi","bytes":"4889fb","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61844,"esil":"rdi,[8],rdi,=","refptr":true,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, qword [rdi]","disasm":"mov rdi, qword [rdi]","bytes":"488b3f","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61847,"ptr":138400,"esil":"0x12b03,rip,+,[8],rip,8,rsp,-=,rsp,=[],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"call qword [rip + 0x12b03]","disasm":"call qword [reloc.free]","bytes":"ff15032b0100","family":"cpu","type":"ucall","reloc":false,"type_num":402653188,"type2_num":0,"refs":[{"addr":138400,"type":"CALL"}]},{"offset":61853,"esil":"rbx,rdi,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, rbx","disasm":"mov rdi, rbx","bytes":"4889df","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61856,"esil":"rsp,[8],rbx,=,8,rsp,+=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"pop rbx","disasm":"pop rbx","bytes":"5b","family":"cpu","type":"pop","reloc":false,"type_num":14,"type2_num":0},{"offset":61857,"ptr":138400,"esil":"0x12af9,rip,+,[8],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"jmp qword [rip + 0x12af9]","disasm":"jmp qword [reloc.free]","bytes":"ff25f92a0100","family":"cpu","type":"ujmp","reloc":false,"type_num":402653186,"type2_num":0,"refs":[{"addr":138400,"type":"DATA"}]}]}]}]
EOF
RUN

NAME=agfJ
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bytes=true
e asm.bits=64
s 0x42
wx 00004883f80074060000000000000000c3
af
agfJ
EOF
EXPECT=<<EOF
[{"name":"fcn.00000042","offset":66,"ninstr":8,"nargs":0,"nlocals":0,"size":17,"stack":0,"type":"fcn","blocks":[{"offset":66,"size":8,"jump":80,"fail":74,"colorize":0,"ops":[{"offset":66,"text":"17: fcn.00000042 ();"},{"offset":66,"text":"     0000           add   byte [rax], al"},{"offset":68,"text":"     4883f800       cmp   rax, 0"},{"offset":72,"arrow":80,"text":"     7406           je    0x50"}]},{"offset":74,"size":6,"jump":80,"colorize":0,"ops":[{"offset":74,"text":"     0000           add   byte [rax], al"},{"offset":76,"text":"     0000           add   byte [rax], al"},{"offset":78,"text":"     0000           add   byte [rax], al"}]},{"offset":80,"size":3,"colorize":0,"ops":[{"offset":80,"text":"     0000           add   byte [rax], al"},{"offset":82,"text":"     c3             ret"}]}]}]
EOF
RUN
