NAME=zs unset
FILE=-
CMDS=<<EOF
zs test1
za foo1 b aabbccdd
za bar1 b aabbccdd
zs test2
za foo2 b aabbccdd
za bar2 b aabbccdd
zs test3
za foo3 b aabbccdd
za bar3 b aabbccdd
zs *
zs- test2
z~foo1
z~bar1
z~foo2
z~bar2
z~foo3
z~bar3
EOF
EXPECT=<<EOF
(test1) foo1:
(test1) bar1:
foo2:
bar2:
(test3) foo3:
(test3) bar3:
EOF
RUN

NAME=zsr newname
FILE=-
CMDS=<<EOF
zs test1
za foo1 b aabbccdd
za bar1 b aabbccdd
zs test2
za foo2 b aabbccdd
za bar2 b aabbccdd
zs test3
za foo3 b aabbccdd
za bar3 b aabbccdd
zs test2
zsr newtest2
zs *
z~foo1
z~bar1
z~foo2
z~bar2
z~foo3
z~bar3
EOF
EXPECT=<<EOF
(test1) foo1:
(test1) bar1:
(newtest2) foo2:
(newtest2) bar2:
(test3) foo3:
(test3) bar3:
EOF
RUN

NAME=zsr newname (dupplicated name)
FILE=-
CMDS=<<EOF
zs test1
za foo1 b aabbccdd
za bar1 b aabbccdd
zs test2
za foo2 b aabbccdd
za bar2 b aabbccdd
zs test3
za foo3 b aabbccdd
za bar3 b aabbccdd
zs test2
zsr test1
zs *
z~foo1
z~bar1
z~foo2
z~bar2
z~foo3
z~bar3
EOF
EXPECT=<<EOF
(test1) foo1:
(test1) bar1:
(test2) foo2:
(test2) bar2:
(test3) foo3:
(test3) bar3:
EOF
RUN

NAME=zsr newname (root zs)
FILE=-
CMDS=<<EOF
zs test1
za foo1 b aabbccdd
za bar1 b aabbccdd
zs test2
za foo2 b aabbccdd
za bar2 b aabbccdd
zs test3
za foo3 b aabbccdd
za bar3 b aabbccdd
zs *
zsr newtest
z~foo1
z~bar1
z~foo2
z~bar2
z~foo3
z~bar3
EOF
EXPECT=<<EOF
(test1) foo1:
(test1) bar1:
(test2) foo2:
(test2) bar2:
(test3) foo3:
(test3) bar3:
EOF
RUN

NAME=z-
FILE=-
CMDS=<<EOF
zs test
za foo b aa
zs test2
za foo b aa
za bar b bb
zs *
z- foo
z
zs test2
z- foo
z
zs *
z
zs- test
z
z- foo
z
EOF
EXPECT=<<EOF
(test2) bar:
  bytes: bb
  mask: ff
(test) foo:
  bytes: aa
  mask: ff
(test2) foo:
  bytes: aa
  mask: ff
bar:
  bytes: bb
  mask: ff
(test2) bar:
  bytes: bb
  mask: ff
(test) foo:
  bytes: aa
  mask: ff
(test2) bar:
  bytes: bb
  mask: ff
foo:
  bytes: aa
  mask: ff
(test2) bar:
  bytes: bb
  mask: ff
EOF
RUN

NAME=z-*
FILE=-
CMDS=<<EOF
zs test1
za foo1 b aabbccdd
za bar1 b aabbccdd
zs test2
za foo2 b aabbccdd
za bar2 b aabbccdd
zs test3
za foo3 b aabbccdd
za bar3 b aabbccdd
zs test2
z- *
zs *
z~foo2
z~bar2
EOF
EXPECT=<<EOF
EOF
RUN

NAME=za b and binmasks
FILE=-
CMDS=<<EOF
za test b .abbc.dd..
z
EOF
EXPECT=<<EOF
test:
  bytes: 0abbc0dd00
  mask: 0ffff0ff00
EOF
RUN

NAME=za b zero mask
FILE=-
CMDS=<<EOF
za test b ....
z
EOF
EXPECT=<<EOF
EOF
RUN

NAME=za g
FILE=-
CMDS=<<EOF
za test g cc=1 nbbs=2 edges=3 ebbs=4
z
EOF
EXPECT=<<EOF
test:
  graph: cc=1 nbbs=2 edges=3 ebbs=4 bbsum=0
EOF
RUN

NAME=za o
FILE=-
CMDS=<<EOF
za test o 0x8048123
z
EOF
EXPECT=<<EOF
test:
  addr: 0x08048123
EOF
RUN

NAME=za r
FILE=-
CMDS=<<EOF
za test r sym1 sym3 sym2
z
EOF
EXPECT=<<EOF
test:
  refs: sym1, sym3, sym2
EOF
RUN

NAME=za b + z/
FILE=bins/elf/analysis/go_stripped
CMDS=<<EOF
za sym.fmt.Println b 653b2530000000724b53b834e7150883ec188b15401c22088d4c24048b5c242083ec08ff742434ff742434ff742434525051e829ffffff8b44242089038b4424248943048b44242889430889d883c4345bc204006a106a1ce85e350700c20400
z/
?v sign.bytes.sym.fmt.Println_0
EOF
EXPECT=<<EOF
0x805b030
EOF
RUN

NAME=za a + z/
FILE=bins/elf/analysis/go_stripped
CMDS=<<EOF
za sym.fmt.Println a 653b2530000000724b53b834e7150883ec188b15401c22088d4c24048b5c242083ec08ff742434ff742434ff742434525051e829ffffff8b44242089038b4424248943048b44242889430889d883c4345bc204006a106a1ce85e350700c20400
z/
?v sign.bytes.sym.fmt.Println_1
EOF
EXPECT=<<EOF
0x805b030
EOF
RUN

NAME=za r + z/
FILE=bins/elf/analysis/zigs
CMDS=<<EOF
aaa
za main r sym.print
z/
?v sign.refs.main_0
EOF
EXPECT=<<EOF
0x40055b
EOF
RUN

NAME=z/ with search.in
FILE=bins/elf/analysis/go_stripped
CMDS=<<EOF
za date_string b 323030362d30312d30322031353a30343a30352e393939393939393939202d30373030204d535400
za sym.fmt.Println b 653b2530000000724b53b834e7150883ec188b15401c22088d4c24048b5c242083ec08ff742434ff742434ff742434525051e829ffffff8b44242089038b4424248943048b44242889430889d883c4345bc204006a106a1ce85e350700c20400
fs sign
f~?
e io.va=0
e search.in=file
z/
e io.va=1
?v sign.bytes.date_string_0
?v sign.bytes.sym.fmt.Println_0
f-*
f~?
e search.in=bin.sections.x
z/
?v sign.bytes.elf_header_0
?v sign.bytes.sym.fmt.Println_0
EOF
EXPECT=<<EOF
0
0x15d898
0x13030
0
0x0
0x805b030
EOF
RUN

NAME=z/ with search.align
FILE=malloc://1024
CMDS=<<EOF
wx 00112233445566778899aabbccddeeff
za foo b 1122
e zign.minsz=0
e zign.mincc=0
fs *
e search.align=2
z/
f~?
e search.align=1
z/
f~?
EOF
EXPECT=<<EOF
0
1
EOF
RUN

NAME=z/ with search.{from,to}
FILE=malloc://1024
CMDS=<<EOF
wx 00112233445566778899aabbccddeeff
za a b 11223344
za b b bbccddee
e zign.minsz=0
e zign.mincc=0
fs *
f~?
e search.in=raw
e search.from=0x0
e search.to=0x8
z/
?v sign.bytes.a_0
?v sign.bytes.b_0
f-*
f~?
e search.from=0x8
e search.to=0xf
z/
?v sign.bytes.a_0
?v sign.bytes.b_0
EOF
EXPECT=<<EOF
0
0x1
0x0
0
0x0
0xb
EOF
RUN

NAME=z/ with zign.minsz
FILE=malloc://1024
CMDS=<<EOF
wx 00112233445566778899aabbccddeeff
za foo b 11223344
e zign.minsz=0
fs *
z/
f~?
f-*
e zign.minsz=5
z/
f~?
EOF
EXPECT=<<EOF
1
0
EOF
RUN

