NAME=cmp files
FILE=-
CMDS=<<EOF
cmp bins/elf/ls bins/elf/ls
?v $?
?e hello > $a
?e hello > $b
cmp $a $b
?v $?
?e world > $b
cmp $a $b
?v $?
EOF
EXPECT=<<EOF
0x0
0x0
0x1
EOF
RUN

NAME=cmp obj
FILE=bins/elf/ls
CMDS=<<EOF
o bins/elf/crackme
ob
cil
?e --
cis
?e --
cii
?e --
ob 0
cii 0
ob 1
cii 1
EOF
EXPECT=<<EOF
- 0 3 x86-64 ba:0x00000000 sz:136038 bins/elf/ls
* 1 5 x86-64 ba:0x00400000 sz:7441 bins/elf/crackme
 libc.so.6
+libcap.so.2
--
 stdout
-stdin
-.interp
-.note.ABI-tag
-.note.gnu.build-id
-.hash
-.gnu.hash
-.dynsym
-.dynstr
-.gnu.version
-.gnu.version_r
-.rela.dyn
-.rela.plt
-.init
-.plt
-.text
-.fini
-.rodata
-.eh_frame_hdr
-.eh_frame
-.ctors
-.dtors
-.jcr
-.dynamic
-.got
-.got.plt
-.data
-.bss
-.comment
-call_gmon_start
-crtstuff.c
-__CTOR_LIST__
-__DTOR_LIST__
-__JCR_LIST__
-__do_global_dtors_aux
-completed.6341
-dtor_idx.6343
-frame_dummy
-crtstuff.c
-__CTOR_END__
-__FRAME_END__
-__JCR_END__
-__do_global_ctors_aux
-crackme.c
-_GLOBAL_OFFSET_TABLE_
-__init_array_end
-__init_array_start
-_DYNAMIC
-data_start
-__libc_csu_fini
-_start
-_fini
-_IO_stdin_used
-__data_start
-stdin@@GLIBC_2.2.5
-__dso_handle
-__DTOR_END__
-__libc_csu_init
 __bss_start
 _end
 _edata
-stdout@@GLIBC_2.2.5
-main
-_init
-printf
 __gmon_start__
-puts
 __libc_start_main
-fgets
 strcmp
 fflush
+stderr
+optarg
+__progname
+_obstack_begin
+optind
+program_invocation_short_name
+obstack_alloc_failed_handler
+_obstack_begin_1
+_obstack_allocated_p
+_obstack_memory_used
+_obstack_free
+_obstack_newchunk
+program_invocation_name
+__progname_full
+__ctype_toupper_loc
+getenv
+cap_to_text
+sigprocmask
+__snprintf_chk
+raise
+free
+abort
+__errno_location
+strncmp
+_ITM_deregisterTMCloneTable
+localtime_r
+_exit
+strcpy
+__fpending
+isatty
+sigaction
+iswcntrl
+wcswidth
+localeconv
+mbstowcs
+readlink
+clock_gettime
+setenv
+textdomain
+fclose
+opendir
+getpwuid
+bindtextdomain
+dcgettext
+__ctype_get_mb_cur_max
+strlen
+__lxstat
+__stack_chk_fail
+getopt_long
+mbrtowc
+strchr
+getgrgid
+__fxstatat
+snprintf
+__overflow
+strrchr
+gmtime_r
+lseek
+gettimeofday
+__assert_fail
+__strtoul_internal
+fnmatch
+memset
+ioctl
+getcwd
+strspn
+closedir
+memcmp
+_setjmp
+fputs_unlocked
+calloc
+signal
+dirfd
+getpwnam
+__memcpy_chk
+sigemptyset
+memcpy
+getgrnam
+tzset
+fileno
+tcgetpgrp
+__xstat
+readdir
+wcwidth
+malloc
+nl_langinfo
+__fxstat
+strcoll
+mktime
+__freading
+fwrite_unlocked
+realloc
+stpncpy
+setlocale
+__printf_chk
+timegm
+strftime
+mempcpy
+memmove
+error
+fseeko
+cap_get_file
+unsetenv
+cap_free
+strtoul
+__cxa_atexit
+wcstombs
+getxattr
+gethostname
+sigismember
+exit
+fwrite
+__fprintf_chk
+_ITM_registerTMCloneTable
+fflush_unlocked
+mbsinit
+iswprint
+__cxa_finalize
+sigaddset
+__ctype_tolower_loc
+__ctype_b_loc
+__sprintf_chk
--
-printf
 __gmon_start__
-puts
 __libc_start_main
-fgets
 strcmp
 fflush