NAME=za b ; z/ ; aa ; axt
FILE=bins/elf/analysis/zigs_stripped
CMDS=<<EOF
za sym.print b 5548....48......48......48......48....bf........b8........e8........90c9c3
z/
e analysis.hasnext=0
aa
axt 0x400536
EOF
EXPECT=<<EOF
main 0x40056f [CALL] call sign.bytes.sym.print_0
EOF
RUN

NAME=zaf
FILE=bins/elf/analysis/zigs
CMDS=<<EOF
aaa
e zign.mincc=0
zs zigs
zaf main
z
EOF
EXPECT=<<EOF
zigs:main:
  bytes: 554889e54883ec10897dfc488975f0bf13064000e8c2ffffffb800000000c9c3
  mask: ffffffffffffffffffffffffffffffff00000000ff00000000ffffffffffffff
  graph: cc=1 nbbs=1 edges=0 ebbs=1 bbsum=32
  addr: 0x0040055b
  realname: main
  refs: sym.print
  vars: b-12, b-24, r82, r78
  types: func.main.ret=int, func.main.args=2, func.main.arg.0="int,argc", func.main.arg.1="char **,argv"
  bbhash: 9890426532f35eb3a80fe773d887714fe27d13ea125ad7e90beab16a51b74496
EOF
RUN

NAME=zaf at offset
FILE=bins/elf/analysis/zigs
CMDS=<<EOF
aaa
e zign.mincc=0
zs zigs
zaf @ main
z
EOF
EXPECT=<<EOF
zigs:main:
  bytes: 554889e54883ec10897dfc488975f0bf13064000e8c2ffffffb800000000c9c3
  mask: ffffffffffffffffffffffffffffffff00000000ff00000000ffffffffffffff
  graph: cc=1 nbbs=1 edges=0 ebbs=1 bbsum=32
  addr: 0x0040055b
  realname: main
  refs: sym.print
  vars: b-12, b-24, r82, r78
  types: func.main.ret=int, func.main.args=2, func.main.arg.0="int,argc", func.main.arg.1="char **,argv"
  bbhash: 9890426532f35eb3a80fe773d887714fe27d13ea125ad7e90beab16a51b74496
EOF
RUN

NAME=zaf (root zignspace)
FILE=bins/elf/analysis/zigs
CMDS=<<EOF
aaa
e zign.mincc=0
zaf main
z
EOF
EXPECT=<<EOF
main:
  bytes: 554889e54883ec10897dfc488975f0bf13064000e8c2ffffffb800000000c9c3
  mask: ffffffffffffffffffffffffffffffff00000000ff00000000ffffffffffffff
  graph: cc=1 nbbs=1 edges=0 ebbs=1 bbsum=32
  addr: 0x0040055b
  refs: sym.print
  vars: b-12, b-24, r82, r78
  types: func.main.ret=int, func.main.args=2, func.main.arg.0="int,argc", func.main.arg.1="char **,argv"
  bbhash: 9890426532f35eb3a80fe773d887714fe27d13ea125ad7e90beab16a51b74496
EOF
RUN

NAME=zaf zigname
FILE=bins/elf/analysis/zigs
CMDS=<<EOF
aaa
e zign.mincc=0
zs zigs
zaf main foobar
z
EOF
EXPECT=<<EOF
foobar:
  bytes: 554889e54883ec10897dfc488975f0bf13064000e8c2ffffffb800000000c9c3
  mask: ffffffffffffffffffffffffffffffff00000000ff00000000ffffffffffffff
  graph: cc=1 nbbs=1 edges=0 ebbs=1 bbsum=32
  addr: 0x0040055b
  realname: main
  refs: sym.print
  vars: b-12, b-24, r82, r78
  types: func.main.ret=int, func.main.args=2, func.main.arg.0="int,argc", func.main.arg.1="char **,argv"
  bbhash: 9890426532f35eb3a80fe773d887714fe27d13ea125ad7e90beab16a51b74496
EOF
RUN

NAME=zaf zigname (root zignspace)
FILE=bins/elf/analysis/zigs
CMDS=<<EOF
aaa
e zign.mincc=0
zaf main foobar
z
EOF
EXPECT=<<EOF
foobar:
  bytes: 554889e54883ec10897dfc488975f0bf13064000e8c2ffffffb800000000c9c3
  mask: ffffffffffffffffffffffffffffffff00000000ff00000000ffffffffffffff
  graph: cc=1 nbbs=1 edges=0 ebbs=1 bbsum=32
  addr: 0x0040055b
  realname: main
  refs: sym.print
  vars: b-12, b-24, r82, r78
  types: func.main.ret=int, func.main.args=2, func.main.arg.0="int,argc", func.main.arg.1="char **,argv"
  bbhash: 9890426532f35eb3a80fe773d887714fe27d13ea125ad7e90beab16a51b74496
EOF
RUN

NAME=zs + zaf + z/
FILE=bins/elf/analysis/zigs
CMDS=<<EOF
aaa
zs zigs
zaf main
z/
?v sign.bytes.zigs:main_0
EOF
EXPECT=<<EOF
0x40055b
EOF
RUN

NAME=zs + zaf zigname + z/
FILE=bins/elf/analysis/zigs
CMDS=<<EOF
aaa
zaf main foobar
z/
?v sign.bytes.foobar_0
EOF
EXPECT=<<EOF
0x40055b
EOF
RUN

NAME=zc
FILE=bins/elf/analysis/zigs_stripped
CMDS=<<EOF
aa
za sym.print b 5548....48......48......48......48....bf........b8........e8........90c9c3
z. @@f:fcn*
?v sign.bytes.sym.print_0
EOF
EXPECT=<<EOF
0x400536
EOF
RUN

NAME=zc graph zign
FILE=bins/elf/analysis/zigs_stripped
CMDS=<<EOF
aa
za sym.print g cc=1 nbbs=1 edges=0 ebbs=1
e zign.mincc=0
z. @@f:fcn*
?v sign.graph.sym.print_0
EOF
EXPECT=<<EOF
0x400536
EOF
RUN

NAME=zc graph zign with zign.mincc
FILE=bins/elf/analysis/zigs_stripped
CMDS=<<EOF
aa
za sym.print g cc=1 nbbs=1 edges=0 ebbs=1
e zign.mincc=0
z. @@f:fcn*
?v sign.graph.sym.print_0
f-*
e zign.mincc=10
z. @@f:fcn*
?v sign.graph.sym.print_0
EOF
EXPECT=<<EOF
0x400536
0x0
EOF
RUN

NAME=z/ graph zign
FILE=bins/elf/analysis/zigs_stripped
CMDS=<<EOF
aa
za sym.print_metric g cc=1 nbbs=1 edges=0 ebbs=1
e zign.mincc=0
z/
?v sign.graph.sym.print_metric_4
EOF
EXPECT=<<EOF
0x400536
EOF
RUN

NAME=z/ bytes + graph zign
FILE=bins/elf/analysis/zigs_stripped
CMDS=<<EOF
aa
za sym.print b 5548....48......48......48......48....bf........b8........e8........90c9c3
za sym.print g cc=1 nbbs=1 edges=0 ebbs=1
e zign.minsz=0
e zign.mincc=0
z/
?v sign.bytes.sym.print_0
?v sign.graph.sym.print_4
EOF
EXPECT=<<EOF
0x400536
0x400536
EOF
RUN

NAME=z/ + zign.match.{bytes,graph}
FILE=bins/elf/analysis/zigs_stripped
CMDS=<<EOF
aa
za sym.print b 5548....48......48......48......48....bf........b8........e8........90c9c3
za sym.print g cc=1 nbbs=1 edges=0 ebbs=1
e zign.minsz=0
e zign.mincc=0
fs sign
e zign.match.bytes=true
e zign.match.graph=false
z/
f~sign.bytes.sym.print?
f~sign.graph.sym.print?
f-*
e zign.match.bytes=false
e zign.match.graph=true
z/
f~sign.bytes.sym.print?
f~sign.graph.sym.print?
EOF
EXPECT=<<EOF
1
0
0
5
EOF
RUN

NAME=zc + zign.match.{bytes,graph}
FILE=bins/elf/analysis/zigs_stripped
CMDS=<<EOF
aa
za sym.print b 5548....48......48......48......48....bf........b8........e8........90c9c3
za sym.print g cc=1 nbbs=1 edges=0 ebbs=1
e zign.minsz=0
e zign.mincc=0
fs sign
e zign.match.bytes=true
e zign.match.graph=false
z. @ 0x400536
f~sign.bytes.sym.print?
f~sign.graph.sym.print?
f-*
e zign.match.bytes=false
e zign.match.graph=true
z. @ 0x400536
f~sign.bytes.sym.print?
f~sign.graph.sym.print?
EOF
EXPECT=<<EOF
1
0
0
1
EOF
RUN