+__ctype_toupper_loc
+getenv
+cap_to_text
+sigprocmask
+__snprintf_chk
+raise
+free
+abort
+__errno_location
+strncmp
+_ITM_deregisterTMCloneTable
+localtime_r
+_exit
+strcpy
+__fpending
+isatty
+sigaction
+iswcntrl
+wcswidth
+localeconv
+mbstowcs
+readlink
+clock_gettime
+setenv
+textdomain
+fclose
+opendir
+getpwuid
+bindtextdomain
+dcgettext
+__ctype_get_mb_cur_max
+strlen
+__lxstat
+__stack_chk_fail
+getopt_long
+mbrtowc
+strchr
+getgrgid
+__fxstatat
+snprintf
+__overflow
+strrchr
+gmtime_r
+lseek
+gettimeofday
+__assert_fail
+__strtoul_internal
+fnmatch
+memset
+ioctl
+getcwd
+strspn
+closedir
+memcmp
+_setjmp
+fputs_unlocked
+calloc
+signal
+dirfd
+getpwnam
+__memcpy_chk
+sigemptyset
+memcpy
+getgrnam
+tzset
+fileno
+tcgetpgrp
+__xstat
+readdir
+wcwidth
+malloc
+nl_langinfo
+__fxstat
+strcoll
+mktime
+__freading
+fwrite_unlocked
+realloc
+stpncpy
+setlocale
+__printf_chk
+timegm
+strftime
+mempcpy
+memmove
+error
+fseeko
+cap_get_file
+unsetenv
+cap_free
+strtoul
+__cxa_atexit
+wcstombs
+getxattr
+gethostname
+sigismember
+exit
+fwrite
+__fprintf_chk
+_ITM_registerTMCloneTable
+fflush_unlocked
+mbsinit
+iswprint
+__cxa_finalize
+sigaddset
+__ctype_tolower_loc
+__ctype_b_loc
+__sprintf_chk
--
EOF
RUN

NAME=cmp against all functions
FILE=bins/mach0/ls-m1
ARGS=-a arm -b 64
CMDS=<<EOF
aa
afn
cgfa
?e --
s sym.imp.strstr
afn
cgfa
?e --
s 0x100003a1c
afn
cgfa
?e --
s 0x100007348
afn
cgfa
EOF
EXPECT=<<EOF
main
--
sym.imp.strstr
match 1.000000 sym.imp.__assert_rtn
match 1.000000 sym.imp.__error
match 1.000000 sym.imp.__maskrune
match 1.000000 sym.imp.__stack_chk_fail
match 1.000000 sym.imp.__tolower
match 1.000000 sym.imp.abort
match 1.000000 sym.imp.acl_free
match 1.000000 sym.imp.acl_get_entry
match 1.000000 sym.imp.acl_get_flag_np
match 1.000000 sym.imp.acl_get_flagset_np
match 1.000000 sym.imp.acl_get_link_np
match 1.000000 sym.imp.acl_get_perm_np
match 1.000000 sym.imp.acl_get_permset
match 1.000000 sym.imp.acl_get_qualifier
match 1.000000 sym.imp.acl_get_tag_type
match 1.000000 sym.imp.bzero
match 1.000000 sym.imp.calloc
match 1.000000 sym.imp.compat_mode
match 1.000000 sym.imp.err
match 1.000000 sym.imp.errx
match 1.000000 sym.imp.exit
match 1.000000 sym.imp.fflagstostr
match 1.000000 sym.imp.fprintf
match 1.000000 sym.imp.fputc
match 1.000000 sym.imp.fputs
match 1.000000 sym.imp.free
match 1.000000 sym.imp.fts_children
match 1.000000 sym.imp.fts_close
match 1.000000 sym.imp.fts_open
match 1.000000 sym.imp.fts_read
match 1.000000 sym.imp.fts_set
match 1.000000 sym.imp.getbsize
match 1.000000 sym.imp.getenv
match 1.000000 sym.imp.getopt_long
match 1.000000 sym.imp.getpid
match 1.000000 sym.imp.getuid
match 1.000000 sym.imp.getxattr
match 1.000000 sym.imp.group_from_gid
match 1.000000 sym.imp.humanize_number
match 1.000000 sym.imp.ioctl
match 1.000000 sym.imp.isatty
match 1.000000 sym.imp.kill
match 1.000000 sym.imp.listxattr
match 1.000000 sym.imp.localtime
match 1.000000 sym.imp.malloc
match 1.000000 sym.imp.mbr_identifier_translate
match 1.000000 sym.imp.mbrtowc
match 1.000000 sym.imp.memchr
match 1.000000 sym.imp.nl_langinfo
match 1.000000 sym.imp.printf
match 1.000000 sym.imp.putchar
match 1.000000 sym.imp.puts
match 1.000000 sym.imp.readlink
match 1.000000 sym.imp.realloc
match 1.000000 sym.imp.reallocf
match 1.000000 sym.imp.setenv
match 1.000000 sym.imp.setlocale
match 1.000000 sym.imp.signal
match 1.000000 sym.imp.snprintf
match 1.000000 sym.imp.strcmp
match 1.000000 sym.imp.strcoll
match 1.000000 sym.imp.strcpy
match 1.000000 sym.imp.strdup
match 1.000000 sym.imp.strerror
match 1.000000 sym.imp.strftime
match 1.000000 sym.imp.strlen
match 1.000000 sym.imp.strmode
match 1.000000 sym.imp.strtonum
match 1.000000 sym.imp.strtoul
match 1.000000 sym.imp.sysctlbyname
match 1.000000 sym.imp.tgetent
match 1.000000 sym.imp.tgetstr
match 1.000000 sym.imp.tgoto
match 1.000000 sym.imp.time
match 1.000000 sym.imp.tputs
match 1.000000 sym.imp.user_from_uid
match 1.000000 sym.imp.uuid_unparse_upper
match 1.000000 sym.imp.warn
match 1.000000 sym.imp.warnx
match 1.000000 sym.imp.wcwidth
match 1.000000 sym.imp.write
--
sym.func.100003a1c
match 0.866667 sym.func.100003a54
--
sym.func.100007348
match 0.958333 sym.func.100007214
match 0.916667 sym.func.10000722c
match 0.916667 sym.func.100007318
match 0.916667 sym.func.100007330
match 0.916667 sym.func.100007360
EOF
RUN