NAME=aa ; zfs libc-v7.sig
FILE=bins/elf/analysis/pid_stripped
CMDS=aa ; zfs bins/other/sigs/libc-v7.sig
EXPECT=<<EOF
Found flirt.__libc_start_main
EOF
RUN

NAME=zfd libc-v7.sig
FILE=bins/elf/analysis/pid_stripped
CMDS=zfd bins/other/sigs/libc-v7.sig
EXPECT=<<EOF
41564155B8........4154554D89C4534889CD4D89CD4881EC900000004885C0:
 0. 16 D2A2 0298 0000:__libc_start_main
EOF
RUN

NAME=af ; af ; zfs libc-v7.sig - newshell
ARGS=-ecfg.newshell=true
FILE=bins/elf/analysis/pid_stripped
CMDS=s 0x4e2420 ; af ; s 0x4e25c7 ; af ; zfs bins/other/sigs/libc-v7.sig ; afl ~4e2420
EXPECT=<<EOF
Found flirt.__libc_start_main
0x004e2420   40 664          flirt.__libc_start_main
EOF
RUN

NAME=af ; af ; zfs libc-v7.sig
FILE=bins/elf/analysis/pid_stripped
CMDS=<<EOF
s 0x4e2420
af
s 0x4e25c7
af
zfs bins/other/sigs/libc-v7.sig
afl~4e2420
EOF
EXPECT=<<EOF
Found flirt.__libc_start_main
0x004e2420   40 664          flirt.__libc_start_main
EOF
RUN

NAME=aa ; zfs libc-v10.sig
FILE=bins/elf/analysis/pid_stripped
CMDS=aa ; zfs bins/other/sigs/libc-v10.sig
EXPECT=<<EOF
Found flirt.__libc_start_main
EOF
RUN

NAME=zfd libc-v10.sig
FILE=bins/elf/analysis/pid_stripped
CMDS=zfd bins/other/sigs/libc-v10.sig
EXPECT=<<EOF
41564155B8........4154554D89C4534889CD4D89CD4881EC900000004885C0:
 0. 16 D2A2 0298 0000:__libc_start_main
EOF
RUN

NAME=af ; af ; zfs libc-v10.sig - newshell
ARGS=-ecfg.newshell=true
FILE=bins/elf/analysis/pid_stripped
CMDS=s 0x4e2420 ; af ; s 0x4e25c7 ; af ; zfs bins/other/sigs/libc-v10.sig ; afl ~4e2420
EXPECT=<<EOF
Found flirt.__libc_start_main
0x004e2420   40 664          flirt.__libc_start_main
EOF
RUN

NAME=af ; af ; zfs libc-v10.sig
FILE=bins/elf/analysis/pid_stripped
CMDS=<<EOF
s 0x4e2420
af
s 0x4e25c7
af
zfs bins/other/sigs/libc-v10.sig
afl~4e2420
EOF
EXPECT=<<EOF
Found flirt.__libc_start_main
0x004e2420   40 664          flirt.__libc_start_main
EOF
RUN

NAME=zfs on static glibc
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aac
zfs bins/other/sigs/libc6_2.27-3ubuntu1_amd64.sig~silence
f@F:flirt
EOF
EXPECT=<<EOF
0x004004d1 86 flirt.__malloc_assert.constprop.13
0x00400527 35 flirt.__gconv_release_step.part.1
0x00400b70 613 flirt.get_common_indeces.constprop.1
0x00400de0 1657 flirt.__libc_start_main
0x00401460 385 flirt.__libc_check_standard_fds
0x004015f0 581 flirt.__libc_setup_tls
0x00401930 339 flirt.__assert_fail_base
0x00401a90 80 flirt.__assert_fail
0x00401ae0 7517 flirt.__dcgettext
0x00403840 672 flirt._nl_find_domain
0x00403ae0 5366 flirt._nl_load_domain
0x004054e0 601 flirt.__cxa_finalize
0x004056b0 1488 flirt._nl_make_l10nflist
0x00405c80 286 flirt._nl_normalize_codeset
0x00405da0 574 flirt._nl_explode_name
0x00405fe0 28945 flirt.__gettext_free_exp
0x0040d100 2128 flirt.__gettextparse
0x0040d950 256 flirt.__gettext_extract_plural
0x0040da50 60 flirt.__hash_string
0x0040da90 7 flirt.__umount
0x0040dbb0 561 flirt.abort
0x0040ddf0 1092 flirt.msort_with_tmp.part.0
0x0040e6c0 1160 flirt.qsort
0x0040e6d0 212 flirt.getenv
0x0040e7b0 636 flirt.__run_exit_handlers
0x0040ea30 32 flirt.exit
0x0040ea50 288 flirt.__new_exitfn
0x0040ec70 250 flirt.__cxa_atexit
0x0040f430 542 flirt.__correctly_grouped_prefixmb
0x0040f710 368 flirt.locked_vfxprintf
0x0040f880 784 flirt.__fxprintf
0x0040fe20 33103 flirt._IO_fflush
0x00410210 429 flirt._IO_puts
0x00410410 1898 flirt.adjust_wide_data
0x004115d0 1182 flirt._IO_wdo_write
0x00411f00 400 flirt._IO_vasprintf
0x00412090 374 flirt.__libc_message.constprop.0
0x00412210 743 flirt.__libc_message
0x00412500 32 flirt.__libc_fatal
0x00412520 32 flirt._IO_vtable_check
0x00412540 164 flirt.__fgets_unlocked
0x00415430 461 flirt.save_for_backup
0x00415b80 720 flirt._IO_un_link
0x00415e50 661 flirt._IO_link_in
0x004160f0 43 flirt._IO_switch_to_main_get_area
0x00416150 151 flirt._IO_switch_to_get_mode
0x004161f0 74 flirt._IO_free_backup_area
0x00416240 112 flirt.__overflow
0x004162b0 490 flirt.__underflow
0x004164a0 514 flirt.__uflow
0x004166b0 93 flirt._IO_setb
0x00416710 175 flirt._IO_doallocbuf
0x00416830 258 flirt._IO_default_xsputn
0x00416c30 292 flirt._IO_default_setbuf
0x004170c0 327 flirt._IO_no_init
0x00417550 127 flirt._IO_sputbackc
0x00417650 64 flirt._IO_adjust_column
0x00418090 106 flirt._IO_unsave_markers
0x004234b0 65 flirt.__strdup
0x0042b6b0 1022 flirt.__memcmp_sse2
0x00447cf0 1568 flirt.handle_amd
0x00448310 37 flirt.__cache_sysconf
0x004491d0 80 flirt.__get_child_max
0x004492c0 288 flirt.__libc_open64
0x004493e0 160 flirt.__open64_nocancel
0x00449480 153 flirt.__libc_read
0x00449520 36 flirt.__read_nocancel
0x00449550 153 flirt.__libc_write
0x004495f0 44 flirt.__write_nocancel
0x00449650 464 flirt.__libc_fcntl
0x00449820 125 flirt.__close
0x004498a0 42 flirt.__close_nocancel
0x004498d0 1811 flirt.__getcwd
0x0044a030 142 flirt.__sbrk
0x0044a0c0 64 flirt.__getpagesize
0x0044a100 80 flirt.__getdtablesize
0x0044a2c0 327 flirt.trecurse
0x0044a410 982 flirt.__tsearch
0x0044a7f0 87 flirt.__tfind
0x0044ae00 175 flirt.__twalk
0x0044aeb0 435 flirt.__tdestroy
0x0044b070 432 flirt.next_line
0x0044b220 1168 flirt.__get_nprocs
0x0044b6b0 224 flirt.__get_nprocs_conf
0x0044b790 144 flirt.__get_phys_pages
0x0044b820 144 flirt.__get_avphys_pages
0x0044b8b0 17 flirt.__getclktck
0x0044b8d0 82 flirt.__init_misc
0x0044b990 64 flirt.__libc_alloca_cutoff
0x0044b9d0 40 flirt.__lll_lock_wait_private
0x0044ba00 28 flirt.__lll_unlock_wake_private
0x0044ba20 86 flirt.__libc_enable_asynccancel
0x0044ba80 89 flirt.__libc_disable_asynccancel
0x0044baf0 32 flirt.__stack_chk_fail
0x0044bb10 97 flirt.__fortify_fail_abort
0x0044bb80 32 flirt.__fortify_fail
0x0044bc30 114 flirt.__tunable_set_val
0x0044bcb0 1533 flirt.__tunables_init
0x0044c2b0 90 flirt.__tunable_get_val
0x0044c310 1038 flirt._dl_aux_init
0x0044c720 2296 flirt._dl_non_dynamic_init
0x0044d020 69 flirt.__libc_init_secure
0x0044de00 1296 flirt.__gconv_open
0x0044e310 528 flirt.__gconv
0x0044e520 89 flirt.__gconv_close
0x0044f6c0 1168 flirt.insert_module
0x0044fb50 1008 flirt.__gconv_get_path
0x0044ff40 1504 flirt.__gconv_read_conf
0x00450520 602 flirt.__gconv_get_builtin_trans
0x00458320 18 flirt.release_libc_mem
0x004585d0 692 flirt.new_composite_name
0x00459170 2074 flirt._nl_find_locale
0x00459990 1821 flirt._nl_intern_locale_data
0x00459bd0 1488 flirt._nl_load_locale
0x0045a1a0 94 flirt._nl_unload_locale
0x0045a200 1312 flirt._nl_load_locale_from_archive
0x0045a870 80 flirt.__setfpucw
0x0045a8c0 132 flirt.__sigsetjmp
0x0045abc0 6232 flirt._quicksort
0x0045c620 19 flirt.__libc_secure_getenv
0x0045ce30 10673 flirt.group_number
0x0045f800 13172 flirt._IO_vfprintf_internal
0x00462b80 976 flirt.hack_digit
0x00465a50 11033 flirt.___printf_fp
0x00468470 192 flirt.___asprintf
0x00468530 11072 flirt._i18n_number_rewrite
0x0046b070 13435 flirt._IO_vfwprintf
0x0046e540 1929 flirt.__parse_one_specmb
0x0046ecd0 2211 flirt.__parse_one_specwc
0x0046f6d0 314 flirt._IO_fputs
0x0046f8e0 413 flirt._IO_fwrite
0x0046fae0 727 flirt._IO_getdelim
0x0046fe10 349 flirt._IO_getline
0x004700f0 320 flirt._IO_padn
0x00470230 320 flirt._IO_wpadn
0x00470370 637 flirt.save_for_wbackup.isra.0
0x004706b0 109 flirt._IO_wsetb
0x004709d0 117 flirt.__woverflow
0x00470e40 685 flirt._IO_wdefault_xsputn
0x00471530 155 flirt._IO_wdoallocbuf
0x00471640 114 flirt._IO_switch_to_wget_mode
0x004716c0 99 flirt._IO_free_wbackup_area
0x004720c0 165 flirt.__libc_scratch_buffer_grow_preserve
0x00472170 184 flirt.__libc_scratch_buffer_set_array_size
0x00472230 73 flirt.__strndup
0x00472280 451 flirt.__strerror_r
0x00472480 102 flirt.__strtok_r
0x00472cc0 218 flirt.__argz_create_sep
0x00472da0 183 flirt.__argz_add_sep
0x00473890 9 flirt.__wmemcpy
0x00473ab0 480 flirt.__wcrtomb
0x00473c90 806 flirt.__wcsrtombs
0x00473fc0 32 flirt.__wcschrnul
0x00474a40 8 flirt.time
0x00474f90 139 flirt.__rewinddir
0x00475020 141 flirt.__getdents
0x004750b0 192 flirt.__fdopendir
0x004751a0 8 flirt.__getuid
0x004751b0 8 flirt.__geteuid
0x004751c0 8 flirt.__getgid
0x004751d0 8 flirt.__getegid
0x00475450 256 flirt.__isatty
0x00475640 63 flirt.__towctrans
0x00475680 496 flirt.__readonly_area
0x00475870 8192 flirt.is_trusted_path_normalize
0x00477870 686 flirt._dl_dst_count
0x00477b20 2717 flirt._dl_dst_substitute
0x004785c0 735 flirt._dl_init_paths
0x004788a0 4202 flirt._dl_map_object
0x00479910 3696 flirt.do_lookup_x
0x0047a780 2747 flirt._dl_lookup_symbol_x
0x0047b240 176 flirt._dl_setup_hash
0x0047b2f0 181 flirt._dl_add_to_namespace_list
0x0047b3b0 783 flirt._dl_new_object
0x0047d260 2000 flirt._dl_important_hwcaps
0x0047da30 1446 flirt._dl_debug_vdprintf
0x0047dfe0 138 flirt._dl_sysdep_read_whole_file
0x0047e070 162 flirt._dl_debug_printf
0x0047e120 162 flirt._dl_debug_printf_c
0x0047e1d0 148 flirt._dl_dprintf
0x0047e270 102 flirt._dl_name_match_p
0x0047e2e0 117 flirt._dl_higher_prime_number
0x0047e360 340 flirt._dl_strtoul
0x0047eed0 354 flirt._dl_next_tls_modid
0x0047f060 202 flirt._dl_allocate_tls_storage
0x0047f540 128 flirt._dl_tls_get_addr_soft
0x0047f5c0 240 flirt._dl_add_to_slotinfo
0x0047f6b0 416 flirt._dl_get_origin
0x0047f850 197 flirt._dl_scope_free
0x00480690 48 flirt.length_mismatch
0x004806c0 210 flirt._dl_exception_create
0x004807a0 729 flirt._dl_exception_create_format
0x00480a80 38 flirt._dl_exception_free
0x00480ab0 236 flirt._dl_cache_libcmp
0x00480ba0 2862 flirt._dl_load_cache_lookup
0x004816d0 56 flirt._dl_unload_cache
0x00482060 195 flirt.fatal_error
0x00482130 80 flirt._dl_signal_exception
0x00482180 80 flirt._dl_signal_error
0x004821d0 208 flirt._dl_catch_exception
0x004822a0 112 flirt._dl_catch_error
0x00482310 162 flirt.____longjmp_chk
0x00482370 59 flirt.__mpn_cmp
0x004823b0 1466 flirt.__mpn_divrem
0x00482970 259 flirt.__mpn_lshift
0x00482a80 259 flirt.__mpn_rshift
0x00482b90 1072 flirt.__mpn_mul
0x00482fc0 281 flirt.__mpn_mul_1
0x004830e0 438 flirt.__mpn_impn_mul_n_basecase
0x004832a0 1378 flirt.__mpn_impn_mul_n
0x00483810 431 flirt.__mpn_impn_sqr_n_basecase
0x004839c0 1262 flirt.__mpn_impn_sqr_n
0x00483f50 173 flirt.__mpn_sub_n
0x004840f0 144 flirt.__mpn_extract_double
0x00484180 185 flirt.__mpn_extract_long_double
0x00484240 286 flirt.__mpn_extract_float128
0x00484360 203 flirt._itoa_word
0x00484c90 138 flirt.strerror
0x00484d40 77 flirt.__strsep
0x00484f50 8 flirt.__getpid
0x00485160 416 flirt._dl_fixup
0x00485300 544 flirt._dl_profile_fixup
0x00485520 2 flirt._dl_call_pltexit
0x00485530 652 flirt.add_to_global
0x004857c0 144 flirt._dl_find_dso_for_object
0x00485850 528 flirt._dl_open
0x00485a60 298 flirt._dl_show_scope
0x004863b0 4000 flirt.remove_slotinfo
0x00487350 121 flirt._dl_close_worker
0x004874d0 751 flirt._dl_sort_maps
0x004877c0 416 flirt._dl_tlsdesc_resolve_rela_fixup
0x00487960 101 flirt._dl_tlsdesc_resolve_hold_fixup
0x004879d0 25 flirt._dl_unmap
0x00487cf0 83 flirt._dl_addr_inside_object
0x00487e00 235 flirt.__mpn_addmul_1
0x004895d0 877 flirt._dl_init
0x00489940 1806 flirt._dl_check_map_versions
0x0048fa10 478 flirt.__dl_iterate_phdr
0x0048fbf0 73 flirt._nl_finddomain_subfreeres
0x0048fc40 247 flirt._nl_unload_domain
0x00490bb0 218 flirt.free_slotinfo
EOF
RUN

NAME=zb bad count
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.maxsz=32
af
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb NOTANUMBER
EOF
EXPECT=<<EOF
EOF
RUN

NAME=zb negative count
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.maxsz=32
af
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb -1
EOF
EXPECT=<<EOF
EOF
RUN

NAME=zb single exact match
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.maxsz=32
af
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb
EOF
EXPECT=<<EOF
1.00000  1.00000 B  1.00000 G   sym.exact
EOF
RUN

NAME=zb match 5 by default
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.maxsz=32
af
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.second g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.second b ff5541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.third g cc=16 nbbs=28 edges=44 ebbs=1 bbsum=407
za sym.third b ffff41544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.fourth g cc=16 nbbs=28 edges=43 ebbs=1 bbsum=407
za sym.fourth b ffffff544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.fith g cc=16 nbbs=28 edges=43 ebbs=1 bbsum=401
za sym.fith b ffffffff4989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.not_shown g cc=15 nbbs=28 edges=43 ebbs=1 bbsum=395
za sym.not_shown b ffffffffff89fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb ~[5]
EOF
EXPECT=<<EOF
sym.exact
sym.second
sym.third
sym.fourth
sym.fith
EOF
RUN

NAME=zb match 6 of 6 with 100 count
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.maxsz=32
af
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.second g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.second b ff5541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.third g cc=16 nbbs=28 edges=44 ebbs=1 bbsum=407
za sym.third b ffff41544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.fourth g cc=16 nbbs=28 edges=43 ebbs=1 bbsum=407
za sym.fourth b ffffff544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.fith g cc=16 nbbs=28 edges=43 ebbs=1 bbsum=401
za sym.fith b ffffffff4989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.sixth g cc=15 nbbs=28 edges=43 ebbs=1 bbsum=395
za sym.sixth b ffffffffff89fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb 100~[5]
EOF
EXPECT=<<EOF
sym.exact
sym.second
sym.third
sym.fourth
sym.fith
sym.sixth
EOF
RUN

NAME=zb ignore masked bytes
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.maxsz=32
af
za sym.perf1 b 415541544989fc55534883ec08e800000000488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.perf2 b 415541544989fc55534883ec08e8ffffffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb ~[0]
EOF
EXPECT=<<EOF
1.00000
1.00000
EOF
RUN

NAME=zb count 1
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.maxsz=32
af
za sym.right g cc=16 nbbs=28 edges=44 ebbs=1 bbsum=407
za sym.right b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.wrong g cc=16 nbbs=28 edges=43 ebbs=1 bbsum=407
za sym.wrong b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.nope g cc=16 nbbs=28 edges=43 ebbs=1 bbsum=401
za sym.nope b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.bad g cc=15 nbbs=28 edges=43 ebbs=1 bbsum=395
za sym.bad b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb 1 ~?
EOF
EXPECT=<<EOF
1
EOF
RUN

NAME=zb duplicate zigs match
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
af
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.duplicate1 g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.duplicate1 b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.duplicate2 g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.duplicate2 b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.duplicate3 g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.duplicate3 b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.duplicate4 g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.duplicate4 b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.duplicate5 g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.duplicate5 b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.duplicate6 g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.duplicate6 b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb ~sym.duplicate?
EOF
EXPECT=<<EOF
4
EOF
RUN

NAME=zj producing valid types
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aaa
zaf fcn.00484d40 fcn.00484d40
zj
EOF
EXPECT=<<EOF
[{"name":"fcn.00484d40","bytes":"55534883ec08488b1f4885db741b4889fd4889dfe857b7f7ff4801d8803800751748c74500000000004883c4084889d85b5dc30f1f440000c600004883c001488945004883c4084889d85b5dc3","mask":"ffffffffffffffffffffffffff00ffffffffffffff00000000ffffffffffffff00ffffffffffffffffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffff","graph":{"cc":4,"nbbs":5,"edges":5,"ebbs":2,"bbsum":72},"addr":4738368,"refs":[],"xrefs":[],"vars":["r82"],"types":[{"name":"arg1","type":"int64_t"}],"hash":{"bbhash":"8ff8a5c7f84179483b764fbb18dc4c44f39da6527a0a16485c7ae519f00e687f"}}]
EOF
RUN

NAME=x86-64 function with hole
FILE=bins/elf/libc.so.6
CMDS=<<EOF
s 0xec800
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za sym.__write b f30f1efa488d05256d0d008b0085c07517b8010000000f05483d00f0ffff7758c30f1f800000000041544989d4554889f55389fb4883ec10e823c901004c89e24889ee89df4189c0b8010000000f05483d00f0ffff77354489c74889442408e85cc90100488b4424084883c4105b5d415cc3660f1f440000488b15c1150d00f7d864890248c7c0ffffffffc3488b15ad150d00f7d864890248c7c0ffffffffebb6:ffffffffff000000000000ffffffffff00ffffffffffffffff0000000000ff00ff00000000000000ffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffff0000000000ff00ffffffffffffffffff00000000ffffffffffffffffffffffffffff000000000000ff000000000000ffffffffffffffffffffffffffff000000000000ffffffffffffffffffffffffff00
za sym.__write g cc=6 nbbs=7 edges=7 ebbs=3 bbsum=148
za sym.__write o 0x000ec800
za sym.__write r sym.__libc_enable_asynccancel sym.__libc_disable_asynccancel
za sym.__write v s-32 r72 r78 r82
za sym.__write t func.sym.__write.args=3 func.sym.__write.arg.0="int64_t,arg1" func.sym.__write.arg.1="int64_t,arg2" func.sym.__write.arg.2="int64_t,arg3"
za sym.__write h 4f2d194bae72345352b26e0a36531e7d6ff6cb5d6b50b92487246507b8dafdc5
EOF
RUN

NAME=x86-64 function with jumpback
FILE=bins/elf/libc.so.6
CMDS=<<EOF
s 0x8a900
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za sym.bcopy b f30f1efa4887fee92479f9ff:ffffffffffffffff00000000
za sym.bcopy g cc=1 nbbs=2 edges=1 ebbs=1 bbsum=23
za sym.bcopy o 0x0008a900
za sym.bcopy r sym..plt.sec
za sym.bcopy v r82
za sym.bcopy t func.sym.bcopy.args=1 func.sym.bcopy.arg.0="int64_t,arg1"
za sym.bcopy h 7549556f94a4c26907f0304da9892c797a73e6c44907dc2030389392a9df8f69
EOF
RUN

NAME=x86-64 r_sign_fcn_bytes bounds check
FILE=bins/elf/libc.so.6
CMDS=<<EOF
s 0x0593a0
e zign.maxsz=41
af
zaf
z* ~za sym._IO_printf b
EOF
EXPECT=<<EOF
za sym._IO_printf b f30f1efa4881ecd80000004889742428488954243048894c24384c894424404c894c244884c074370f:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff
EOF
RUN

NAME=80386 function with hole
FILE=bins/elf/fcn_in_test.elf
CMDS=<<EOF
s 0x1090
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za sym.deregister_tm_clones b e8e400000081c26b2f00008d8a180000008d821800000039c8741d8b82ecffffff85c074135589e583ec1451ffd083c410c9c38d74260090c3:ff00000000ff0000000000ffffffffffffffffffffffffffffff00ffffffffffffffffff00ffffffffffffffffffffffffffff0000000000ff
za sym.deregister_tm_clones g cc=4 nbbs=4 edges=4 ebbs=2 bbsum=52
za sym.deregister_tm_clones o 0x00001090
za sym.deregister_tm_clones r sym.__x86.get_pc_thunk.dx
za sym.deregister_tm_clones h 903d0936e77ecc1f2e91f7b2eb2476fdc06d7f2ba9501b1436468dbda5d7caaa
EOF
RUN

NAME=80386 function with jumpback
FILE=bins/elf/fcn_in_test.elf
CMDS=<<EOF
s 0x1184
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za main b 31c075f8ebf689c05090909090c3:ffffff00ff00ffffffffffffffff
za main g cc=2 nbbs=4 edges=4 ebbs=1 bbsum=18
za main o 0x00001184
za main t func.main.ret=int func.main.args=3 func.main.arg.0="int,argc" func.main.arg.1="char **,argv" func.main.arg.2="char **,envp"
za main h a9f218a725149b64061b9064406b46abe5653b97eb0f88a3e3e0086d1532c898
EOF
RUN

NAME=80386 r_sign_fcn_bytes bounds check
FILE=bins/elf/fcn_in_test.elf
CMDS=<<EOF
s 0x00001120
e zign.maxsz=32
af
zaf
z* ~za sym.__do_global_dtors_aux b
EOF
EXPECT=<<EOF
za sym.__do_global_dtors_aux b f30f1efb5589e553e853ffffff81c3d32e000083ec0480bb180000000075288b:ffffffffffffffffff00000000ff0000000000ffffffffffffffffffffff00ff
EOF
RUN

NAME=MIPS R3000 function with hole
FILE=bins/elf/libc.so.0
CMDS=<<EOF
s 0x00051490
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za sym.fpathconf b 3c1c0005279c11200399e02127bdfef8afbf0100afb100fcafb000f8afbc001004810008008088218f9980180320f809000000008fbc00102404ffff100000142403000910a000412404007f24a5ffff2ca20013104000088f83805c0005108024638d00004310218c420000005c102100400008000000008f9980180320f809000000008fbc00102404ffff240300161000002eac4300001000002c240400ff8f9980180320f809000000008fbc00100220202127a500188f998224004080210320f8098c510000044100088fbc00108e030000240200591462001c2404ffff240400ff10000019ae110000100000178fa40040100000152404100010000013000020218f9980f0022020210320f80927a500600440000c8fbc00108fa200743043f0003402800010620003240260001462000500000000100000042404000110000002240400202404ffff8fbf01008fb100fc8fb000f80080102103e0000827bd0108:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffff000000ff000000ffffffffffffffffffffffffff000000ffffffffff000000ffffffffffffffffffffffffff000000ff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ff000000ffffffffffffffffffffffffffffffffff000000ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff
za sym.fpathconf g cc=5 nbbs=8 edges=9 ebbs=2 bbsum=176
za sym.fpathconf o 0x00051490
za sym.fpathconf v s-8 s-12 s-16 s-248 r4 r5
za sym.fpathconf t func.sym.fpathconf.args=2 func.sym.fpathconf.arg.0="int32_t,arg1" func.sym.fpathconf.arg.1="int32_t,arg2"
za sym.fpathconf h 52f232c2d8158ce806cadf84ed77273fb11711dfa6cb5feb997ce03c1459be43
EOF
RUN

NAME=MIPS R3000 function with jumpback
FILE=bins/elf/ld-uClibc-0.9.33.2.so
CMDS=<<EOF
s 0x2a1c
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za sym._dl_malloc b 3c1c0002279cc5e40399e0218f82807427bdfff88c590000afbe00041320000503a0f02103c0e8218fbe00040320000827bd000803c0e8218f99801c8fbe0004273928dc1000ff9e27bd0008:ffffffffffffffffffffffffff000000ffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff000000ffffffff
za sym._dl_malloc g cc=8 nbbs=12 edges=16 ebbs=2 bbsum=396
za sym._dl_malloc o 0x00002a1c
za sym._dl_malloc r sym._dl_dprintf sym._dl_dprintf
za sym._dl_malloc v b16 s-4 s-12 s-16 s-20 s-8 s-24 s-32 s-80 s-76 s-28 s-36 s-40 r4 r6 r7 r5
za sym._dl_malloc t func.sym._dl_malloc.args=5 func.sym._dl_malloc.arg.0="int32_t,arg1" func.sym._dl_malloc.arg.1="int32_t,arg2" func.sym._dl_malloc.arg.2="int32_t,arg3" func.sym._dl_malloc.arg.3="int32_t,arg4" func.sym._dl_malloc.arg.4="int32_t,arg_10h"
za sym._dl_malloc h ec986971438cf486e01f14e9bc442d9f4c457854207d30fe4aa9f1ffdf892911
EOF
RUN

NAME=MIPS R3000  r_sign_fcn_bytes bounds check
FILE=bins/elf/libc.so.0
CMDS=<<EOF
s 0x00051490
af
e zign.maxsz=41
zaf
z* ~za sym.fpathconf b
EOF
EXPECT=<<EOF
za sym.fpathconf b 3c1c0005279c11200399e02127bdfef8afbf0100afb100fcafb000f8afbc001004810008008088218f:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffff
EOF
RUN

NAME=PowerPC function with hole
FILE=bins/elf/busybox-powerpc
CMDS=<<EOF
s 0x100e2b0c
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za fcn.100e2b0c b 38c000014800000c38c00000480000049421ffd07c0802a63d401013bf2100147c9923787cbe2b787cda33787c7f1b7890010034480000083bff0001897f0000812aa39c5560083c7c09022e700900204082ffe82f8b002b419e00182f8b002d3b80000040be00143b800001480000083b8000003bff000157c007357c6a1b7840820044881f00003bde000a2f80003040be00288c1f00013bdefffe600000207feafb785400063e2f80007840be000c57de083c3bff00012f9e0010409d00083bc00010381efffe390000002b800022419d00943800ffff7fa0f3967c1df1d67c0000f8541b063e480000087feafb78893f00007c08e8407c88e8003bff00013809ffd061290020540b063e2b0900602b8b0009409d00143929ffa93960002840990008552b063e7f8bf000409c00384181001040a600247f8bd840409d001c4bfe70057f9cd038380000223900ffff900300004bffff987c08f1d67d0b02144bffff8c2f990000419e0008915900002f9a00007d3c00d03c007fff55290ffe6000ffff7fe90214419e001c7f88f84040bd00144bfe6fb138000022900300007fe8fb782f9c0000419e00087d0800d0800100347d034378bb210014382100307c0803a64e800020:ffffffffff0000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffff000000ffffffffffffffffff000000ffffffffff000000ffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffff000000ffffffffffffffffff000000ff000000ff000000ffffffffff000000ff000000ffffffffffffffffffffffffffffffffff000000ffffffffffffffffff000000ffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffff000000ff000000ffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
za fcn.100e2b0c g cc=19 nbbs=35 edges=52 ebbs=1 bbsum=448
za fcn.100e2b0c o 0x100e2b0c
za fcn.100e2b0c v b0 b1 s4 r6 r7 r5
za fcn.100e2b0c t func.fcn.100e2b0c.args=6 func.fcn.100e2b0c.arg.0="int32_t,arg1" func.fcn.100e2b0c.arg.1="int32_t,arg2" func.fcn.100e2b0c.arg.2="int32_t,arg3" func.fcn.100e2b0c.arg.3="int32_t,arg_0h" func.fcn.100e2b0c.arg.4="int32_t,arg_1h" func.fcn.100e2b0c.arg.5="int32_t,arg_34h"
za fcn.100e2b0c h 3b28d8f368cb414615bda7313fc4cdc24096498e7183cc05165607770be26928
EOF
RUN

NAME=PowerPC function with jumpback
FILE=bins/elf/busybox-powerpc
CMDS=<<EOF
s 0x10002d70
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za fcn.10002d70 b 38a0000038c000004bfffed4:ffffffffffffffffff000000
za fcn.10002d70 g cc=12 nbbs=19 edges=29 ebbs=1 bbsum=304
za fcn.10002d70 o 0x10002d70
za fcn.10002d70 v b-4096 s4 s-36 s0 s-4136 r5 r6
za fcn.10002d70 t func.fcn.10002d70.args=4 func.fcn.10002d70.arg.0="int32_t,arg1" func.fcn.10002d70.arg.1="int32_t,arg2" func.fcn.10002d70.arg.2="int32_t,arg_1030h" func.fcn.10002d70.arg.3="int32_t,arg_1034h"
za fcn.10002d70 h b73e65dc846183808d8e385076f9bbcd0b1dcdaa5652254fb55b3b159462a507
EOF
RUN

NAME=PowerPC r_sign_fcn_bytes bounds check
FILE=bins/elf/busybox-powerpc
CMDS=<<EOF
s 0x1000016c
af
e zign.maxsz=30
zaf
z* ~za fcn.1000016c b
EOF
EXPECT=<<EOF
za fcn.1000016c b 3d2000007c0802a6392900009421fff02f89000090010014419e001c3c80:ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffff
EOF
RUN

NAME=ARM function with hole
FILE=bins/elf/libmagic.so
CMDS=<<EOF
s 0x78ea
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za sym._Unwind_VRS_Get b 10b5041c042913d8081c00f072fd05031103030001200ce00220002b09d10f2a07d88240a418029a61681160181c00e0022010bd:ffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000ffffffff
za sym._Unwind_VRS_Get g cc=2 nbbs=4 edges=4 ebbs=1 bbsum=28
za sym._Unwind_VRS_Get o 0x000078ea
za sym._Unwind_VRS_Get r sym.__gnu_thumb1_case_uqi
za sym._Unwind_VRS_Get v r0 r1
za sym._Unwind_VRS_Get t func.sym._Unwind_VRS_Get.args=2 func.sym._Unwind_VRS_Get.arg.0="int16_t,arg1" func.sym._Unwind_VRS_Get.arg.1="int16_t,arg2"
za sym._Unwind_VRS_Get h 3132d0ebfa3b792867a4ffc36455e088bf3fcffc7627bd48c64bf901308463db
EOF
RUN

NAME=ARM function with jumpback
FILE=bins/elf/libverifyPass.so
CMDS=<<EOF
s 0x0000183c
af
zaf
z* ~sym.__aeabi_unwind_cpp_pr0 b
EOF
EXPECT=<<EOF
za sym.__aeabi_unwind_cpp_pr0 b 0030a0e3d4feffea
EOF
RUN

NAME=ARM r_sign_fcn_bytes bounds check
FILE=bins/elf/libverifyPass.so
CMDS=<<EOF
s 0x00001844
af
e zign.maxsz=42
zaf
z* ~za fcn.00001844 b
EOF
EXPECT=<<EOF
za fcn.00001844 b f04f2de9a8519fe5a8319fe505508fe0033095e714d04de2000053e30040a0e1026041e20800000a0600:ffffffff0000f0ff0000f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
EOF
RUN

NAME=ARM aarch64 function with hole
FILE=bins/elf/switch-hello-world.elf
CMDS=<<EOF
s 0x12180
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za sym.memset b 200c014e0400028b5f8001f1c80300545f4000f102020054013c084ea2001836010000f981801ff8c0035fd61f2003d582001036010000b981c01fb8c0035fd6820000b4010000394200083681e01f78c0035fd60000803dc200303780009f3c620028360004803d80009e3cc0035fd60004803d000001ad80003fadc0035fd61f2003d5211c001203ec7c920000803d5f0004f12028407a80010054820003cb634000d1424001d1600001ad600082ad420001f1a8ffff5480003ead80003fadc0035fd61f2003d5e5003bd585fe2737a50c0012bf100071810200546004803d600001ad63e47a92600002ad600003ad820003cb420004d1630002911f2003d523740bd563000191420001f1a8ffff54600000ad600001ad80003ead80003fadc0035fd61f2003d5bf140071410200546004803d600001ad600002ad600003ad63e07992820003cb420004d16300029123740bd563000291420002f1a8ffff5480003cad80003dad80003ead80003fadc0035fd686008052c720c51ae50001915f0005ebc3f8ff54e60400d16500078b63400091a20003eba500268aa0000054600082ac60003fad420001f1a8ffff54e30305aa820005cb420007eba300005423740bd56300078b420007eba2ffff544200078b638000d1b6ffff17:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
za sym.memset g cc=28 nbbs=35 edges=47 ebbs=8 bbsum=460
za sym.memset o 0x00012180
za sym.memset v r13 r7 r19
za sym.memset t func.sym.memset.args=3 func.sym.memset.arg.0="void *,s" func.sym.memset.arg.1="int,c" func.sym.memset.arg.2="size_t,n"
za sym.memset h 82e8b18bbf263f9ed0e31d6b68099efe6eb8805a429444f8aa119af00c47369c
EOF
RUN

NAME=ARM aarch64 function with jmpback
FILE=bins/elf/switch-hello-world.elf
CMDS=<<EOF
s 0x131a4
af
zaf
z*
EOF
EXPECT=<<EOF
zs *
za sym.strnlen b c1ffffb4ecc300b202ec7c92080c40f2610300542e0400d1cefd44d34310c1a868000ccb69d800b28a000ccb8bd800b20601298a47012b8ace0500f1c80007aa005940fac0feff54c80007aa68fdffb4400000cb660000b4002000d1e70306aa002000d1e70cc0daed10c0da000c4d8b1f0001eb0090819ac0035fd62e0400d1eb0308cb1f2100f1ca0d4092cefd44d3090080924310c1a86bf17dd34a01088b2925cb9ace114a8b630009aa850009aa63d09fda84d0859adaffff17:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000f0ff0000f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
za sym.strnlen g cc=7 nbbs=11 edges=14 ebbs=2 bbsum=196
za sym.strnlen o 0x000131a4
za sym.strnlen v r13 r7 r31
za sym.strnlen t func.sym.strnlen.args=3 func.sym.strnlen.arg.0="int64_t,arg1" func.sym.strnlen.arg.1="int64_t,arg2" func.sym.strnlen.arg.2="int64_t,arg5"
za sym.strnlen h c573e9053dfa735f51cca8aea51eda71ca46fd402d11feb4d7f8ccf1b3b46d72
EOF
RUN

NAME=ARM aarch64 r_sign_fcn_bytes bounds check
FILE=bins/elf/switch-hello-world.elf
CMDS=<<EOF
s 0x00016e9c
e zign.maxsz=94
af
zaf
z* ~za sym._vfprintf_r b
EOF
EXPECT=<<EOF
za sym._vfprintf_r b ff0314d1fd7b00a9fd030091f35301a9f30302aaf55b02a9f76303a9f70300aaf80303aaf96b04a9fa0301aafb7305a9e827066d6a170094000040f9e06700f989efff97e05700f9020180d2e0a3059101008052a4ecff97b70000b4e052:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000fcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
EOF
RUN

NAME=zbr bad count
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aa
e zign.maxsz=32
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zbr sym.exact NOTNUMBER
EOF
EXPECT=<<EOF
EOF
RUN

NAME=zbr negative count
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aa
e zign.maxsz=32
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zbr sym.exact -3
EOF
EXPECT=<<EOF
EOF
RUN

NAME=zbr zero count
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aa
e zign.maxsz=32
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zbr sym.exact 0
EOF
EXPECT=<<EOF
EOF
RUN

NAME=zbr single match
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aa
e zign.maxsz=32
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zbr sym.exact 1~[5]
EOF
EXPECT=<<EOF
fcn.00410210
EOF
RUN

NAME=zbr exact match
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aa
e zign.maxsz=32
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zbr sym.exact 1
EOF
EXPECT=<<EOF
1.00000  1.00000 B  1.00000 G   fcn.00410210
EOF
RUN

NAME=zbr try match 5 but only 4
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aa
e zign.maxsz=32
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zbr sym.exact ~[5]
EOF
EXPECT=<<EOF
fcn.00410210
main
entry0
fcn.00400de0
EOF
RUN

NAME=zbr match 5 by default
FILE=bins/elf/ls
CMDS=<<EOF
aa
e zign.maxsz=32
za main b 41574156415541545589fd534889f34883ec58488b3e64488b04252800000048
za main g cc=429 nbbs=300 edges=437 ebbs=8 bbsum=6739
zbr main ~[5]
EOF
EXPECT=<<EOF
main
sym._obstack_newchunk
sym._obstack_free
sym._obstack_begin
sym._obstack_begin_1
EOF
RUN

NAME=zbr ignore masked bytes
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
aa
e zign.maxsz=32
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e8aaaaaaaa488baaaaaaaaaa4889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zbr sym.exact 1
EOF
EXPECT=<<EOF
1.00000  1.00000 B  1.00000 G   fcn.00410210
EOF
RUN

NAME=zb zign.threshold
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.maxsz=32
af
za sym.1 g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.1 b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.2 g cc=16 nbbs=25 edges=40 ebbs=1 bbsum=377
za sym.2 b 41544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.3 g cc=14 nbbs=21 edges=35 ebbs=1 bbsum=347
za sym.3 b fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.4 g cc=12 nbbs=17 edges=30 ebbs=1 bbsum=307
za sym.4 b 4883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffff00000000ff000000000000ffffffffffffff
za sym.5 g cc=10 nbbs=14 edges=22 ebbs=1 bbsum=284
za sym.5 b 08e89e02ffff488b2d77952a004889c38b450048:ffff00000000ff000000000000ffffffffffffff
e zign.threshold=.99
zb ~[5]
e zign.threshold=.9
zb ~[5]
e zign.threshold=.8
zb ~[5]
e zign.threshold=.7
zb ~[5]
EOF
EXPECT=<<EOF
sym.1
sym.1
sym.2
sym.1
sym.2
sym.3
sym.1
sym.2
sym.3
sym.4
EOF
RUN

NAME=zbr zign.threshold
FILE=bins/elf/ls
CMDS=<<EOF
aa
e zign.maxsz=32
za main b 41574156415541545589fd534889f34883ec58488b3e64488b04252800000048
za main g cc=429 nbbs=300 edges=437 ebbs=8 bbsum=6739
e zign.threshold=1.0
zbr main~[5]
e zign.threshold=0.5
zbr main~[5]
e zign.threshold=0.3
zbr main~[5]
e zign.threshold=0.12
zbr main 30~[5]
EOF
EXPECT=<<EOF
main
main
main
main
sym._obstack_newchunk
EOF
RUN

NAME=zbr invalid threshold
FILE=bins/elf/ls
CMDS=<<EOF
aa
e zign.maxsz=32
e zign.threshold=99.0
za main b 41574156415541545589fd534889f34883ec58488b3e64488b04252800000048
za main g cc=429 nbbs=300 edges=437 ebbs=8 bbsum=6739
zbr main ~[5]
EOF
EXPECT=<<EOF
main
sym._obstack_newchunk
sym._obstack_free
sym._obstack_begin
sym._obstack_begin_1
EOF
RUN

NAME=zb invalid threshold
FILE=bins/elf/static-glibc-2.27
CMDS=<<EOF
s 0x00410210
e zign.threshold=99.0
e zign.maxsz=32
af
za sym.exact g cc=17 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.exact b 415541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.second g cc=16 nbbs=29 edges=44 ebbs=1 bbsum=407
za sym.second b ff5541544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.third g cc=16 nbbs=28 edges=44 ebbs=1 bbsum=407
za sym.third b ffff41544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.fourth g cc=16 nbbs=28 edges=43 ebbs=1 bbsum=407
za sym.fourth b ffffff544989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.fith g cc=16 nbbs=28 edges=43 ebbs=1 bbsum=401
za sym.fith b ffffffff4989fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
za sym.not_shown g cc=15 nbbs=28 edges=43 ebbs=1 bbsum=395
za sym.not_shown b ffffffffff89fc55534883ec08e89e02ffff488b2d77952a004889c38b450048:ffffffffffffffffffffffffffff00000000ff000000000000ffffffffffffff
zb ~[5]
EOF
EXPECT=<<EOF
sym.exact
sym.second
sym.third
sym.fourth
sym.fith
EOF
RUN

NAME=manually add signatures
FILE=-
CMDS=<<EOF
zs *
za main b 41574156415541544189fc554889f5534883ec48488b3e64488b042528000000488944243831c067e8b3f40000488d35b6570100bf06000000ff1531ee0100488d3500590100488d3dc4580100ff1565ec0100488d3db7580100ff1538ec0100488d3d499e0000c705e7f001000200000067e899320100c6059a0102000148b80000000000000080488905410202008b05abf00100c705d10002000000000048c705360202000000000048c70523020200ffffffffc6057c0102000083f8020f849c0e000083f8030f85da010000c705c001020000000000be0700000031ff67e81b0a0100c605a301020000488d3d65580100c7059701020000000000c7058901020000000000c6057f01020000c6057701020000c7055501020000000000c6053601020000c7052801020001000000c6051f01020000c6051701020000c705080102000000000048c705f50002000000000048c705e200020000000000c6056001020000ff1575ea01004989c54885c07438b904000000488d15618a0100488d35dae701004889c767e84192000085c00f880c0900004898488d15408a010031ff8b348267e85509010048c7055a00020050000000488d3da9570100ff151dea01004989c54885c074098038000f85060900004c8d6c242031c0be13540000bf010000004c89eaff156aeb010083f8ff740e0f:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ff000000000000ffffffffffff0000000000ff000000000000ff000000000000ff0000000000ff000000000000ff0000000000ff000000000000ff000000000000000000ffff00000000ff000000000000ffffffffffffffffffffff000000000000ff0000000000ff000000000000000000ff00000000000000000000ff00000000000000000000ff000000000000ff0000ffff00000000ff0000ffff00000000ff000000000000000000ffffffffffffffffff00000000ff000000000000ff000000000000ff000000000000000000ff000000000000000000ff000000000000ff000000000000ff000000000000000000ff000000000000ff000000000000000000ff000000000000ff000000000000ff000000000000000000ff00000000000000000000ff00000000000000000000ff000000000000ff0000000000ffffffffffffff00ffffffffffff000000000000ff000000000000ffffffffff00000000ffffffff00000000ffffff000000000000ffffffffffffff00000000ff00000000000000000000ff000000000000ff0000000000ffffffffffffff00ffffffffff00000000ffffffffffffffff00000000ffffffffffffffffff0000000000ffffffff00ff
za main g cc=147 nbbs=226 edges=355 ebbs=8 bbsum=4859
za main o 0x000040a0
za main r sym._obstack_begin sym._obstack_begin sym._obstack_begin
za main v s-64 s-88 s-116 s-96 s-80 s-67 s-65 s-66 s-86 r110 r114
za main t func.main.ret=int func.main.args=3 func.main.arg.0=\"int,argc\" func.main.arg.1=\"char,**,argv\" func.main.arg.2=\"char,**,envp\"
za main h c82a35182e4217e7d7a4662c066be72bff254100ad71e29492350dba46fad184
z*
EOF
EXPECT=<<EOF
zs *
za main b 41574156415541544189fc554889f5534883ec48488b3e64488b042528000000488944243831c067e8b3f40000488d35b6570100bf06000000ff1531ee0100488d3500590100488d3dc4580100ff1565ec0100488d3db7580100ff1538ec0100488d3d499e0000c705e7f001000200000067e899320100c6059a0102000148b80000000000000080488905410202008b05abf00100c705d10002000000000048c705360202000000000048c70523020200ffffffffc6057c0102000083f8020f849c0e000083f8030f85da010000c705c001020000000000be0700000031ff67e81b0a0100c605a301020000488d3d65580100c7059701020000000000c7058901020000000000c6057f01020000c6057701020000c7055501020000000000c6053601020000c7052801020001000000c6051f01020000c6051701020000c705080102000000000048c705f50002000000000048c705e200020000000000c6056001020000ff1575ea01004989c54885c07438b904000000488d15618a0100488d35dae701004889c767e84192000085c00f880c0900004898488d15408a010031ff8b348267e85509010048c7055a00020050000000488d3da9570100ff151dea01004989c54885c074098038000f85060900004c8d6c242031c0be13540000bf010000004c89eaff156aeb010083f8ff740e0f:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ff000000000000ffffffffffff0000000000ff000000000000ff000000000000ff0000000000ff000000000000ff0000000000ff000000000000ff000000000000000000ffff00000000ff000000000000ffffffffffffffffffffff000000000000ff0000000000ff000000000000000000ff00000000000000000000ff00000000000000000000ff000000000000ff0000ffff00000000ff0000ffff00000000ff000000000000000000ffffffffffffffffff00000000ff000000000000ff000000000000ff000000000000000000ff000000000000000000ff000000000000ff000000000000ff000000000000000000ff000000000000ff000000000000000000ff000000000000ff000000000000ff000000000000000000ff00000000000000000000ff00000000000000000000ff000000000000ff0000000000ffffffffffffff00ffffffffffff000000000000ff000000000000ffffffffff00000000ffffffff00000000ffffff000000000000ffffffffffffff00000000ff00000000000000000000ff000000000000ff0000000000ffffffffffffff00ffffffffff00000000ffffffffffffffff00000000ffffffffffffffffff0000000000ffffffff00ff
za main g cc=147 nbbs=226 edges=355 ebbs=8 bbsum=4859
za main o 0x000040a0
za main r sym._obstack_begin sym._obstack_begin sym._obstack_begin
za main v s-64 s-88 s-116 s-96 s-80 s-67 s-65 s-66 s-86 r110 r114
za main t func.main.ret=int func.main.args=3 func.main.arg.0="int,argc" func.main.arg.1="char,**,argv" func.main.arg.2="char,**,envp"
za main h c82a35182e4217e7d7a4662c066be72bff254100ad71e29492350dba46fad184
EOF
RUN

NAME=add types and function name on sig match
FILE=bins/elf/ls
CMDS=<<EOF
zs *
za main o 0x00004070
za main t func.sym.new_function_name.ret=int func.sym.new_function_name.args=2 func.sym.new_function_name.arg.0=\"int,NEWARGC\" func.sym.new_function_name.arg.1=\"char **,NEWARGV\"
za main n sym.new_function_name
s main
af
e zign.match.offset=true
z.
afs
afn
EOF
EXPECT=<<EOF
int sym.new_function_name (int NEWARGC, char **NEWARGV);
sym.new_function_name
EOF
RUN
