NAME=iS query
FILE=../bins/elf/analysis/main
EXPECT=<<EOF
[Sections]

vaddr      name
---------------
0x00000000 
0x00600910 .bss
0x006006e0 .init_array
0x006006e8 .fini_array
0x006006f0 .jcr
0x006008c8 .got
0x0040031e .gnu.version
0x004005b4 .fini
0x00600900 .data
0x004005c0 .rodata
0x00400348 .rela.dyn
0x004003a8 .init
0x00400260 .gnu.hash
0x00400200 .interp
0x0040021c .note.ABI_tag
0x00400328 .gnu.version_r
0x00000000 .comment
0x0040023c .note.gnu.build_id
0x006008d0 .got.plt
0x004005d0 .eh_frame_hdr
0x004002e0 .dynstr
0x004003d0 .plt
0x00400360 .rela.plt
0x00400280 .dynsym
0x00000000 .debug_abbrev
0x00000000 .debug_ranges
0x00000000 .debug_str
0x00000000 .debug_aranges
0x00400608 .eh_frame
0x00000000 .debug_line
0x00000000 .shstrtab
0x00000000 .debug_info
0x00400410 .text
0x006006f8 .dynamic
0x00000000 .strtab
0x00000000 .symtab

EOF
CMDS=<<EOF
iS size/sort,vaddr/cols/name
EOF
RUN

NAME=ib
FILE=../bins/elf/analysis/main
EXPECT=<<EOF
xor ebp, ebp
0x00000410
EOF
CMDS=<<EOF
e bin.baddr=0
e asm.calls=false
ib
op 3
e io.va=0
s entry0
pi 1
?p
EOF
RUN

NAME=ibib
FILE=../bins/elf/analysis/main
EXPECT=<<EOF
works
EOF
CMDS=<<EOF
?e works
ib;ib
EOF
RUN

NAME=ibib2
FILE=../bins/elf/analysis/main
EXPECT=<<EOF
works
EOF
CMDS=<<EOF
ib;ib
?e works
EOF
RUN

NAME=ih (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
[Header fields]
0x00000000 0x00000000 ELF; 0x464c457f
0x00000010 0x00000010 Type; 0x00000002
0x00000012 0x00000012 Machine; 0x00000003
0x00000014 0x00000014 Version; 0x00000001
0x00000018 0x00000018 Entry point; 0x08048300
0x0000001c 0x0000001c PhOff; 0x00000034
0x00000020 0x00000020 ShOff; 0x000007cc

7 fields
EOF
CMDS=<<EOF
ihq
EOF
RUN

NAME=ih* (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
fs header
"f header.ELF 1 0x00000000"
CCu MHg0NjRjNDU3Zg== @ 0x0
Cf 4 x @ 0x0
pf.ELF x
"f header.Type 1 0x00000010"
CCu MHgwMDAwMDAwMg== @ 0x10
Cf 2 x @ 0x10
pf.Type x
"f header.Machine 1 0x00000012"
CCu MHgwMDAwMDAwMw== @ 0x12
Cf 2 x @ 0x12
pf.Machine x
"f header.Version 1 0x00000014"
CCu MHgwMDAwMDAwMQ== @ 0x14
Cf 4 x @ 0x14
pf.Version x
"f header.Entrypoint 1 0x00000018"
CCu MHgwODA0ODMwMA== @ 0x18
Cf 4 x @ 0x18
pf.Entrypoint x
"f header.PhOff 1 0x0000001c"
CCu MHgwMDAwMDAzNA== @ 0x1c
Cf 4 x @ 0x1c
pf.PhOff x
"f header.ShOff 1 0x00000020"
CCu MHgwMDAwMDdjYw== @ 0x20
Cf 4 x @ 0x20
pf.ShOff x
EOF
CMDS=<<EOF
ih*
EOF
RUN

NAME=iZ
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
4899
EOF
CMDS=<<EOF
iZ
EOF
RUN

NAME=iZ*
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
f bin_size @ 4899
EOF
CMDS=<<EOF
iZ*
EOF
RUN

NAME=i (all) (malloc)
FILE=malloc://1025
EXPECT=<<EOF
fd       3
file     malloc://1025
size     0x401
humansz  1.0K
mode     rwx
format   any
iorw     true
blksz    0x0
block    0x100
baddr    0x0
binsz    1025
bits     64
canary   false
crypto   false
endian   little
havecode false
laddr    0x0
linenum  false
lsyms    false
maxopsz  16
minopsz  1
nx       false
pcalign  0
pic      false
relocs   false
sanitiz  false
static   true
stripped false
va       false
[Imports]
nth vaddr bind type lib name
----------------------------

[Exports]

nth paddr vaddr bind type size lib name
---------------------------------------
e cfg.bigendian=false
e asm.bits=64
e asm.dwarf=false
e asm.pcalign=0
fs imports
fs symbols
fs exports
[Imports]
nth vaddr bind type lib name
----------------------------

fs imports
[Entrypoints]

0 entrypoints
fs symbols
[Symbols]

nth paddr vaddr bind type size lib name
---------------------------------------
fs symbols
[Sections]

nth paddr  size vaddr  vsize perm name
--------------------------------------

fs sections
EOF
ARGS=-a x86
CMDS=<<EOF
i
ia
ia*
ii
ii*
ie
ie*
is
is*
iS
iS*
iz
iz*
EOF
RUN

NAME=i (all) (malloc) iI*
FILE=malloc://1024
EXPECT=<<EOF
fd       3
file     malloc://1024
size     0x400
humansz  1K
mode     rwx
format   any
iorw     true
blksz    0x0
block    0x100
e cfg.bigendian=false
e asm.bits=64
e asm.dwarf=false
e asm.pcalign=0
baddr    0x0
binsz    1024
bits     64
canary   false
crypto   false
endian   little
havecode false
laddr    0x0
linenum  false
lsyms    false
maxopsz  16
minopsz  1
nx       false
pcalign  0
pic      false
relocs   false
sanitiz  false
static   true
stripped false
va       false
e cfg.bigendian=false
e asm.bits=64
e asm.dwarf=false
e asm.pcalign=0
EOF
ARGS=-a x86
CMDS=<<EOF
i
i*
iI
iI*
EOF
RUN

NAME=i (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
fd       3
size     0x1323
humansz  4.8K
mode     r-x
format   elf
iorw     false
blksz    0x0
block    0x100
arch     x86
baddr    0x8048000
binsz    4899
bintype  elf
bits     32
canary   false
class    ELF32
compiler GCC: (GNU) 4.8.2
crypto   false
endian   little
havecode true
intrp    /lib/ld-linux.so.2
laddr    0x0
lang     c
linenum  true
lsyms    true
machine  Intel 80386
maxopsz  16
minopsz  1
nx       true
os       linux
pcalign  0
pic      false
relocs   true
relro    no
rpath    NONE
sanitiz  false
static   false
stripped false
subsys   linux
va       true
EOF
CMDS=<<EOF
i~!file
EOF
RUN

NAME=iA (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
0   0x00000000 4899 x86_32 

EOF
CMDS=<<EOF
iA
EOF
RUN

NAME=ib java class file
FILE=malloc://1024
EXPECT=<<EOF
fd       3
file     malloc://1024
size     0x400
humansz  1K
mode     rwx
format   java
iorw     true
blksz    0x0
block    0x100
type     JAVA CLASS
arch     java
baddr    0x0
binsz    1024
bintype  class
bits     32
canary   false
retguard false
class    0x3200 0x0000
crypto   false
endian   little
havecode true
laddr    0x0
lang     java 6
linenum  true
lsyms    true
machine  jvm
nx       false
os       any
pic      false
relocs   false
sanitiz  false
static   false
stripped false
subsys   any
va       false
  ;-- entry1:
  ;-- sym.TestVariableSwitchUp.TestMultipleVariable:
/ (fcn) method.TestVariableSwitchUp.TestMultipleVariable 37
| 0x000002fd      1064           bipush 100
| 0x000002ff      b8000f         invokestatic java/lang/Integer/valueOf(I)Ljava/lang/Integer;
| 0x00000302      4b             astore_0
| 0x00000303      1064           bipush 100
| 0x00000305      3c             istore_1
| 0x00000306      1215           ldc "tryone"
| 0x00000308      4d             astore_2
| 0x00000309      03             iconst_0
| 0x0000030a      3e             istore_3
| 0x0000030b      b20017         getstatic java/lang/System/out Ljava/io/PrintStream;
| 0x0000030e      bb001d         new java/lang/StringBuilder
| 0x00000311      59             dup
| 0x00000312      121f           ldc "Attempting print "
| 0x00000314      b70021         invokespecial java/lang/StringBuilder/<init>(Ljava/lang/String;)V
| 0x00000317      2c             aload_2
| 0x00000318      b60024         invokevirtual java/lang/StringBuilder/append(Ljava/lang/String;)Ljava/lang/StringBuilder;
| 0x0000031b      b60028         invokevirtual java/lang/StringBuilder/toString()Ljava/lang/String;
| 0x0000031e      b6002c         invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V
\ 0x00000321      b1             return
EOF
CMDS=<<EOF
e asm.calls=false
e asm.comments=false
e asm.cmtflgrefs=false
e scr.color=false
e asm.lines.bb=false
e asm.xrefs=false
wx cafebabe00000032003a070002010014546573745661726961626c6553776974636855700700040100106a6176612f6c616e672f4f626a6563740100063c696e69743e010003282956010004436f64650a000300090c0005000601000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c65010004746869730100164c546573745661726961626c6553776974636855703b010014546573744d756c7469706c655661726961626c650a001000120700110100116a6176612f6c616e672f496e74656765720c0013001401000776616c75654f660100162849294c6a6176612f6c616e672f496e74656765723b0800160100067472796f6e65090018001a0700190100106a6176612f6c616e672f53797374656d0c001b001c0100036f75740100154c6a6176612f696f2f5072696e7453747265616d3b07001e0100176a6176612f6c616e672f537472696e674275696c646572080020010011417474656d7074696e67207072696e74200a001d00220c00050023010015284c6a6176612f6c616e672f537472696e673b29560a001d00250c00260027010006617070656e6401002d284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275696c6465723b0a001d00290c002a002b010008746f537472696e6701001428294c6a6176612f6c616e672f537472696e673b0a002d002f07002e0100136a6176612f696f2f5072696e7453747265616d0c003000230100057072696e74010001690100134c6a6176612f6c616e672f496e74656765723b01000170010001490100016b0100124c6a6176612f6c616e672f537472696e673b0100016a01000a536f7572636546696c65010019546573745661726961626c6553776974636855702e6a617661002100010003000000000002000100050006000100070000002f00010001000000052ab70008b100000002000a00000006000100000002000b0000000c000100000005000c000d00000008000e0006000100070000008100040004000000251064b8000f4b10643c12154d033eb20017bb001d59121fb700212cb60024b60028b6002cb100000002000a0000001a0006000000040006000500090006000c0007000e000800240009000b0000002a00040006001f0031003200000009001c003300340001000c0019003500360002000e001700370034000300010038000000020039
ib
if
af
pdf
EOF

RUN

NAME=ic cpp classes
FILE=../bins/elf/libmagic.so
EXPECT=<<EOF
0x00000000 [0x00006060 - 0x0000697c]   2332 class 0 _JNIEnv
0x000074f8 method 0      inject(_JNIEnv*, _jobject*, _jstring*, _jstring*)
0x0000699c method 1      findBaseDexClassloader(_JNIEnv*, _jobject*)
0x00006a2c method 2      getField(_JNIEnv*, _jobject*, _jobject*, _jstring*)
0x00006abc method 3      getPathList(_JNIEnv*, _jobject*)
0x00006af4 method 4      getDexElements(_JNIEnv*, _jobject*)
0x00006b1c method 5      setField(_JNIEnv*, _jobject*, _jobject*, _jstring*, _jobject*)
0x00006bb0 method 6      combineArray(_JNIEnv*, _jobject*, _jobject*)
0x00006d00 method 7      injectAboveEqualApiLevel14(_JNIEnv*, _jobject*, _jstring*, _jstring*)
0x00006e5c method 8      appendArray(_JNIEnv*, _jobject*, _jobject*)
0x00006f68 method 9      injectInAliyunOs(_JNIEnv*, _jobject*, _jstring*, _jstring*)
0x0000720c method 10      injectBelowApiLevel14(_JNIEnv*, _jobject*, _jstring*, _jstring*)
0x00006060 method 0      FindClass(char const*)
EOF
CMDS=<<EOF
ic~_JNIEnv
ic~FindClass
EOF
RUN

NAME=ic?
BROKEN=1
FILE=../bins/elf/libmagic.so
EXPECT=<<EOF
1
EOF
CMDS=<<EOF
ic?~?Usage
EOF
RUN

NAME=icl
FILE=../bins/elf/libmagic.so
EXPECT=<<EOF
0x24672 0x24682 0x24692 0x24718 0x24728 0x24740 0x24768 0x24796 0x24810 0x26974 0x27004
0x29944 0x27036 0x27180 0x27324 0x27380 0x27420 0x27568 0x27904 0x28252 0x28520 0x29196
0x38000 0x34924 0x38036 0x38060 0x38088
0x34948 0x35060
0x34972 0x35076
0x35012
0x35036
0x35204
0x37948 0x38024
0x38116
0x38844 0x38868 0x38876 0x38996 0x38884 0x38920
0x38184 0x38192 0x38260
0x40432 0x40500 0x40400
0x38388 0x38456 0x38556 0x38780
0x39128 0x39196 0x39240 0x39016 0x39108 0x39308
0x40644 0x75648 0x75720
0x75440 0x75512
0x75456 0x75472
0x76760 0x76744
0x76844 0x76828
EOF
CMDS=<<EOF
icl
EOF
RUN

NAME=icj
FILE=../bins/elf/libmagic.so
EXPECT='[
  {
    "classname": "_JNIEnv",
    "addr": 0,
    "index": 0,
    "methods": [
      {
        "name": "FindClass(char const*)",
        "addr": 24672
      },
      {
        "name": "DeleteLocalRef(_jobject*)",
        "addr": 24682
      },
      {
        "name": "NewObject(_jclass*, _jmethodID*, ...)",
        "addr": 24692
      },
      {
        "name": "GetObjectClass(_jobject*)",
        "addr": 24718
      },
      {
        "name": "GetMethodID(_jclass*, char const*, char const*)",
        "addr": 24728
      },
      {
        "name": "CallObjectMethod(_jobject*, _jmethodID*, ...)",
        "addr": 24740
      },
      {
        "name": "CallVoidMethod(_jobject*, _jmethodID*, ...)",
        "addr": 24768
      },
      {
        "name": "GetStaticMethodID(_jclass*, char const*, char const*)",
        "addr": 24796
      },
      {
        "name": "CallStaticObjectMethod(_jclass*, _jmethodID*, ...)",
        "addr": 24810
      },
      {
        "name": "CallStaticIntMethod(_jclass*, _jmethodID*, ...)",
        "addr": 26974
      },
      {
        "name": "CallStaticVoidMethod(_jclass*, _jmethodID*, ...)",
        "addr": 27004
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "SystemClassLoaderInjector",
    "addr": 0,
    "index": 1,
    "methods": [
      {
        "name": "inject(_JNIEnv*, _jobject*, _jstring*, _jstring*)",
        "addr": 29944
      },
      {
        "name": "findBaseDexClassloader(_JNIEnv*, _jobject*)",
        "addr": 27036
      },
      {
        "name": "getField(_JNIEnv*, _jobject*, _jobject*, _jstring*)",
        "addr": 27180
      },
      {
        "name": "getPathList(_JNIEnv*, _jobject*)",
        "addr": 27324
      },
      {
        "name": "getDexElements(_JNIEnv*, _jobject*)",
        "addr": 27380
      },
      {
        "name": "setField(_JNIEnv*, _jobject*, _jobject*, _jstring*, _jobject*)",
        "addr": 27420
      },
      {
        "name": "combineArray(_JNIEnv*, _jobject*, _jobject*)",
        "addr": 27568
      },
      {
        "name": "injectAboveEqualApiLevel14(_JNIEnv*, _jobject*, _jstring*, _jstring*)",
        "addr": 27904
      },
      {
        "name": "appendArray(_JNIEnv*, _jobject*, _jobject*)",
        "addr": 28252
      },
      {
        "name": "injectInAliyunOs(_JNIEnv*, _jobject*, _jstring*, _jstring*)",
        "addr": 28520
      },
      {
        "name": "injectBelowApiLevel14(_JNIEnv*, _jobject*, _jstring*, _jstring*)",
        "addr": 29196
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "std",
    "addr": 0,
    "index": 2,
    "methods": [
      {
        "name": "terminate()",
        "addr": 38000
      },
      {
        "name": "uncaught_exception()",
        "addr": 34924
      },
      {
        "name": "unexpected()",
        "addr": 38036
      },
      {
        "name": "set_terminate(void (*)())",
        "addr": 38060
      },
      {
        "name": "set_unexpected(void (*)())",
        "addr": 38088
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "std::exception",
    "addr": 0,
    "index": 3,
    "methods": [
      {
        "name": "~exception()",
        "addr": 34948
      },
      {
        "name": "what() const",
        "addr": 35060
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "std::bad_exception",
    "addr": 0,
    "index": 4,
    "methods": [
      {
        "name": "~bad_exception()",
        "addr": 34972
      },
      {
        "name": "what() const",
        "addr": 35076
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__cxxabiv1::__forced_unwind",
    "addr": 0,
    "index": 5,
    "methods": [
      {
        "name": "~__forced_unwind()",
        "addr": 35012
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__cxxabiv1::__foreign_exception",
    "addr": 0,
    "index": 6,
    "methods": [
      {
        "name": "~__foreign_exception()",
        "addr": 35036
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__eh_globals_init",
    "addr": 0,
    "index": 7,
    "methods": [
      {
        "name": "~__eh_globals_init()",
        "addr": 35204
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__cxxabiv1",
    "addr": 0,
    "index": 8,
    "methods": [
      {
        "name": "__terminate(void (*)())",
        "addr": 37948
      },
      {
        "name": "__unexpected(void (*)())",
        "addr": 38024
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__cxxabiv1::__fundamental_type_info",
    "addr": 0,
    "index": 9,
    "methods": [
      {
        "name": "~__fundamental_type_info()",
        "addr": 38116
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "std::type_info",
    "addr": 0,
    "index": 10,
    "methods": [
      {
        "name": "~type_info()",
        "addr": 38844
      },
      {
        "name": "__is_pointer_p() const",
        "addr": 38868
      },
      {
        "name": "__is_function_p() const",
        "addr": 38876
      },
      {
        "name": "__do_catch(std::type_info const*, void**, unsigned int) const",
        "addr": 38996
      },
      {
        "name": "__do_upcast(__cxxabiv1::__class_type_info const*, void**) const",
        "addr": 38884
      },
      {
        "name": "operator==(std::type_info const&) const",
        "addr": 38920
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__cxxabiv1::__pointer_type_info",
    "addr": 0,
    "index": 11,
    "methods": [
      {
        "name": "__is_pointer_p() const",
        "addr": 38184
      },
      {
        "name": "~__pointer_type_info()",
        "addr": 38192
      },
      {
        "name": "__pointer_catch(__cxxabiv1::__pbase_type_info const*, void**, unsigned int) const",
        "addr": 38260
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__cxxabiv1::__pbase_type_info",
    "addr": 0,
    "index": 12,
    "methods": [
      {
        "name": "~__pbase_type_info()",
        "addr": 40432
      },
      {
        "name": "__do_catch(std::type_info const*, void**, unsigned int) const",
        "addr": 40500
      },
      {
        "name": "__pointer_catch(__cxxabiv1::__pbase_type_info const*, void**, unsigned int) const",
        "addr": 40400
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__cxxabiv1::__si_class_type_info",
    "addr": 0,
    "index": 13,
    "methods": [
      {
        "name": "~__si_class_type_info()",
        "addr": 38388
      },
      {
        "name": "__do_find_public_src(int, void const*, __cxxabiv1::__class_type_info const*, void const*) const",
        "addr": 38456
      },
      {
        "name": "__do_dyncast(int, __cxxabiv1::__class_type_info::__sub_kind, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__dyncast_result&) const",
        "addr": 38556
      },
      {
        "name": "__do_upcast(__cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__upcast_result&) const",
        "addr": 38780
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__cxxabiv1::__class_type_info",
    "addr": 0,
    "index": 14,
    "methods": [
      {
        "name": "~__class_type_info()",
        "addr": 39128
      },
      {
        "name": "__do_upcast(__cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__upcast_result&) const",
        "addr": 39196
      },
      {
        "name": "__do_catch(std::type_info const*, void**, unsigned int) const",
        "addr": 39240
      },
      {
        "name": "__do_upcast(__cxxabiv1::__class_type_info const*, void**) const",
        "addr": 39016
      },
      {
        "name": "__do_find_public_src(int, void const*, __cxxabiv1::__class_type_info const*, void const*) const",
        "addr": 39108
      },
      {
        "name": "__do_dyncast(int, __cxxabiv1::__class_type_info::__sub_kind, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__dyncast_result&) const",
        "addr": 39308
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__gnu_cxx",
    "addr": 0,
    "index": 15,
    "methods": [
      {
        "name": "__verbose_terminate_handler()",
        "addr": 40644
      },
      {
        "name": "__throw_concurrence_lock_error()",
        "addr": 75648
      },
      {
        "name": "__throw_concurrence_unlock_error()",
        "addr": 75720
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__gnu_cxx::__concurrence_lock_error",
    "addr": 0,
    "index": 16,
    "methods": [
      {
        "name": "what() const",
        "addr": 75440
      },
      {
        "name": "~__concurrence_lock_error()",
        "addr": 75512
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "__gnu_cxx::__concurrence_unlock_error",
    "addr": 0,
    "index": 17,
    "methods": [
      {
        "name": "what() const",
        "addr": 75456
      },
      {
        "name": "~__concurrence_unlock_error()",
        "addr": 75472
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "std::bad_cast",
    "addr": 0,
    "index": 18,
    "methods": [
      {
        "name": "~bad_cast()",
        "addr": 76760
      },
      {
        "name": "what() const",
        "addr": 76744
      }
    ],
    "fields": [
      
    ]
  },
  {
    "classname": "std::bad_typeid",
    "addr": 0,
    "index": 19,
    "methods": [
      {
        "name": "~bad_typeid()",
        "addr": 76844
      },
      {
        "name": "what() const",
        "addr": 76828
      }
    ],
    "fields": [
      
    ]
  }
]'
CMDS=<<EOF
icj~{}
EOF
RUN

NAME=ic*
FILE=../bins/elf/libmagic.so
EXPECT=<<EOF
fs classes
"f class.JNIEnv = 0x6060"
"f method._JNIEnv.FindClass(char_const*) = 0x6060"
"f method._JNIEnv.DeleteLocalRef(_jobject*) = 0x606a"
"f method._JNIEnv.NewObject(_jclass*,__jmethodID*,_...) = 0x6074"
"f method._JNIEnv.GetObjectClass(_jobject*) = 0x608e"
"f method._JNIEnv.GetMethodID(_jclass*,_char_const*,_char_const*) = 0x6098"
"f method._JNIEnv.CallObjectMethod(_jobject*,__jmethodID*,_...) = 0x60a4"
"f method._JNIEnv.CallVoidMethod(_jobject*,__jmethodID*,_...) = 0x60c0"
"f method._JNIEnv.GetStaticMethodID(_jclass*,_char_const*,_char_const*) = 0x60dc"
"f method._JNIEnv.CallStaticObjectMethod(_jclass*,__jmethodID*,_...) = 0x60ea"
"f method._JNIEnv.CallStaticIntMethod(_jclass*,__jmethodID*,_...) = 0x695e"
"f method._JNIEnv.CallStaticVoidMethod(_jclass*,__jmethodID*,_...) = 0x697c"
"f class.SystemClassLoaderInjector = 0x699c"
"f method.SystemClassLoaderInjector.inject(_JNIEnv*,__jobject*,__jstring*,__jstring*) = 0x74f8"
"f method.SystemClassLoaderInjector.findBaseDexClassloader(_JNIEnv*,__jobject*) = 0x699c"
"f method.SystemClassLoaderInjector.getField(_JNIEnv*,__jobject*,__jobject*,__jstring*) = 0x6a2c"
"f method.SystemClassLoaderInjector.getPathList(_JNIEnv*,__jobject*) = 0x6abc"
"f method.SystemClassLoaderInjector.getDexElements(_JNIEnv*,__jobject*) = 0x6af4"
"f method.SystemClassLoaderInjector.setField(_JNIEnv*,__jobject*,__jobject*,__jstring*,__jobject*) = 0x6b1c"
"f method.SystemClassLoaderInjector.combineArray(_JNIEnv*,__jobject*,__jobject*) = 0x6bb0"
"f method.SystemClassLoaderInjector.injectAboveEqualApiLevel14(_JNIEnv*,__jobject*,__jstring*,__jstring*) = 0x6d00"
"f method.SystemClassLoaderInjector.appendArray(_JNIEnv*,__jobject*,__jobject*) = 0x6e5c"
"f method.SystemClassLoaderInjector.injectInAliyunOs(_JNIEnv*,__jobject*,__jstring*,__jstring*) = 0x6f68"
"f method.SystemClassLoaderInjector.injectBelowApiLevel14(_JNIEnv*,__jobject*,__jstring*,__jstring*) = 0x720c"
"f class.std = 0x886c"
"f method.std.terminate() = 0x9470"
"f method.std.uncaught_exception() = 0x886c"
"f method.std.unexpected() = 0x9494"
"f method.std.set_terminate(void_(*)()) = 0x94ac"
"f method.std.set_unexpected(void_(*)()) = 0x94c8"
"f class.std::exception = 0x8884"
"f method.std::exception.~exception() = 0x8884"
"f method.std::exception.what()_const = 0x88f4"
"f class.std::bad_exception = 0x889c"
"f method.std::bad_exception.~bad_exception() = 0x889c"
"f method.std::bad_exception.what()_const = 0x8904"
"f class.cxxabiv1::__forced_unwind = 0x88c4"
"f method.__cxxabiv1::__forced_unwind.~__forced_unwind() = 0x88c4"
"f class.cxxabiv1::__foreign_exception = 0x88dc"
"f method.__cxxabiv1::__foreign_exception.~__foreign_exception() = 0x88dc"
"f class.eh_globals_init = 0x8984"
"f method.__eh_globals_init.~__eh_globals_init() = 0x8984"
"f class.cxxabiv1 = 0x943c"
"f method.__cxxabiv1.__terminate(void_(*)()) = 0x943c"
"f method.__cxxabiv1.__unexpected(void_(*)()) = 0x9488"
"f class.cxxabiv1::__fundamental_type_info = 0x94e4"
"f method.__cxxabiv1::__fundamental_type_info.~__fundamental_type_info() = 0x94e4"
"f class.std::type_info = 0x97bc"
"f method.std::type_info.~type_info() = 0x97bc"
"f method.std::type_info.__is_pointer_p()_const = 0x97d4"
"f method.std::type_info.__is_function_p()_const = 0x97dc"
"f method.std::type_info.__do_catch(std::type_info_const*,_void**,_unsigned_int)_const = 0x9854"
"f method.std::type_info.__do_upcast(__cxxabiv1::__class_type_info_const*,_void**)_const = 0x97e4"
"f method.std::type_info.operator==(std::type_info_const&)_const = 0x9808"
"f class.cxxabiv1::__pointer_type_info = 0x9528"
"f method.__cxxabiv1::__pointer_type_info.__is_pointer_p()_const = 0x9528"
"f method.__cxxabiv1::__pointer_type_info.~__pointer_type_info() = 0x9530"
"f method.__cxxabiv1::__pointer_type_info.__pointer_catch(__cxxabiv1::__pbase_type_info_const*,_void**,_unsigned_int)_const = 0x9574"
"f class.cxxabiv1::__pbase_type_info = 0x9dd0"
"f method.__cxxabiv1::__pbase_type_info.~__pbase_type_info() = 0x9df0"
"f method.__cxxabiv1::__pbase_type_info.__do_catch(std::type_info_const*,_void**,_unsigned_int)_const = 0x9e34"
"f method.__cxxabiv1::__pbase_type_info.__pointer_catch(__cxxabiv1::__pbase_type_info_const*,_void**,_unsigned_int)_const = 0x9dd0"
"f class.cxxabiv1::__si_class_type_info = 0x95f4"
"f method.__cxxabiv1::__si_class_type_info.~__si_class_type_info() = 0x95f4"
"f method.__cxxabiv1::__si_class_type_info.__do_find_public_src(int,_void_const*,___cxxabiv1::__class_type_info_const*,_void_const*)_const = 0x9638"
"f method.__cxxabiv1::__si_class_type_info.__do_dyncast(int,___cxxabiv1::__class_type_info::__sub_kind,___cxxabiv1::__class_type_info_const*,_void_const*,___cxxabiv1::__class_type_info_const*,_void_const*,___cxxabiv1::__class_type_info::__dyncast_result&)_const = 0x969c"
"f method.__cxxabiv1::__si_class_type_info.__do_upcast(__cxxabiv1::__class_type_info_const*,_void_const*,___cxxabiv1::__class_type_info::__upcast_result&)_const = 0x977c"
"f class.cxxabiv1::__class_type_info = 0x9868"
"f method.__cxxabiv1::__class_type_info.~__class_type_info() = 0x98d8"
"f method.__cxxabiv1::__class_type_info.__do_upcast(__cxxabiv1::__class_type_info_const*,_void_const*,___cxxabiv1::__class_type_info::__upcast_result&)_const = 0x991c"
"f method.__cxxabiv1::__class_type_info.__do_catch(std::type_info_const*,_void**,_unsigned_int)_const = 0x9948"
"f method.__cxxabiv1::__class_type_info.__do_upcast(__cxxabiv1::__class_type_info_const*,_void**)_const = 0x9868"
"f method.__cxxabiv1::__class_type_info.__do_find_public_src(int,_void_const*,___cxxabiv1::__class_type_info_const*,_void_const*)_const = 0x98c4"
"f method.__cxxabiv1::__class_type_info.__do_dyncast(int,___cxxabiv1::__class_type_info::__sub_kind,___cxxabiv1::__class_type_info_const*,_void_const*,___cxxabiv1::__class_type_info_const*,_void_const*,___cxxabiv1::__class_type_info::__dyncast_result&)_const = 0x998c"
"f class.gnu_cxx = 0x9ec4"
"f method.__gnu_cxx.__verbose_terminate_handler() = 0x9ec4"
"f method.__gnu_cxx.__throw_concurrence_lock_error() = 0x12780"
"f method.__gnu_cxx.__throw_concurrence_unlock_error() = 0x127c8"
"f class.gnu_cxx::__concurrence_lock_error = 0x126b0"
"f method.__gnu_cxx::__concurrence_lock_error.what()_const = 0x126b0"
"f method.__gnu_cxx::__concurrence_lock_error.~__concurrence_lock_error() = 0x126f8"
"f class.gnu_cxx::__concurrence_unlock_error = 0x126c0"
"f method.__gnu_cxx::__concurrence_unlock_error.what()_const = 0x126c0"
"f method.__gnu_cxx::__concurrence_unlock_error.~__concurrence_unlock_error() = 0x126d0"
"f class.std::bad_cast = 0x12bc8"
"f method.std::bad_cast.~bad_cast() = 0x12bd8"
"f method.std::bad_cast.what()_const = 0x12bc8"
"f class.std::bad_typeid = 0x12c1c"
"f method.std::bad_typeid.~bad_typeid() = 0x12c2c"
"f method.std::bad_typeid.what()_const = 0x12c1c"
EOF
CMDS=<<EOF
ic*
EOF
RUN

NAME=icc
FILE=../bins/elf/libmagic.so
EXPECT=<<EOF
@interface _JNIEnv
{
}
@end
@interface SystemClassLoaderInjector
{
}
@end
@interface std
{
}
@end
@interface std::exception
{
}
@end
@interface std::bad_exception
{
}
@end
@interface __cxxabiv1::__forced_unwind
{
}
@end
@interface __cxxabiv1::__foreign_exception
{
}
@end
@interface __eh_globals_init
{
}
@end
@interface __cxxabiv1
{
}
@end
@interface __cxxabiv1::__fundamental_type_info
{
}
@end
@interface std::type_info
{
}
@end
@interface __cxxabiv1::__pointer_type_info
{
}
@end
@interface __cxxabiv1::__pbase_type_info
{
}
@end
@interface __cxxabiv1::__si_class_type_info
{
}
@end
@interface __cxxabiv1::__class_type_info
{
}
@end
@interface __gnu_cxx
{
}
@end
@interface __gnu_cxx::__concurrence_lock_error
{
}
@end
@interface __gnu_cxx::__concurrence_unlock_error
{
}
@end
@interface std::bad_cast
{
}
@end
@interface std::bad_typeid
{
}
@end
EOF
CMDS=<<EOF
icc
EOF
RUN

NAME=iq
FILE=../bins/elf/libmagic.so
EXPECT=<<EOF
arch arm
bits 16
os linux
endian little
minopsz 2
maxopsz 4
pcalign 2
EOF
CMDS=<<EOF
iq
EOF
RUN

NAME=iaq
FILE=../bins/elf/libmagic.so
EXPECT=<<EOF
arch arm
bits 16
os linux
endian little
minopsz 2
maxopsz 4
pcalign 2
__cxa_finalize
__cxa_atexit
malloc
memcpy
strlen
strdup
strstr
free
fopen
fread
fwrite
fflush
fclose
strrchr
memset
strcat
strncpy
remove
__stack_chk_fail
__stack_chk_guard
__gnu_Unwind_Find_exidx
abort
sym.imp.operator delete(void*)
__cxa_pure_virtual
pthread_key_delete
pthread_getspecific
pthread_setspecific
pthread_key_create
strcmp
fputs
fputc
__sF
memcmp
realloc
sprintf
strncmp
pthread_mutex_lock
pthread_mutex_unlock
0x00005fa8
0x00007c70 10 __aeabi_unwind_cpp_pr0
0x00006108 48 getPackageName(_JNIEnv*, _jobject*)
0x00006138 164 JstringToString(_JNIEnv*, _jstring*)
0x000061dc 136 CharTojstring(_JNIEnv*, char const*)
0x00006264 196 invokeStaticMethodss(_JNIEnv*, _jstring*, _jstring*)
0x00006328 148 getFieldOjbectEx(_JNIEnv*, _jclass*, _jobject*, _jstring*)
0x000063bc 84 getFieldOjbect(_JNIEnv*, _jstring*, _jobject*, _jstring*)
0x00006410 152 setFieldOjbectEx(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jobject*)
0x000064a8 92 setFieldOjbect(_JNIEnv*, _jstring*, _jstring*, _jobject*, _jobject*)
0x00006504 34 checkException(_JNIEnv*)
0x00006528 76 forName(_JNIEnv*, _jstring*)
0x00006574 32 GetFileName(char*)
0x00006594 216 replaceAll(char const*, char const*, char const*)
0x0000666c 152 decode(_JNIEnv*, _jstring*, _jstring*)
0x00006704 12 sub_444(_JNIEnv*, _jobject*, _jobject*, _jstring*, _jstring*)
0x00006710 476 sub_333(_JNIEnv*, _jobject*, _jobject*, _jstring*, _jstring*)
0x000074f8 100 SystemClassLoaderInjector::inject(_JNIEnv*, _jobject*, _jstring*, _jstring*)
0x000068ec 42 registerNativeMethods(_JNIEnv*, char const*, JNINativeMethod*, int)
0x00006918 28 register_ndk_load(_JNIEnv*)
0x00006934 40 JNI_OnLoad
0x0000695c 2 decodeFile()
0x0000699c 144 SystemClassLoaderInjector::findBaseDexClassloader(_JNIEnv*, _jobject*)
0x00006a2c 144 SystemClassLoaderInjector::getField(_JNIEnv*, _jobject*, _jobject*, _jstring*)
0x00006abc 56 SystemClassLoaderInjector::getPathList(_JNIEnv*, _jobject*)
0x00006af4 40 SystemClassLoaderInjector::getDexElements(_JNIEnv*, _jobject*)
0x00006b1c 148 SystemClassLoaderInjector::setField(_JNIEnv*, _jobject*, _jobject*, _jstring*, _jobject*)
0x00006bb0 336 SystemClassLoaderInjector::combineArray(_JNIEnv*, _jobject*, _jobject*)
0x00006d00 348 SystemClassLoaderInjector::injectAboveEqualApiLevel14(_JNIEnv*, _jobject*, _jstring*, _jstring*)
0x00008dd4 1640 __gxx_personality_v0
0x000083f0 0 __cxa_end_cleanup
0x000086b4 224 __cxa_begin_catch
0x00008794 216 __cxa_end_catch
0x00006e5c 268 SystemClassLoaderInjector::appendArray(_JNIEnv*, _jobject*, _jobject*)
0x00006f68 676 SystemClassLoaderInjector::injectInAliyunOs(_JNIEnv*, _jobject*, _jstring*, _jstring*)
0x0000720c 748 SystemClassLoaderInjector::injectBelowApiLevel14(_JNIEnv*, _jobject*, _jstring*, _jstring*)
0x00007f00 0 __gnu_Unwind_Restore_VFP_D
0x00007ef0 0 __gnu_Unwind_Restore_VFP
0x00007f10 0 __gnu_Unwind_Restore_VFP_D_16_to_31
0x00007f20 0 __gnu_Unwind_Restore_WMMXD
0x00007fa8 0 __gnu_Unwind_Restore_WMMXC
0x00007edc 20 restore_core_regs
0x00007814 4 _Unwind_GetCFA
0x00007818 78 __gnu_Unwind_RaiseException
0x00007866 20 __gnu_Unwind_ForcedUnwind
0x0000787a 68 __gnu_Unwind_Resume
0x000078be 26 __gnu_Unwind_Resume_or_Rethrow
0x000078d8 2 _Unwind_Complete
0x000078da 16 _Unwind_DeleteException
0x000078ea 52 _Unwind_VRS_Get
0x000083dc 18 __gnu_thumb1_case_uqi
0x00007934 52 _Unwind_VRS_Set
0x00007980 112 __gnu_Unwind_Backtrace
0x00008544 180 __cxa_begin_cleanup
0x00008400 324 __cxa_type_match
0x000080fc 656 __gnu_unwind_execute
0x00009a78 436 __cxa_call_unexpected
0x00007c8e 590 _Unwind_VRS_Pop
0x00007f64 0 __gnu_Unwind_Save_WMMXD
0x00007fbc 0 __gnu_Unwind_Save_WMMXC
0x00007f08 0 __gnu_Unwind_Save_VFP_D
0x00007ef8 0 __gnu_Unwind_Save_VFP
0x00007f18 0 __gnu_Unwind_Save_VFP_D_16_to_31
0x00007edc 20 __restore_core_regs
0x00007fd0 42 ___Unwind_RaiseException
0x00007fd0 42 _Unwind_RaiseException
0x00007ffc 42 ___Unwind_Resume
0x00007ffc 42 _Unwind_Resume
0x00008028 42 ___Unwind_Resume_or_Rethrow
0x00008028 42 _Unwind_Resume_or_Rethrow
0x00008054 42 ___Unwind_ForcedUnwind
0x00008054 42 _Unwind_ForcedUnwind
0x00008080 42 ___Unwind_Backtrace
0x00008080 42 _Unwind_Backtrace
0x0000838c 38 __gnu_unwind_frame
0x000083b2 10 _Unwind_GetRegionStart
0x000083bc 20 _Unwind_GetLanguageSpecificData
0x000083d0 6 _Unwind_GetDataRelBase
0x000083d6 6 _Unwind_GetTextRelBase
0x00017024 0 _edata
0x00017024 0 __bss_start
0x0001bf58 0 _end
0x000085f8 180 __gnu_end_cleanup
0x000167f4 8 typeinfo for __cxxabiv1::__foreign_exception
0x000167c0 8 typeinfo for __cxxabiv1::__forced_unwind
0x00008a3c 144 __cxa_get_globals
0x00009470 24 std::terminate()
0x000086ac 8 __cxa_get_exception_ptr
0x000089f4 72 __cxa_get_globals_fast
0x0000886c 24 std::uncaught_exception()
0x00008884 24 std::exception::~exception()
0x00016830 20 vtable for std::exception
0x00008884 24 std::exception::~exception()
0x0000889c 40 std::bad_exception::~bad_exception()
0x000167d0 20 vtable for std::bad_exception
0x0000889c 40 std::bad_exception::~bad_exception()
0x000088c4 24 __cxxabiv1::__forced_unwind::~__forced_unwind()
0x00016800 20 vtable for __cxxabiv1::__forced_unwind
0x000088c4 24 __cxxabiv1::__forced_unwind::~__forced_unwind()
0x000088dc 24 __cxxabiv1::__foreign_exception::~__foreign_exception()
0x00016818 20 vtable for __cxxabiv1::__foreign_exception
0x000088dc 24 __cxxabiv1::__foreign_exception::~__foreign_exception()
0x000088f4 16 std::exception::what() const
0x00008904 16 std::bad_exception::what() const
0x00008914 28 std::exception::~exception()
0x00008930 28 std::bad_exception::~bad_exception()
0x0000894c 28 __cxxabiv1::__forced_unwind::~__forced_unwind()
0x00008968 28 __cxxabiv1::__foreign_exception::~__foreign_exception()
0x000148dc 13 typeinfo name for std::exception
0x000167c8 8 typeinfo for std::exception
0x000148ec 18 typeinfo name for std::bad_exception
0x000167e8 12 typeinfo for std::bad_exception
0x00013f34 32 typeinfo name for __cxxabiv1::__forced_unwind
0x00013f54 36 typeinfo name for __cxxabiv1::__foreign_exception
0x00016ca8 44 vtable for __cxxabiv1::__class_type_info
0x00016c40 44 vtable for __cxxabiv1::__si_class_type_info
0x00009858 16 __aeabi_atexit
0x000099fc 124 __cxa_call_terminate
0x00009494 24 std::unexpected()
0x0000943c 52 __cxxabiv1::__terminate(void (*)())
0x00017020 4 __cxxabiv1::__terminate_handler
0x00009488 12 __cxxabiv1::__unexpected(void (*)())
0x0001701c 4 __cxxabiv1::__unexpected_handler
0x000094ac 28 std::set_terminate(void (*)())
0x000094c8 28 std::set_unexpected(void (*)())
0x000094e4 40 __cxxabiv1::__fundamental_type_info::~__fundamental_type_info()
0x000097bc 24 std::type_info::~type_info()
0x00016be0 32 vtable for __cxxabiv1::__fundamental_type_info
0x000094e4 40 __cxxabiv1::__fundamental_type_info::~__fundamental_type_info()
0x0000950c 28 __cxxabiv1::__fundamental_type_info::~__fundamental_type_info()
0x00014a2c 40 typeinfo name for __cxxabiv1::__fundamental_type_info
0x00016c00 12 typeinfo for __cxxabiv1::__fundamental_type_info
0x00016c18 36 vtable for __cxxabiv1::__pointer_type_info
0x000097d4 8 std::type_info::__is_pointer_p() const
0x000097dc 8 std::type_info::__is_function_p() const
0x00009854 4 std::type_info::__do_catch(std::type_info const*, void**, unsigned int) const
0x000097e4 8 std::type_info::__do_upcast(__cxxabiv1::__class_type_info const*, void**) const
0x00016ca0 8 typeinfo for std::type_info
0x00009528 8 __cxxabiv1::__pointer_type_info::__is_pointer_p() const
0x00009530 40 __cxxabiv1::__pointer_type_info::~__pointer_type_info()
0x00009df0 40 __cxxabiv1::__pbase_type_info::~__pbase_type_info()
0x00009530 40 __cxxabiv1::__pointer_type_info::~__pointer_type_info()
0x00009558 28 __cxxabiv1::__pointer_type_info::~__pointer_type_info()
0x00009574 128 __cxxabiv1::__pointer_type_info::__pointer_catch(__cxxabiv1::__pbase_type_info const*, void**, unsigned int) const
0x00009808 76 std::type_info::operator==(std::type_info const&) const
0x00014a54 36 typeinfo name for __cxxabiv1::__pointer_type_info
0x00016c0c 12 typeinfo for __cxxabiv1::__pointer_type_info
0x00016d10 12 typeinfo for __cxxabiv1::__pbase_type_info
0x00009e34 144 __cxxabiv1::__pbase_type_info::__do_catch(std::type_info const*, void**, unsigned int) const
0x000095f4 40 __cxxabiv1::__si_class_type_info::~__si_class_type_info()
0x000098d8 40 __cxxabiv1::__class_type_info::~__class_type_info()
0x000095f4 40 __cxxabiv1::__si_class_type_info::~__si_class_type_info()
0x0000961c 28 __cxxabiv1::__si_class_type_info::~__si_class_type_info()
0x00009638 100 __cxxabiv1::__si_class_type_info::__do_find_public_src(int, void const*, __cxxabiv1::__class_type_info const*, void const*) const
0x0000969c 224 __cxxabiv1::__si_class_type_info::__do_dyncast(int, __cxxabiv1::__class_type_info::__sub_kind, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__dyncast_result&) const
0x0000977c 64 __cxxabiv1::__si_class_type_info::__do_upcast(__cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__upcast_result&) const
0x0000991c 44 __cxxabiv1::__class_type_info::__do_upcast(__cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__upcast_result&) const
0x00014a78 37 typeinfo name for __cxxabiv1::__si_class_type_info
0x00016c70 12 typeinfo for __cxxabiv1::__si_class_type_info
0x00009948 68 __cxxabiv1::__class_type_info::__do_catch(std::type_info const*, void**, unsigned int) const
0x00009868 92 __cxxabiv1::__class_type_info::__do_upcast(__cxxabiv1::__class_type_info const*, void**) const
0x00016cd8 12 typeinfo for __cxxabiv1::__class_type_info
0x00016c80 32 vtable for std::type_info
0x000097bc 24 std::type_info::~type_info()
0x000097ec 28 std::type_info::~type_info()
0x00014aa0 13 typeinfo name for std::type_info
0x000098c4 20 __cxxabiv1::__class_type_info::__do_find_public_src(int, void const*, __cxxabiv1::__class_type_info const*, void const*) const
0x000098d8 40 __cxxabiv1::__class_type_info::~__class_type_info()
0x00009900 28 __cxxabiv1::__class_type_info::~__class_type_info()
0x0000998c 112 __cxxabiv1::__class_type_info::__do_dyncast(int, __cxxabiv1::__class_type_info::__sub_kind, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__dyncast_result&) const
0x00014ab0 34 typeinfo name for __cxxabiv1::__class_type_info
0x00012810 224 __cxa_allocate_exception
0x00009c64 188 __cxa_throw
0x00009d20 176 __cxa_rethrow
0x00009ec4 436 __gnu_cxx::__verbose_terminate_handler()
0x000128f0 160 __cxa_free_exception
0x00016ce8 36 vtable for __cxxabiv1::__pbase_type_info
0x00009df0 40 __cxxabiv1::__pbase_type_info::~__pbase_type_info()
0x00009e18 28 __cxxabiv1::__pbase_type_info::~__pbase_type_info()
0x00012b54 72 __cxa_bad_typeid
0x00014ad4 34 typeinfo name for __cxxabiv1::__pbase_type_info
0x00012b9c 44 __cxa_current_exception_type
0x00012538 332 __cxa_demangle
0x00012684 44 __gcclibcxx_demangle_callback
0x00012990 212 __cxa_allocate_dependent_exception
0x00012a64 168 __cxa_free_dependent_exception
0x00012b0c 72 __cxa_bad_cast
0x00016d78 20 vtable for std::bad_cast
0x00016d68 12 typeinfo for std::bad_cast
0x00012bd8 40 std::bad_cast::~bad_cast()
0x00016d90 20 vtable for std::bad_typeid
0x00016da8 12 typeinfo for std::bad_typeid
0x00012c2c 40 std::bad_typeid::~bad_typeid()
0x00012bc8 16 std::bad_cast::what() const
0x00012bd8 40 std::bad_cast::~bad_cast()
0x00012c00 28 std::bad_cast::~bad_cast()
0x00014b4c 12 typeinfo name for std::bad_cast
0x00012c1c 16 std::bad_typeid::what() const
0x00012c2c 40 std::bad_typeid::~bad_typeid()
0x00012c54 28 std::bad_typeid::~bad_typeid()
0x00014b58 15 typeinfo name for std::bad_typeid
EOF
CMDS=<<EOF
iaq
EOF
RUN

NAME=iD
FILE=../bins/elf/libmagic.so
EXPECT=<<EOF
Swift.String.init (_builtinStringLiteral(Builtin.RawPointer byteSize__Builtin.Word isASCII__Builtin.Int1 _) -> String
EOF
CMDS=<<EOF
iD swift _TFSSCfT21_builtinStringLiteralBp8byteSizeBw7isASCIIBi1__SS
EOF
RUN

NAME=ie (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
[Entrypoints]
vaddr=0x08048300 paddr=0x00000300 haddr=0x00000018 hvaddr=0x08048018 type=program

1 entrypoints
EOF
CMDS=<<EOF
ie
EOF
RUN

NAME=iej (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT='[{"vaddr":134513408,"paddr":768,"baddr":134512640,"laddr":0,"hvaddr":134512664,"haddr":24,"type":"program"}]
'
CMDS=<<EOF
iej
EOF
RUN

NAME=ii (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
[Imports]
nth vaddr      bind   type   lib name
-------------------------------------
1   0x080482d0 GLOBAL FUNC       puts
2   0x080482e0 WEAK   NOTYPE     __gmon_start__
3   0x080482f0 GLOBAL FUNC       __libc_start_main

EOF
CMDS=<<EOF
ii
EOF
RUN

NAME=iI (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
arch     x86
baddr    0x8048000
binsz    4899
bintype  elf
bits     32
canary   false
class    ELF32
compiler GCC: (GNU) 4.8.2
crypto   false
endian   little
havecode true
intrp    /lib/ld-linux.so.2
laddr    0x0
lang     c
linenum  true
lsyms    true
machine  Intel 80386
maxopsz  16
minopsz  1
nx       true
os       linux
pcalign  0
pic      false
relocs   true
relro    no
rpath    NONE
sanitiz  false
static   false
stripped false
subsys   linux
va       true
EOF
CMDS=<<EOF
iI
EOF
RUN

NAME=iIj
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=iIj~{}
EXPECT='{
  "arch": "x86",
  "baddr": 134512640,
  "binsz": 4899,
  "bintype": "elf",
  "bits": 32,
  "canary": false,
  "class": "ELF32",
  "compiled": "",
  "compiler": "GCC: (GNU) 4.8.2",
  "crypto": false,
  "dbg_file": "",
  "endian": "little",
  "havecode": true,
  "guid": "",
  "intrp": "/lib/ld-linux.so.2",
  "laddr": 0,
  "lang": "c",
  "linenum": true,
  "lsyms": true,
  "machine": "Intel 80386",
  "maxopsz": 16,
  "minopsz": 1,
  "nx": true,
  "os": "linux",
  "pcalign": 0,
  "pic": false,
  "relocs": true,
  "relro": "no",
  "rpath": "NONE",
  "sanitiz": false,
  "static": false,
  "stripped": false,
  "subsys": "linux",
  "va": true,
  "checksums": {
    
  }
}'
RUN

NAME=iI-rust
FILE=../bins/elf/analysis/rust_full
CMDS=iI~lang
EXPECT='lang     rust
'
RUN

NAME=iI-msvc
FILE=../bins/pe/libzmq-v100-mt-4_0_4.dll
CMDS=iI~lang
EXPECT='lang     msvc
'
RUN

NAME=im
FILE=../bins/nes/Pong.nes
EXPECT=<<EOF
1
EOF
CMDS=<<EOF
im~?SRAM
EOF
RUN

NAME=imj
FILE=../bins/nes/Pong.nes
EXPECT=<<EOF
1
EOF
CMDS=<<EOF
imj~?SRAM
EOF
RUN

NAME=imq
FILE=../bins/nes/Pong.nes
EXPECT=<<EOF
[Memory]

0x00000000
0x00001000
0x00001800
0x00002000
0x00002008
0x00002010
0x00002018
0x00002020
0x00002028
0x00002030
0x00002038
0x00002040
0x00002048
0x00002050
0x00002058
0x00002060
0x00002068
0x00002070
0x00002078
0x00002080
0x00002088
0x00002090
0x00002098
0x000020a0
0x000020a8
0x000020b0
0x000020b8
0x000020c0
0x000020c8
0x000020d0
0x000020d8
0x000020e0
0x000020e8
0x000020f0
0x000020f8
0x00002100
0x00002108
0x00002110
0x00002118
0x00002120
0x00002128
0x00002130
0x00002138
0x00002140
0x00002148
0x00002150
0x00002158
0x00002160
0x00002168
0x00002170
0x00002178
0x00002180
0x00002188
0x00002190
0x00002198
0x000021a0
0x000021a8
0x000021b0
0x000021b8
0x000021c0
0x000021c8
0x000021d0
0x000021d8
0x000021e0
0x000021e8
0x000021f0
0x000021f8
0x00002200
0x00002208
0x00002210
0x00002218
0x00002220
0x00002228
0x00002230
0x00002238
0x00002240
0x00002248
0x00002250
0x00002258
0x00002260
0x00002268
0x00002270
0x00002278
0x00002280
0x00002288
0x00002290
0x00002298
0x000022a0
0x000022a8
0x000022b0
0x000022b8
0x000022c0
0x000022c8
0x000022d0
0x000022d8
0x000022e0
0x000022e8
0x000022f0
0x000022f8
0x00002300
0x00002308
0x00002310
0x00002318
0x00002320
0x00002328
0x00002330
0x00002338
0x00002340
0x00002348
0x00002350
0x00002358
0x00002360
0x00002368
0x00002370
0x00002378
0x00002380
0x00002388
0x00002390
0x00002398
0x000023a0
0x000023a8
0x000023b0
0x000023b8
0x000023c0
0x000023c8
0x000023d0
0x000023d8
0x000023e0
0x000023e8
0x000023f0
0x000023f8
0x00002400
0x00002408
0x00002410
0x00002418
0x00002420
0x00002428
0x00002430
0x00002438
0x00002440
0x00002448
0x00002450
0x00002458
0x00002460
0x00002468
0x00002470
0x00002478
0x00002480
0x00002488
0x00002490
0x00002498
0x000024a0
0x000024a8
0x000024b0
0x000024b8
0x000024c0
0x000024c8
0x000024d0
0x000024d8
0x000024e0
0x000024e8
0x000024f0
0x000024f8
0x00002500
0x00002508
0x00002510
0x00002518
0x00002520
0x00002528
0x00002530
0x00002538
0x00002540
0x00002548
0x00002550
0x00002558
0x00002560
0x00002568
0x00002570
0x00002578
0x00002580
0x00002588
0x00002590
0x00002598
0x000025a0
0x000025a8
0x000025b0
0x000025b8
0x000025c0
0x000025c8
0x000025d0
0x000025d8
0x000025e0
0x000025e8
0x000025f0
0x000025f8
0x00002600
0x00002608
0x00002610
0x00002618
0x00002620
0x00002628
0x00002630
0x00002638
0x00002640
0x00002648
0x00002650
0x00002658
0x00002660
0x00002668
0x00002670
0x00002678
0x00002680
0x00002688
0x00002690
0x00002698
0x000026a0
0x000026a8
0x000026b0
0x000026b8
0x000026c0
0x000026c8
0x000026d0
0x000026d8
0x000026e0
0x000026e8
0x000026f0
0x000026f8
0x00002700
0x00002708
0x00002710
0x00002718
0x00002720
0x00002728
0x00002730
0x00002738
0x00002740
0x00002748
0x00002750
0x00002758
0x00002760
0x00002768
0x00002770
0x00002778
0x00002780
0x00002788
0x00002790
0x00002798
0x000027a0
0x000027a8
0x000027b0
0x000027b8
0x000027c0
0x000027c8
0x000027d0
0x000027d8
0x000027e0
0x000027e8
0x000027f0
0x000027f8
0x00002800
0x00002808
0x00002810
0x00002818
0x00002820
0x00002828
0x00002830
0x00002838
0x00002840
0x00002848
0x00002850
0x00002858
0x00002860
0x00002868
0x00002870
0x00002878
0x00002880
0x00002888
0x00002890
0x00002898
0x000028a0
0x000028a8
0x000028b0
0x000028b8
0x000028c0
0x000028c8
0x000028d0
0x000028d8
0x000028e0
0x000028e8
0x000028f0
0x000028f8
0x00002900
0x00002908
0x00002910
0x00002918
0x00002920
0x00002928
0x00002930
0x00002938
0x00002940
0x00002948
0x00002950
0x00002958
0x00002960
0x00002968
0x00002970
0x00002978
0x00002980
0x00002988
0x00002990
0x00002998
0x000029a0
0x000029a8
0x000029b0
0x000029b8
0x000029c0
0x000029c8
0x000029d0
0x000029d8
0x000029e0
0x000029e8
0x000029f0
0x000029f8
0x00002a00
0x00002a08
0x00002a10
0x00002a18
0x00002a20
0x00002a28
0x00002a30
0x00002a38
0x00002a40
0x00002a48
0x00002a50
0x00002a58
0x00002a60
0x00002a68
0x00002a70
0x00002a78
0x00002a80
0x00002a88
0x00002a90
0x00002a98
0x00002aa0
0x00002aa8
0x00002ab0
0x00002ab8
0x00002ac0
0x00002ac8
0x00002ad0
0x00002ad8
0x00002ae0
0x00002ae8
0x00002af0
0x00002af8
0x00002b00
0x00002b08
0x00002b10
0x00002b18
0x00002b20
0x00002b28
0x00002b30
0x00002b38
0x00002b40
0x00002b48
0x00002b50
0x00002b58
0x00002b60
0x00002b68
0x00002b70
0x00002b78
0x00002b80
0x00002b88
0x00002b90
0x00002b98
0x00002ba0
0x00002ba8
0x00002bb0
0x00002bb8
0x00002bc0
0x00002bc8
0x00002bd0
0x00002bd8
0x00002be0
0x00002be8
0x00002bf0
0x00002bf8
0x00002c00
0x00002c08
0x00002c10
0x00002c18
0x00002c20
0x00002c28
0x00002c30
0x00002c38
0x00002c40
0x00002c48
0x00002c50
0x00002c58
0x00002c60
0x00002c68
0x00002c70
0x00002c78
0x00002c80
0x00002c88
0x00002c90
0x00002c98
0x00002ca0
0x00002ca8
0x00002cb0
0x00002cb8
0x00002cc0
0x00002cc8
0x00002cd0
0x00002cd8
0x00002ce0
0x00002ce8
0x00002cf0
0x00002cf8
0x00002d00
0x00002d08
0x00002d10
0x00002d18
0x00002d20
0x00002d28
0x00002d30
0x00002d38
0x00002d40
0x00002d48
0x00002d50
0x00002d58
0x00002d60
0x00002d68
0x00002d70
0x00002d78
0x00002d80
0x00002d88
0x00002d90
0x00002d98
0x00002da0
0x00002da8
0x00002db0
0x00002db8
0x00002dc0
0x00002dc8
0x00002dd0
0x00002dd8
0x00002de0
0x00002de8
0x00002df0
0x00002df8
0x00002e00
0x00002e08
0x00002e10
0x00002e18
0x00002e20
0x00002e28
0x00002e30
0x00002e38
0x00002e40
0x00002e48
0x00002e50
0x00002e58
0x00002e60
0x00002e68
0x00002e70
0x00002e78
0x00002e80
0x00002e88
0x00002e90
0x00002e98
0x00002ea0
0x00002ea8
0x00002eb0
0x00002eb8
0x00002ec0
0x00002ec8
0x00002ed0
0x00002ed8
0x00002ee0
0x00002ee8
0x00002ef0
0x00002ef8
0x00002f00
0x00002f08
0x00002f10
0x00002f18
0x00002f20
0x00002f28
0x00002f30
0x00002f38
0x00002f40
0x00002f48
0x00002f50
0x00002f58
0x00002f60
0x00002f68
0x00002f70
0x00002f78
0x00002f80
0x00002f88
0x00002f90
0x00002f98
0x00002fa0
0x00002fa8
0x00002fb0
0x00002fb8
0x00002fc0
0x00002fc8
0x00002fd0
0x00002fd8
0x00002fe0
0x00002fe8
0x00002ff0
0x00002ff8
0x00003000
0x00003008
0x00003010
0x00003018
0x00003020
0x00003028
0x00003030
0x00003038
0x00003040
0x00003048
0x00003050
0x00003058
0x00003060
0x00003068
0x00003070
0x00003078
0x00003080
0x00003088
0x00003090
0x00003098
0x000030a0
0x000030a8
0x000030b0
0x000030b8
0x000030c0
0x000030c8
0x000030d0
0x000030d8
0x000030e0
0x000030e8
0x000030f0
0x000030f8
0x00003100
0x00003108
0x00003110
0x00003118
0x00003120
0x00003128
0x00003130
0x00003138
0x00003140
0x00003148
0x00003150
0x00003158
0x00003160
0x00003168
0x00003170
0x00003178
0x00003180
0x00003188
0x00003190
0x00003198
0x000031a0
0x000031a8
0x000031b0
0x000031b8
0x000031c0
0x000031c8
0x000031d0
0x000031d8
0x000031e0
0x000031e8
0x000031f0
0x000031f8
0x00003200
0x00003208
0x00003210
0x00003218
0x00003220
0x00003228
0x00003230
0x00003238
0x00003240
0x00003248
0x00003250
0x00003258
0x00003260
0x00003268
0x00003270
0x00003278
0x00003280
0x00003288
0x00003290
0x00003298
0x000032a0
0x000032a8
0x000032b0
0x000032b8
0x000032c0
0x000032c8
0x000032d0
0x000032d8
0x000032e0
0x000032e8
0x000032f0
0x000032f8
0x00003300
0x00003308
0x00003310
0x00003318
0x00003320
0x00003328
0x00003330
0x00003338
0x00003340
0x00003348
0x00003350
0x00003358
0x00003360
0x00003368
0x00003370
0x00003378
0x00003380
0x00003388
0x00003390
0x00003398
0x000033a0
0x000033a8
0x000033b0
0x000033b8
0x000033c0
0x000033c8
0x000033d0
0x000033d8
0x000033e0
0x000033e8
0x000033f0
0x000033f8
0x00003400
0x00003408
0x00003410
0x00003418
0x00003420
0x00003428
0x00003430
0x00003438
0x00003440
0x00003448
0x00003450
0x00003458
0x00003460
0x00003468
0x00003470
0x00003478
0x00003480
0x00003488
0x00003490
0x00003498
0x000034a0
0x000034a8
0x000034b0
0x000034b8
0x000034c0
0x000034c8
0x000034d0
0x000034d8
0x000034e0
0x000034e8
0x000034f0
0x000034f8
0x00003500
0x00003508
0x00003510
0x00003518
0x00003520
0x00003528
0x00003530
0x00003538
0x00003540
0x00003548
0x00003550
0x00003558
0x00003560
0x00003568
0x00003570
0x00003578
0x00003580
0x00003588
0x00003590
0x00003598
0x000035a0
0x000035a8
0x000035b0
0x000035b8
0x000035c0
0x000035c8
0x000035d0
0x000035d8
0x000035e0
0x000035e8
0x000035f0
0x000035f8
0x00003600
0x00003608
0x00003610
0x00003618
0x00003620
0x00003628
0x00003630
0x00003638
0x00003640
0x00003648
0x00003650
0x00003658
0x00003660
0x00003668
0x00003670
0x00003678
0x00003680
0x00003688
0x00003690
0x00003698
0x000036a0
0x000036a8
0x000036b0
0x000036b8
0x000036c0
0x000036c8
0x000036d0
0x000036d8
0x000036e0
0x000036e8
0x000036f0
0x000036f8
0x00003700
0x00003708
0x00003710
0x00003718
0x00003720
0x00003728
0x00003730
0x00003738
0x00003740
0x00003748
0x00003750
0x00003758
0x00003760
0x00003768
0x00003770
0x00003778
0x00003780
0x00003788
0x00003790
0x00003798
0x000037a0
0x000037a8
0x000037b0
0x000037b8
0x000037c0
0x000037c8
0x000037d0
0x000037d8
0x000037e0
0x000037e8
0x000037f0
0x000037f8
0x00003800
0x00003808
0x00003810
0x00003818
0x00003820
0x00003828
0x00003830
0x00003838
0x00003840
0x00003848
0x00003850
0x00003858
0x00003860
0x00003868
0x00003870
0x00003878
0x00003880
0x00003888
0x00003890
0x00003898
0x000038a0
0x000038a8
0x000038b0
0x000038b8
0x000038c0
0x000038c8
0x000038d0
0x000038d8
0x000038e0
0x000038e8
0x000038f0
0x000038f8
0x00003900
0x00003908
0x00003910
0x00003918
0x00003920
0x00003928
0x00003930
0x00003938
0x00003940
0x00003948
0x00003950
0x00003958
0x00003960
0x00003968
0x00003970
0x00003978
0x00003980
0x00003988
0x00003990
0x00003998
0x000039a0
0x000039a8
0x000039b0
0x000039b8
0x000039c0
0x000039c8
0x000039d0
0x000039d8
0x000039e0
0x000039e8
0x000039f0
0x000039f8
0x00003a00
0x00003a08
0x00003a10
0x00003a18
0x00003a20
0x00003a28
0x00003a30
0x00003a38
0x00003a40
0x00003a48
0x00003a50
0x00003a58
0x00003a60
0x00003a68
0x00003a70
0x00003a78
0x00003a80
0x00003a88
0x00003a90
0x00003a98
0x00003aa0
0x00003aa8
0x00003ab0
0x00003ab8
0x00003ac0
0x00003ac8
0x00003ad0
0x00003ad8
0x00003ae0
0x00003ae8
0x00003af0
0x00003af8
0x00003b00
0x00003b08
0x00003b10
0x00003b18
0x00003b20
0x00003b28
0x00003b30
0x00003b38
0x00003b40
0x00003b48
0x00003b50
0x00003b58
0x00003b60
0x00003b68
0x00003b70
0x00003b78
0x00003b80
0x00003b88
0x00003b90
0x00003b98
0x00003ba0
0x00003ba8
0x00003bb0
0x00003bb8
0x00003bc0
0x00003bc8
0x00003bd0
0x00003bd8
0x00003be0
0x00003be8
0x00003bf0
0x00003bf8
0x00003c00
0x00003c08
0x00003c10
0x00003c18
0x00003c20
0x00003c28
0x00003c30
0x00003c38
0x00003c40
0x00003c48
0x00003c50
0x00003c58
0x00003c60
0x00003c68
0x00003c70
0x00003c78
0x00003c80
0x00003c88
0x00003c90
0x00003c98
0x00003ca0
0x00003ca8
0x00003cb0
0x00003cb8
0x00003cc0
0x00003cc8
0x00003cd0
0x00003cd8
0x00003ce0
0x00003ce8
0x00003cf0
0x00003cf8
0x00003d00
0x00003d08
0x00003d10
0x00003d18
0x00003d20
0x00003d28
0x00003d30
0x00003d38
0x00003d40
0x00003d48
0x00003d50
0x00003d58
0x00003d60
0x00003d68
0x00003d70
0x00003d78
0x00003d80
0x00003d88
0x00003d90
0x00003d98
0x00003da0
0x00003da8
0x00003db0
0x00003db8
0x00003dc0
0x00003dc8
0x00003dd0
0x00003dd8
0x00003de0
0x00003de8
0x00003df0
0x00003df8
0x00003e00
0x00003e08
0x00003e10
0x00003e18
0x00003e20
0x00003e28
0x00003e30
0x00003e38
0x00003e40
0x00003e48
0x00003e50
0x00003e58
0x00003e60
0x00003e68
0x00003e70
0x00003e78
0x00003e80
0x00003e88
0x00003e90
0x00003e98
0x00003ea0
0x00003ea8
0x00003eb0
0x00003eb8
0x00003ec0
0x00003ec8
0x00003ed0
0x00003ed8
0x00003ee0
0x00003ee8
0x00003ef0
0x00003ef8
0x00003f00
0x00003f08
0x00003f10
0x00003f18
0x00003f20
0x00003f28
0x00003f30
0x00003f38
0x00003f40
0x00003f48
0x00003f50
0x00003f58
0x00003f60
0x00003f68
0x00003f70
0x00003f78
0x00003f80
0x00003f88
0x00003f90
0x00003f98
0x00003fa0
0x00003fa8
0x00003fb0
0x00003fb8
0x00003fc0
0x00003fc8
0x00003fd0
0x00003fd8
0x00003fe0
0x00003fe8
0x00003ff0
0x00003ff8
0x00004000
0x00006000
EOF
CMDS=<<EOF
imq
EOF
RUN

NAME=iS (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
[Sections]

nth paddr        size vaddr       vsize perm name
-------------------------------------------------
0   0x00000000    0x0 0x00000000    0x0 ---- 
1   0x00000134   0x13 0x08048134   0x13 -r-- .interp
2   0x00000148   0x20 0x08048148   0x20 -r-- .note.ABI_tag
3   0x00000168   0x24 0x08048168   0x24 -r-- .note.gnu.build_id
4   0x0000018c   0x20 0x0804818c   0x20 -r-- .gnu.hash
5   0x000001ac   0x50 0x080481ac   0x50 -r-- .dynsym
6   0x000001fc   0x4a 0x080481fc   0x4a -r-- .dynstr
7   0x00000246    0xa 0x08048246    0xa -r-- .gnu.version
8   0x00000250   0x20 0x08048250   0x20 -r-- .gnu.version_r
9   0x00000270    0x8 0x08048270    0x8 -r-- .rel.dyn
10  0x00000278   0x18 0x08048278   0x18 -r-- .rel.plt
11  0x00000290   0x23 0x08048290   0x23 -r-x .init
12  0x000002c0   0x40 0x080482c0   0x40 -r-x .plt
13  0x00000300  0x194 0x08048300  0x194 -r-x .text
14  0x00000494   0x14 0x08048494   0x14 -r-x .fini
15  0x000004a8   0x15 0x080484a8   0x15 -r-- .rodata
16  0x000004c0   0x2c 0x080484c0   0x2c -r-- .eh_frame_hdr
17  0x000004ec   0xb0 0x080484ec   0xb0 -r-- .eh_frame
18  0x0000059c    0x4 0x0804959c    0x4 -rw- .init_array
19  0x000005a0    0x4 0x080495a0    0x4 -rw- .fini_array
20  0x000005a4    0x4 0x080495a4    0x4 -rw- .jcr
21  0x000005a8   0xe8 0x080495a8   0xe8 -rw- .dynamic
22  0x00000690    0x4 0x08049690    0x4 -rw- .got
23  0x00000694   0x18 0x08049694   0x18 -rw- .got.plt
24  0x000006ac    0x8 0x080496ac    0x8 -rw- .data
25  0x000006b4    0x0 0x080496b4    0x4 -rw- .bss
26  0x000006b4   0x11 0x00000000   0x11 ---- .comment
27  0x000006c5  0x106 0x00000000  0x106 ---- .shstrtab
28  0x00000c7c  0x450 0x00000000  0x450 ---- .symtab
29  0x000010cc  0x257 0x00000000  0x257 ---- .strtab

EOF
CMDS=<<EOF
iS
EOF
RUN

NAME=iSS (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=<<EOF
iSS
EOF
EXPECT=<<EOF
[Segments]

nth paddr        size vaddr       vsize perm name
-------------------------------------------------
0   0x00000034  0x100 0x08048034  0x100 -r-x PHDR
1   0x00000134   0x13 0x08048134   0x13 -r-- INTERP
2   0x00000000  0x59c 0x08048000  0x59c -r-x LOAD0
3   0x0000059c  0x118 0x0804959c  0x11c -rw- LOAD1
4   0x000005a8   0xe8 0x080495a8   0xe8 -rw- DYNAMIC
5   0x00000148   0x44 0x08048148   0x44 -r-- NOTE
6   0x000004c0   0x2c 0x080484c0   0x2c -r-- GNU_EH_FRAME
7   0x00000000    0x0 0x00000000    0x0 -rw- GNU_STACK
8   0x00000000   0x34 0x08048000   0x34 -rw- ehdr

EOF
RUN

NAME=iSj
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=<<EOF
iSj
EOF
EXPECT=<<EOF
[{"name":"","size":0,"vsize":0,"perm":"----","paddr":0,"vaddr":0},{"name":".interp","size":19,"vsize":19,"perm":"-r--","paddr":308,"vaddr":134512948},{"name":".note.ABI_tag","size":32,"vsize":32,"perm":"-r--","paddr":328,"vaddr":134512968},{"name":".note.gnu.build_id","size":36,"vsize":36,"perm":"-r--","paddr":360,"vaddr":134513000},{"name":".gnu.hash","size":32,"vsize":32,"perm":"-r--","paddr":396,"vaddr":134513036},{"name":".dynsym","size":80,"vsize":80,"perm":"-r--","paddr":428,"vaddr":134513068},{"name":".dynstr","size":74,"vsize":74,"perm":"-r--","paddr":508,"vaddr":134513148},{"name":".gnu.version","size":10,"vsize":10,"perm":"-r--","paddr":582,"vaddr":134513222},{"name":".gnu.version_r","size":32,"vsize":32,"perm":"-r--","paddr":592,"vaddr":134513232},{"name":".rel.dyn","size":8,"vsize":8,"perm":"-r--","paddr":624,"vaddr":134513264},{"name":".rel.plt","size":24,"vsize":24,"perm":"-r--","paddr":632,"vaddr":134513272},{"name":".init","size":35,"vsize":35,"perm":"-r-x","paddr":656,"vaddr":134513296},{"name":".plt","size":64,"vsize":64,"perm":"-r-x","paddr":704,"vaddr":134513344},{"name":".text","size":404,"vsize":404,"perm":"-r-x","paddr":768,"vaddr":134513408},{"name":".fini","size":20,"vsize":20,"perm":"-r-x","paddr":1172,"vaddr":134513812},{"name":".rodata","size":21,"vsize":21,"perm":"-r--","paddr":1192,"vaddr":134513832},{"name":".eh_frame_hdr","size":44,"vsize":44,"perm":"-r--","paddr":1216,"vaddr":134513856},{"name":".eh_frame","size":176,"vsize":176,"perm":"-r--","paddr":1260,"vaddr":134513900},{"name":".init_array","size":4,"vsize":4,"perm":"-rw-","paddr":1436,"vaddr":134518172},{"name":".fini_array","size":4,"vsize":4,"perm":"-rw-","paddr":1440,"vaddr":134518176},{"name":".jcr","size":4,"vsize":4,"perm":"-rw-","paddr":1444,"vaddr":134518180},{"name":".dynamic","size":232,"vsize":232,"perm":"-rw-","paddr":1448,"vaddr":134518184},{"name":".got","size":4,"vsize":4,"perm":"-rw-","paddr":1680,"vaddr":134518416},{"name":".got.plt","size":24,"vsize":24,"perm":"-rw-","paddr":1684,"vaddr":134518420},{"name":".data","size":8,"vsize":8,"perm":"-rw-","paddr":1708,"vaddr":134518444},{"name":".bss","size":0,"vsize":4,"perm":"-rw-","paddr":1716,"vaddr":134518452},{"name":".comment","size":17,"vsize":17,"perm":"----","paddr":1716,"vaddr":0},{"name":".shstrtab","size":262,"vsize":262,"perm":"----","paddr":1733,"vaddr":0},{"name":".symtab","size":1104,"vsize":1104,"perm":"----","paddr":3196,"vaddr":0},{"name":".strtab","size":599,"vsize":599,"perm":"----","paddr":4300,"vaddr":0}]
EOF
RUN

NAME=iSSj
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=<<EOF
iSSj
EOF
EXPECT=<<EOF
[{"name":"PHDR","size":256,"vsize":256,"perm":"-r-x","paddr":52,"vaddr":134512692},{"name":"INTERP","size":19,"vsize":19,"perm":"-r--","paddr":308,"vaddr":134512948},{"name":"LOAD0","size":1436,"vsize":1436,"perm":"-r-x","paddr":0,"vaddr":134512640},{"name":"LOAD1","size":280,"vsize":284,"perm":"-rw-","paddr":1436,"vaddr":134518172},{"name":"DYNAMIC","size":232,"vsize":232,"perm":"-rw-","paddr":1448,"vaddr":134518184},{"name":"NOTE","size":68,"vsize":68,"perm":"-r--","paddr":328,"vaddr":134512968},{"name":"GNU_EH_FRAME","size":44,"vsize":44,"perm":"-r--","paddr":1216,"vaddr":134513856},{"name":"GNU_STACK","size":0,"vsize":0,"perm":"-rw-","paddr":0,"vaddr":0},{"name":"ehdr","size":52,"vsize":52,"perm":"-rw-","paddr":0,"vaddr":134512640}]
EOF
RUN

NAME=iSq
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=iSq
EXPECT=<<EOF
0x0 0x0 ---- 
0x8048134 0x8048147 -r-- .interp
0x8048148 0x8048168 -r-- .note.ABI_tag
0x8048168 0x804818c -r-- .note.gnu.build_id
0x804818c 0x80481ac -r-- .gnu.hash
0x80481ac 0x80481fc -r-- .dynsym
0x80481fc 0x8048246 -r-- .dynstr
0x8048246 0x8048250 -r-- .gnu.version
0x8048250 0x8048270 -r-- .gnu.version_r
0x8048270 0x8048278 -r-- .rel.dyn
0x8048278 0x8048290 -r-- .rel.plt
0x8048290 0x80482b3 -r-x .init
0x80482c0 0x8048300 -r-x .plt
0x8048300 0x8048494 -r-x .text
0x8048494 0x80484a8 -r-x .fini
0x80484a8 0x80484bd -r-- .rodata
0x80484c0 0x80484ec -r-- .eh_frame_hdr
0x80484ec 0x804859c -r-- .eh_frame
0x804959c 0x80495a0 -rw- .init_array
0x80495a0 0x80495a4 -rw- .fini_array
0x80495a4 0x80495a8 -rw- .jcr
0x80495a8 0x8049690 -rw- .dynamic
0x8049690 0x8049694 -rw- .got
0x8049694 0x80496ac -rw- .got.plt
0x80496ac 0x80496b4 -rw- .data
0x80496b4 0x80496b4 -rw- .bss
0x0 0x11 ---- .comment
0x0 0x106 ---- .shstrtab
0x0 0x450 ---- .symtab
0x0 0x257 ---- .strtab
EOF
RUN

NAME=iSSq
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=iSSq
EXPECT=<<EOF
0x8048034 0x8048134 -r-x PHDR
0x8048134 0x8048147 -r-- INTERP
0x8048000 0x804859c -r-x LOAD0
0x804959c 0x80496b4 -rw- LOAD1
0x80495a8 0x8049690 -rw- DYNAMIC
0x8048148 0x804818c -r-- NOTE
0x80484c0 0x80484ec -r-- GNU_EH_FRAME
0x0 0x0 -rw- GNU_STACK
0x8048000 0x8048034 -rw- ehdr
EOF
RUN

NAME=section comment
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=<<EOF
e asm.bytes = false
pd 1 @ 0x080495a8
EOF
EXPECT=<<EOF
            ;-- section..dynamic:
            ;-- segment.DYNAMIC:
            ;-- .dynamic:
            ;-- _DYNAMIC:
            0x080495a8      add dword [eax], eax                       ; [21] -rw- section size 232 named .dynamic
EOF
RUN

NAME=bss section comment
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=<<EOF
pd 3 @ section..bss
EOF
EXPECT=<<EOF
            ;-- section..bss:
            ;-- .bss:
            ;-- completed.5979:
            ;-- _edata:
            ;-- __bss_start:
            ;-- __TMC_END__:
            0x080496b4      0000           add byte [eax], al          ; [25] -rw- section size 4 named .bss
            0x080496b6      0000           add byte [eax], al
            ;-- _end:
            0x080496b8      ff             invalid
EOF
RUN

NAME=il (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
[Linked libraries]
libc.so.6

1 library
EOF
CMDS=<<EOF
il
EOF
RUN

NAME=il* (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
"CCa entry0 libc.so.6"
EOF
CMDS=<<EOF
il*
EOF
RUN

NAME=ir (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
[Relocations]

vaddr      paddr      type   name
---------------------------------
0x08049690 0x00000690 SET_32 __gmon_start__
0x080496a0 0x000006a0 SET_32 puts
0x080496a4 0x000006a4 SET_32 __gmon_start__
0x080496a8 0x000006a8 SET_32 __libc_start_main


4 relocations
EOF
CMDS=<<EOF
ir
EOF
RUN

NAME=ir* (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
fs relocs
"f reloc.__gmon_start__ 4 0x08049690"
Cd 4 @ 0x08049690
"f reloc.puts 4 0x080496a0"
Cd 4 @ 0x080496a0
"f reloc.__gmon_start__ 4 0x080496a4"
Cd 4 @ 0x080496a4
"f reloc.__libc_start_main 4 0x080496a8"
Cd 4 @ 0x080496a8
EOF
CMDS=<<EOF
ir*
EOF
RUN

NAME=irq (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
0x08049690  __gmon_start__
0x080496a0  puts
0x080496a4  __gmon_start__
0x080496a8  __libc_start_main
EOF
CMDS=<<EOF
irq
EOF
RUN

NAME=is (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
[Symbols]

nth paddr       vaddr      bind   type   size lib name
------------------------------------------------------
4    0x000004ac 0x080484ac GLOBAL OBJ    4        _IO_stdin_used
1    0x00000134 0x08048134 LOCAL  SECT   0        .interp
2    0x00000148 0x08048148 LOCAL  SECT   0        .note.ABI-tag
3    0x00000168 0x08048168 LOCAL  SECT   0        .note.gnu.build-id
4    0x0000018c 0x0804818c LOCAL  SECT   0        .gnu.hash
5    0x000001ac 0x080481ac LOCAL  SECT   0        .dynsym
6    0x000001fc 0x080481fc LOCAL  SECT   0        .dynstr
7    0x00000246 0x08048246 LOCAL  SECT   0        .gnu.version
8    0x00000250 0x08048250 LOCAL  SECT   0        .gnu.version_r
9    0x00000270 0x08048270 LOCAL  SECT   0        .rel.dyn
10   0x00000278 0x08048278 LOCAL  SECT   0        .rel.plt
11   0x00000290 0x08048290 LOCAL  SECT   0        .init
12   0x000002c0 0x080482c0 LOCAL  SECT   0        .plt
13   0x00000300 0x08048300 LOCAL  SECT   0        .text
14   0x00000494 0x08048494 LOCAL  SECT   0        .fini
15   0x000004a8 0x080484a8 LOCAL  SECT   0        .rodata
16   0x000004c0 0x080484c0 LOCAL  SECT   0        .eh_frame_hdr
17   0x000004ec 0x080484ec LOCAL  SECT   0        .eh_frame
18   0x0000059c 0x0804959c LOCAL  SECT   0        .init_array
19   0x000005a0 0x080495a0 LOCAL  SECT   0        .fini_array
20   0x000005a4 0x080495a4 LOCAL  SECT   0        .jcr
21   0x000005a8 0x080495a8 LOCAL  SECT   0        .dynamic
22   0x00000690 0x08049690 LOCAL  SECT   0        .got
23   0x00000694 0x08049694 LOCAL  SECT   0        .got.plt
24   0x000006ac 0x080496ac LOCAL  SECT   0        .data
25   ---------- 0x080496b4 LOCAL  SECT   0        .bss
26   ---------- 0x00000000 LOCAL  SECT   0        .comment
27   ---------- 0x00000000 LOCAL  FILE   0        init.c
28   ---------- 0x00000000 LOCAL  FILE   0        
29   ---------- 0x00000000 LOCAL  FILE   0        crtstuff.c
30   0x000005a4 0x080495a4 LOCAL  OBJ    0        __JCR_LIST__
31   0x00000340 0x08048340 LOCAL  FUNC   0        deregister_tm_clones
32   0x00000370 0x08048370 LOCAL  FUNC   0        register_tm_clones
33   0x000003b0 0x080483b0 LOCAL  FUNC   0        __do_global_dtors_aux
34   ---------- 0x080496b4 LOCAL  OBJ    1        completed.5979
35   0x000005a0 0x080495a0 LOCAL  OBJ    0        __do_global_dtors_aux_fini_array_entry
36   0x000003d0 0x080483d0 LOCAL  FUNC   0        frame_dummy
37   0x0000059c 0x0804959c LOCAL  OBJ    0        __frame_dummy_init_array_entry
38   ---------- 0x00000000 LOCAL  FILE   0        hello.c
39   ---------- 0x00000000 LOCAL  FILE   0        crtstuff.c
40   0x00000598 0x08048598 LOCAL  OBJ    0        __FRAME_END__
41   0x000005a4 0x080495a4 LOCAL  OBJ    0        __JCR_END__
42   ---------- 0x00000000 LOCAL  FILE   0        
43   0x000005a0 0x080495a0 LOCAL  NOTYPE 0        __init_array_end
44   0x000005a8 0x080495a8 LOCAL  OBJ    0        _DYNAMIC
45   0x0000059c 0x0804959c LOCAL  NOTYPE 0        __init_array_start
46   0x00000694 0x08049694 LOCAL  OBJ    0        _GLOBAL_OFFSET_TABLE_
47   0x00000490 0x08048490 GLOBAL FUNC   2        __libc_csu_fini
49   0x00000330 0x08048330 GLOBAL FUNC   4        __x86.get_pc_thunk.bx
50   0x000006ac 0x080496ac WEAK   NOTYPE 0        data_start
51   ---------- 0x080496b4 GLOBAL NOTYPE 0        _edata
52   0x00000494 0x08048494 GLOBAL FUNC   0        _fini
53   0x000006ac 0x080496ac GLOBAL NOTYPE 0        __data_start
56   0x000006b0 0x080496b0 GLOBAL OBJ    0        __dso_handle
59   0x00000420 0x08048420 GLOBAL FUNC   97       __libc_csu_init
60   ---------- 0x080496b8 GLOBAL NOTYPE 0        _end
61   0x00000300 0x08048300 GLOBAL FUNC   0        _start
62   0x000004a8 0x080484a8 GLOBAL OBJ    4        _fp_hw
63   ---------- 0x080496b4 GLOBAL NOTYPE 0        __bss_start
64   0x00000400 0x08048400 GLOBAL FUNC   28       main
66   ---------- 0x080496b4 GLOBAL OBJ    0        __TMC_END__
68   0x00000290 0x08048290 GLOBAL FUNC   0        _init
1    0x000002d0 0x080482d0 GLOBAL FUNC   16       imp.puts
2    0x000002e0 0x080482e0 WEAK   NOTYPE 16       imp.__gmon_start__
3    0x000002f0 0x080482f0 GLOBAL FUNC   16       imp.__libc_start_main
EOF
CMDS=<<EOF
is
EOF
RUN

NAME=iz (file x86)
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
[Strings]
nth paddr      vaddr      len size section type  string
-------------------------------------------------------
0   0x000004b0 0x080484b0 12  13   .rodata ascii Hello world!
EOF
CMDS=<<EOF
iz
EOF
RUN

NAME=i (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
fd       3
size     0x1a36
humansz  6.6K
mode     r-x
format   elf64
iorw     false
blksz    0x0
block    0x100
type     EXEC (Executable file)
arch     x86
baddr    0x400000
binsz    6710
bintype  elf
bits     64
canary   false
class    ELF64
compiler GCC: (GNU) 4.7.2
crypto   false
endian   little
havecode true
intrp    /lib/ld-linux-x86-64.so.2
laddr    0x0
lang     c
linenum  true
lsyms    true
machine  AMD x86-64 architecture
maxopsz  16
minopsz  1
nx       true
os       linux
pcalign  0
pic      false
relocs   true
relro    no
rpath    NONE
sanitiz  false
static   false
stripped false
subsys   linux
va       true
EOF
CMDS=<<EOF
i~!hello-linux
EOF
RUN

NAME=iA (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
0   0x00000000 6710 x86_64 

EOF
CMDS=<<EOF
iA
EOF
RUN

NAME=ie (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
[Entrypoints]
vaddr=0x00400410 paddr=0x00000410 haddr=0x00000018 hvaddr=0x00400018 type=program

1 entrypoints
EOF
CMDS=<<EOF
ie
EOF
RUN

NAME=iH (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
0x00000000  ELF64       0x464c457f
0x00000010  Type        0x0002
0x00000012  Machine     0x003e
0x00000014  Version     0x00000001
0x00000018  Entrypoint  0x00400410
0x00000020  PhOff       0x00000040
0x00000028  ShOff       0x00000a30
EOF
CMDS=<<EOF
iH
EOF
RUN

NAME=ii (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
[Imports]
nth vaddr      bind   type   lib name
-------------------------------------
1   0x004003e0 GLOBAL FUNC       puts
2   0x004003f0 GLOBAL FUNC       __libc_start_main
3   0x00400400 WEAK   NOTYPE     __gmon_start__

EOF
CMDS=<<EOF
ii
EOF
RUN

NAME=iI (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
arch     x86
baddr    0x400000
binsz    6710
bintype  elf
bits     64
canary   false
class    ELF64
compiler GCC: (GNU) 4.7.2
crypto   false
endian   little
havecode true
intrp    /lib/ld-linux-x86-64.so.2
laddr    0x0
lang     c
linenum  true
lsyms    true
machine  AMD x86-64 architecture
maxopsz  16
minopsz  1
nx       true
os       linux
pcalign  0
pic      false
relocs   true
relro    no
rpath    NONE
sanitiz  false
static   false
stripped false
subsys   linux
va       true
EOF
CMDS=<<EOF
iI
EOF
RUN

NAME=iS (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
[Sections]

nth paddr        size vaddr       vsize perm name
-------------------------------------------------
0   0x00000000    0x0 0x00000000    0x0 ---- 
1   0x00000200   0x1a 0x00400200   0x1a -r-- .interp
2   0x0000021c   0x20 0x0040021c   0x20 -r-- .note.ABI_tag
3   0x0000023c   0x24 0x0040023c   0x24 -r-- .note.gnu.build_id
4   0x00000260   0x1c 0x00400260   0x1c -r-- .gnu.hash
5   0x00000280   0x60 0x00400280   0x60 -r-- .dynsym
6   0x000002e0   0x3d 0x004002e0   0x3d -r-- .dynstr
7   0x0000031e    0x8 0x0040031e    0x8 -r-- .gnu.version
8   0x00000328   0x20 0x00400328   0x20 -r-- .gnu.version_r
9   0x00000348   0x18 0x00400348   0x18 -r-- .rela.dyn
10  0x00000360   0x48 0x00400360   0x48 -r-- .rela.plt
11  0x000003a8   0x1a 0x004003a8   0x1a -r-x .init
12  0x000003d0   0x40 0x004003d0   0x40 -r-x .plt
13  0x00000410  0x1a4 0x00400410  0x1a4 -r-x .text
14  0x000005b4    0x9 0x004005b4    0x9 -r-x .fini
15  0x000005c0   0x10 0x004005c0   0x10 -r-- .rodata
16  0x000005d0   0x34 0x004005d0   0x34 -r-- .eh_frame_hdr
17  0x00000608   0xd4 0x00400608   0xd4 -r-- .eh_frame
18  0x000006e0    0x8 0x006006e0    0x8 -rw- .init_array
19  0x000006e8    0x8 0x006006e8    0x8 -rw- .fini_array
20  0x000006f0    0x8 0x006006f0    0x8 -rw- .jcr
21  0x000006f8  0x1d0 0x006006f8  0x1d0 -rw- .dynamic
22  0x000008c8    0x8 0x006008c8    0x8 -rw- .got
23  0x000008d0   0x30 0x006008d0   0x30 -rw- .got.plt
24  0x00000900   0x10 0x00600900   0x10 -rw- .data
25  0x00000910    0x0 0x00600910    0x8 -rw- .bss
26  0x00000910   0x11 0x00000000   0x11 ---- .comment
27  0x00000921  0x108 0x00000000  0x108 ---- .shstrtab
28  0x000011b0  0x648 0x00000000  0x648 ---- .symtab
29  0x000017f8  0x23e 0x00000000  0x23e ---- .strtab

EOF
CMDS=<<EOF
iS
EOF
RUN

NAME=iSS (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
CMDS=<<EOF
iSS
EOF
EXPECT=<<EOF
[Segments]

nth paddr        size vaddr       vsize perm name
-------------------------------------------------
0   0x00000040  0x1c0 0x00400040  0x1c0 -r-x PHDR
1   0x00000200   0x1a 0x00400200   0x1a -r-- INTERP
2   0x00000000  0x6dc 0x00400000  0x6dc -r-x LOAD0
3   0x000006e0  0x230 0x006006e0  0x238 -rw- LOAD1
4   0x000006f8  0x1d0 0x006006f8  0x1d0 -rw- DYNAMIC
5   0x0000021c   0x44 0x0040021c   0x44 -r-- NOTE
6   0x000005d0   0x34 0x004005d0   0x34 -r-- GNU_EH_FRAME
7   0x00000000    0x0 0x00000000    0x0 -rw- GNU_STACK
8   0x00000000   0x40 0x00400000   0x40 -rw- ehdr

EOF
RUN

NAME=il (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
[Linked libraries]
libc.so.6

1 library
EOF
CMDS=<<EOF
il
EOF
RUN

NAME=ir (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
[Relocations]

vaddr      paddr      type   name
---------------------------------
0x006008c8 0x000008c8 SET_64 __gmon_start__
0x006008e8 0x000008e8 SET_64 puts
0x006008f0 0x000008f0 SET_64 __libc_start_main
0x006008f8 0x000008f8 SET_64 __gmon_start__


4 relocations
EOF
CMDS=<<EOF
ir
EOF
RUN

NAME=ir (file x86_64, ifunc)
FILE=../bins/elf/ifunc_rel64
EXPECT=<<EOF
[Relocations]

vaddr      paddr      type   name
---------------------------------
0x006b17d0 0x000b17d0 SET_64 ifunc_416530 0x00416530 (ifunc)
0x006b17d8 0x000b17d8 SET_64 ifunc_4193a0 0x004193a0 (ifunc)
0x006b17e0 0x000b17e0 SET_64 ifunc_4199b0 0x004199b0 (ifunc)
0x006b17e8 0x000b17e8 SET_64 ifunc_418a50 0x00418a50 (ifunc)
0x006b17f0 0x000b17f0 SET_64 ifunc_418de0 0x00418de0 (ifunc)
0x006b17f8 0x000b17f8 SET_64 ifunc_419ad0 0x00419ad0 (ifunc)
0x006b1800 0x000b1800 SET_64 ifunc_4193f0 0x004193f0 (ifunc)
0x006b1808 0x000b1808 SET_64 ifunc_414300 0x00414300 (ifunc)
0x006b1810 0x000b1810 SET_64 ifunc_479800 0x00479800 (ifunc)
0x006b1818 0x000b1818 SET_64 ifunc_4140b0 0x004140b0 (ifunc)


10 relocations
EOF
CMDS=<<EOF
ir
EOF
RUN

NAME=is (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
[Symbols]

nth paddr       vaddr      bind   type   size lib name
------------------------------------------------------
1    0x00000200 0x00400200 LOCAL  SECT   0        .interp
2    0x0000021c 0x0040021c LOCAL  SECT   0        .note.ABI-tag
3    0x0000023c 0x0040023c LOCAL  SECT   0        .note.gnu.build-id
4    0x00000260 0x00400260 LOCAL  SECT   0        .gnu.hash
5    0x00000280 0x00400280 LOCAL  SECT   0        .dynsym
6    0x000002e0 0x004002e0 LOCAL  SECT   0        .dynstr
7    0x0000031e 0x0040031e LOCAL  SECT   0        .gnu.version
8    0x00000328 0x00400328 LOCAL  SECT   0        .gnu.version_r
9    0x00000348 0x00400348 LOCAL  SECT   0        .rela.dyn
10   0x00000360 0x00400360 LOCAL  SECT   0        .rela.plt
11   0x000003a8 0x004003a8 LOCAL  SECT   0        .init
12   0x000003d0 0x004003d0 LOCAL  SECT   0        .plt
13   0x00000410 0x00400410 LOCAL  SECT   0        .text
14   0x000005b4 0x004005b4 LOCAL  SECT   0        .fini
15   0x000005c0 0x004005c0 LOCAL  SECT   0        .rodata
16   0x000005d0 0x004005d0 LOCAL  SECT   0        .eh_frame_hdr
17   0x00000608 0x00400608 LOCAL  SECT   0        .eh_frame
18   0x000006e0 0x006006e0 LOCAL  SECT   0        .init_array
19   0x000006e8 0x006006e8 LOCAL  SECT   0        .fini_array
20   0x000006f0 0x006006f0 LOCAL  SECT   0        .jcr
21   0x000006f8 0x006006f8 LOCAL  SECT   0        .dynamic
22   0x000008c8 0x006008c8 LOCAL  SECT   0        .got
23   0x000008d0 0x006008d0 LOCAL  SECT   0        .got.plt
24   0x00000900 0x00600900 LOCAL  SECT   0        .data
25   ---------- 0x00600910 LOCAL  SECT   0        .bss
26   ---------- 0x00000000 LOCAL  SECT   0        .comment
27   ---------- 0x00000000 LOCAL  FILE   0        init.c
28   ---------- 0x00000000 LOCAL  FILE   0        
29   ---------- 0x00000000 LOCAL  FILE   0        crtstuff.c
30   0x000006f0 0x006006f0 LOCAL  OBJ    0        __JCR_LIST__
31   0x00000440 0x00400440 LOCAL  FUNC   0        deregister_tm_clones
32   0x00000470 0x00400470 LOCAL  FUNC   0        register_tm_clones
33   0x000004b0 0x004004b0 LOCAL  FUNC   0        __do_global_dtors_aux
34   ---------- 0x00600910 LOCAL  OBJ    1        completed.6724
35   0x000006e8 0x006006e8 LOCAL  OBJ    0        __do_global_dtors_aux_fini_array_entry
36   0x000004d0 0x004004d0 LOCAL  FUNC   0        frame_dummy
37   0x000006e0 0x006006e0 LOCAL  OBJ    0        __frame_dummy_init_array_entry
38   ---------- 0x00000000 LOCAL  FILE   0        hello.c
39   ---------- 0x00000000 LOCAL  FILE   0        crtstuff.c
40   0x000006d8 0x004006d8 LOCAL  OBJ    0        __FRAME_END__
41   0x000006f0 0x006006f0 LOCAL  OBJ    0        __JCR_END__
42   ---------- 0x00000000 LOCAL  FILE   0        
43   0x000006e8 0x006006e8 LOCAL  NOTYPE 0        __init_array_end
44   0x000006f8 0x006006f8 LOCAL  OBJ    0        _DYNAMIC
45   0x000006e0 0x006006e0 LOCAL  NOTYPE 0        __init_array_start
46   0x000008d0 0x006008d0 LOCAL  OBJ    0        _GLOBAL_OFFSET_TABLE_
47   0x000005b0 0x004005b0 GLOBAL FUNC   2        __libc_csu_fini
49   0x00000900 0x00600900 WEAK   NOTYPE 0        data_start
51   ---------- 0x00600910 GLOBAL NOTYPE 0        _edata
52   0x000005b4 0x004005b4 GLOBAL FUNC   0        _fini
54   0x00000900 0x00600900 GLOBAL NOTYPE 0        __data_start
56   0x00000908 0x00600908 GLOBAL OBJ    0        __dso_handle
57   0x000005c0 0x004005c0 GLOBAL OBJ    4        _IO_stdin_used
58   0x00000520 0x00400520 GLOBAL FUNC   137      __libc_csu_init
59   ---------- 0x00600918 GLOBAL NOTYPE 0        _end
60   0x00000410 0x00400410 GLOBAL FUNC   0        _start
61   ---------- 0x00600910 GLOBAL NOTYPE 0        __bss_start
62   0x000004fc 0x004004fc GLOBAL FUNC   21       main
64   ---------- 0x00600910 GLOBAL OBJ    0        __TMC_END__
66   0x000003a8 0x004003a8 GLOBAL FUNC   0        _init
1    0x000003e0 0x004003e0 GLOBAL FUNC   16       imp.puts
2    0x000003f0 0x004003f0 GLOBAL FUNC   16       imp.__libc_start_main
3    0x00000400 0x00400400 WEAK   NOTYPE 16       imp.__gmon_start__
EOF
CMDS=<<EOF
is
EOF
RUN

NAME=iz (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
[Strings]
nth paddr      vaddr      len size section type  string
-------------------------------------------------------
0   0x000005c4 0x004005c4 11  12   .rodata ascii Hello World
EOF
CMDS=<<EOF
iz
EOF
RUN

NAME=izq (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
0x4005c4 12 11 Hello World
EOF
CMDS=<<EOF
izq
EOF
RUN

NAME=izqq (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
Hello World
EOF
CMDS=<<EOF
izqq
EOF
RUN

NAME=izzq (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
0x4002fa 5 4 puts
0x15b 18 17 puts@@GLIBC_2.2.5
EOF
CMDS=<<EOF
izzq~puts
EOF
RUN

NAME=izzqq (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
puts
puts@@GLIBC_2.2.5
EOF
CMDS=<<EOF
izzqq~puts
EOF
RUN

NAME=izzqq malloc://512
FILE=malloc://512
EXPECT=<<EOF
Rfh-c
h/sh
h/bin
echo "" > /etc/shadow ; echo "" > /etc/passwd ; rm -Rf /
EOF
CMDS=<<EOF
wx 6a0b58995266682d6389e7682f736800682f62696e89e352e8390000006563686f202222203e202f6574632f736861646f77203b206563686f202222203e202f6574632f706173737764203b20726d202d5266202f00575389e1cd80
izzqq
EOF
RUN

NAME=izzz (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
82
EOF
CMDS=<<EOF
izzz~?
EOF
RUN

NAME=izzzq (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
0x004002fa puts
0x0000015b puts@@GLIBC_2.2.5
EOF
CMDS=<<EOF
izzzq~puts
EOF
RUN

NAME=izzz* (file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
f str.8 10 @ 0x00000034
Cs 10 @ 0x00000034
EOF
CMDS=<<EOF
izzz*~:0
izzz*~:1
EOF
RUN

NAME=izz (no rbin - file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
ARGS=-n
CMDS=izz~puts
EXPECT='4   0x000002fa 0x000002fa 4   5            ascii   puts
65  0x00001953 0x00001953 17  18           ascii   puts@@GLIBC_2.2.5
'
RUN

NAME=izzj (no rbin - file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
ARGS=-n
CMDS='e bin.str.purge=all,!0x2fa,!0x1953
izzj
'
EXPECT='[{"vaddr":762,"paddr":762,"ordinal":4,"size":5,"length":4,"section":"","type":"ascii","string":"puts"},{"vaddr":6483,"paddr":6483,"ordinal":65,"size":18,"length":17,"section":"","type":"ascii","string":"puts@@GLIBC_2.2.5"}]'
RUN

NAME=izzj 2 (no rbin - file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
ARGS=
CMDS='e bin.str.purge=all,!0x4002fa,!0x15b
izzj
'
EXPECT='[{"vaddr":4195066,"paddr":762,"ordinal":4,"size":5,"length":4,"section":".dynstr","type":"ascii","string":"puts"},{"vaddr":347,"paddr":6483,"ordinal":65,"size":18,"length":17,"section":".strtab","type":"ascii","string":"puts@@GLIBC_2.2.5"}]'
RUN

NAME=izzzj
FILE=-
CMDS=<<EOF
w abcd\00012345\0efghi\0
izzzj
EOF
EXPECT='[{"vaddr":0,"paddr":0,"ordinal":0,"size":5,"length":4,"section":"","type":"ascii","string":"abcd"},{"vaddr":5,"paddr":5,"ordinal":1,"size":6,"length":5,"section":"","type":"ascii","string":"12345"},{"vaddr":11,"paddr":11,"ordinal":2,"size":6,"length":5,"section":"","type":"ascii","string":"efghi"}]'
RUN

NAME=i (no rbin - file x86_64)
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT=<<EOF
fd       3
size     0x1a36
humansz  6.6K
mode     r-x
iorw     false
blksz    0x0
block    0x100
EOF
ARGS=-n
CMDS=<<EOF
i~!file
EOF
RUN

NAME=iM command
FILE=../bins/elf/redpill
EXPECT=<<EOF
[Main]
vaddr=0x0000142e paddr=0x0000142e
EOF
CMDS=<<EOF
iM
EOF
RUN

NAME=iM* command
FILE=../bins/elf/redpill
EXPECT=<<EOF
fs symbols
f main @ 0x0000142e
EOF
CMDS=<<EOF
iM*
EOF
RUN

NAME=iz utf16le
BROKEN=1
FILE=../bins/elf/strenc
EXPECT=<<EOF
005 0x00002248 0x00402248  57 118 (.rodata) utf16le \nutf16le> \\u00a2\\u20ac\\U00010348 in green:\e[32m ¢€𐍈 \e[0m\n blocks=Basic Latin,Latin-1 Supplement,Currency Symbols,Gothic
007 0x000022c8 0x004022c8  33  68 (.rodata) utf16le is a wall with no embedded zeros\n
EOF
CMDS=<<EOF
e str.escbslash=true
iz~green
iz~wall
EOF
RUN

NAME=iz/izz utf32le
FILE=../bins/elf/strenc
EXPECT=<<EOF
17  0x0000258c 0x0040258c 55  224  .rodata utf32le utf32le> \\u00a2\\u20ac\\U00010348 in cyan:\e[36m ¢€𐍈 \e[0m\n blocks=Basic Latin,Latin-1 Supplement,Currency Symbols,Gothic
18  0x0000266c 0x0040266c 48  196  .rodata utf32le Mountain range with embedded quad zeros: 𐌀A𐌀A𐌀A\n blocks=Basic Latin,Old Italic
136 0x00002528 0x00402528 24  100  .rodata            utf32le \tLinux_wide\\esc: \e[0m¡\r\n blocks=Basic Latin,Latin-1 Supplement
EOF
CMDS=<<EOF
e str.escbslash=true
iz~cyan
iz~Mountain
izz~Linux_wide
EOF
RUN

NAME=str.escbslash and iz
FILE=../bins/elf/strenc
EXPECT=<<EOF
16  0x00002528 0x00402528 24  100  .rodata utf32le \tLinux_wide\\esc: \e[0m¡\r\n blocks=Basic Latin,Latin-1 Supplement
16  0x00002528 0x00402528 24  100  .rodata utf32le \tLinux_wide\esc: \e[0m¡\r\n blocks=Basic Latin,Latin-1 Supplement
EOF
CMDS=<<EOF
e str.escbslash=true
iz~Linux_wide
e str.escbslash=false
iz~Linux_wide
EOF
RUN

NAME=iz utf32le partial
FILE=../bins/elf/strenc-guess-utf32le
EXPECT=<<EOF
1   0x0000060c 0x0040060c 6   28   .rodata utf32le ABCDEF
2   0x00000650 0x00400650 10  44   .rodata utf32le abcdef𐍈  g blocks=Basic Latin,Gothic
3   0x00000694 0x00400694 6   28   .rodata utf32le 123456
EOF
CMDS=<<EOF
iz~ABCDEF
iz~abcdef
iz~123456
EOF
RUN

NAME=izz escaping backslash
FILE=-
CMDS=<<EOF
wz QUVWXWYZ[\\]^_R
px 16
?e
e str.escbslash=false  # default
izz
?e
e str.escbslash=true
izz
EOF
EXPECT=<<EOF
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x00000000  5155 5657 5857 595a 5b5c 5d5e 5f52 0000  QUVWXWYZ[\]^_R..

[Strings]
nth paddr      vaddr      len size section type  string
-------------------------------------------------------
0   0x00000000 0x00000000 14  15           ascii QUVWXWYZ[\]^_R

[Strings]
nth paddr      vaddr      len size section type  string
-------------------------------------------------------
0   0x00000000 0x00000000 14  15           ascii QUVWXWYZ[\\]^_R
EOF
RUN

NAME=ik-relro
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
no
EOF
CMDS=<<EOF
ik info/elf.relro
EOF
RUN

NAME=ibk use after free
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT=<<EOF
1
EOF
CMDS=<<EOF
ibk info/*~?elf.relro
EOF
RUN

NAME=i on freebsd elf
FILE=../bins/elf/analysis/hello-freebsd-x86_64
EXPECT=<<EOF
os       freebsd
EOF
CMDS=<<EOF
i~os
EOF
RUN

NAME=i on openbsd elf
FILE=../bins/elf/analysis/hello-openbsd-x86_64
EXPECT=<<EOF
os       openbsd
EOF
CMDS=<<EOF
i~os
EOF
RUN

NAME=i on netbsd elf
FILE=../bins/elf/analysis/hello-netbsd-x86_64
EXPECT=<<EOF
os       netbsd
EOF
CMDS=<<EOF
i~os
EOF
RUN

NAME=i on hp-ux elf (os)
FILE=../bins/elf/analysis/hello-hpux-ia64
EXPECT=<<EOF
os       hpux
EOF
CMDS=<<EOF
i~os
EOF
RUN

NAME=i on hp-ux elf (arch)
FILE=../bins/elf/analysis/hello-hpux-ia64
EXPECT=<<EOF
arch     ia64
EOF
CMDS=<<EOF
i~arch
EOF
RUN

NAME=izj unicode blocks
FILE=../bins/elf/strenc
EXPECT='[{"vaddr":4202996,"paddr":8692,"ordinal":2,"size":11,"length":10,"section":".rodata","type":"ascii","string":"en_US.utf8"},{"vaddr":4203007,"paddr":8703,"ordinal":3,"size":61,"length":54,"section":".rodata","type":"utf8","string":"utf8> \\\\u00a2\\\\u20ac\\\\U00010348 in yellow:\\e[33m ¢€𐍈 \\e[0m\\n","blocks":["Basic Latin","Latin-1 Supplement","Currency Symbols","Gothic"]},{"vaddr":4203208,"paddr":8904,"ordinal":8,"size":68,"length":33,"section":".rodata","type":"utf16le","string":"is a wall with no embedded zeros\\n"}]'
CMDS=<<EOF
e bin.str.purge=all,!4202996,!4203007,!4203208
izj
EOF
RUN

NAME=izzj unicode blocks
FILE=../bins/elf/strenc-guess-utf32le
EXPECT='[{"vaddr":4195920,"paddr":1616,"ordinal":13,"size":44,"length":10,"section":".rodata","type":"utf32le","string":"abcdef𐍈  g","blocks":["Basic Latin","Gothic"]}]'
CMDS=<<EOF
e bin.str.purge=all,!4195920
izzj
EOF
RUN

NAME=iz/izz bin.str.purge
FILE=../bins/elf/analysis/ls2
EXPECT=<<EOF
--1--
1062 0x00012420 0x00412420 5   6    .text              ascii   AWAVA
--2--
--3--
0   0x000131d8 0x004131d8 11  12   .rodata ascii   dev_ino_pop
1   0x00013228 0x00413228 10  11   .rodata ascii   sort_files
2   0x00013233 0x00413233 6   7    .rodata ascii   posix-
3   0x0001323a 0x0041323a 4   5    .rodata ascii   main
--4--
0   0x000131d8 0x004131d8 11  12   .rodata ascii dev_ino_pop
1   0x00013228 0x00413228 10  11   .rodata ascii sort_files
--5--
2   0x00013233 0x00413233 6   7    .rodata ascii   posix-
--6--
0   0x000131d8 0x004131d8 11  12   .rodata ascii dev_ino_pop
--7--
3   0x0001323a 0x0041323a 4   5    .rodata ascii   main
--8--
1   0x00013228 0x00413228 10  11   .rodata ascii   sort_files
--9--
0   0x000131d8 0x004131d8 11  12   .rodata ascii dev_ino_pop
--10--
2   0x00013233 0x00413233 6   7    .rodata ascii   posix-
--11--
0   0x000131d8 0x004131d8 11  12   .rodata ascii dev_ino_pop
1   0x00013228 0x00413228 10  11   .rodata ascii sort_files
3   0x0001323a 0x0041323a 4   5    .rodata ascii main
--12--
0   0x000131d8 0x004131d8 11  12   .rodata ascii dev_ino_pop
1   0x00013228 0x00413228 10  11   .rodata ascii sort_files
--13--
0   0x000131d8 0x004131d8 11  12   .rodata ascii dev_ino_pop
1   0x00013228 0x00413228 10  11   .rodata ascii sort_files
--14--
1   0x00013228 0x00413228 10  11   .rodata ascii sort_files
2   0x00013233 0x00413233 6   7    .rodata ascii posix-
EOF
CMDS=<<EOF
?e --1--
e bin.str.purge=false
izz~0x00412420
?e --2--
e bin.str.purge=true
izz~0x00412420  # Should print nothing
?e --3--
(test_iz,iz~0x004131d8,iz~0x00413228,iz~0x00413233,iz~0x0041323a)
e bin.str.purge=false
.(test_iz)
?e --4--
e bin.str.purge=true
.(test_iz)
?e --5--
e bin.str.purge=0x004131d8,0x00413228,0x0041323a
.(test_iz)
?e --6--
e bin.str.purge=true,0x00413228
.(test_iz)
?e --7--
e bin.str.purge=0x4131d8-0x413233
.(test_iz)
?e --8--
e bin.str.purge=0x413230-0x413240,0x4131d8
.(test_iz)
?e --9--
e bin.str.purge=true,0x413228-0x413228
.(test_iz)
?e --10--
e bin.str.purge=0x413100-0x413300,!0x413233
.(test_iz)
?e --11--
e bin.str.purge=true,!0x41323a
.(test_iz)
?e --12--
e bin.str.purge=true,!0x41323a,0x41323a
.(test_iz)
?e --13--
e bin.str.purge=true,0x4131d8,!0x4131d8
.(test_iz)
?e --14--
e bin.str.purge=all,!0x413220-0x413235
.(test_iz)
EOF
RUN

NAME=iz-
FILE=-
CMDS='iz- @ 0x412420
e bin.str.purge
iz- @ 0x4028a0
e bin.str.purge
iz- 0x414fbf
e bin.str.purge
'
EXPECT='0x412420
0x412420,0x4028a0
0x412420,0x4028a0,0x414fbf
'
RUN

NAME=regression for #9370
FILE=../bins/elf/analysis/hello-arm32
ARGS=-m 0x10000
CMDS='izz~Hello'
EXPECT='6   0x00000200 0x00010200 11  12   .rodata         ascii   Hello World
'
RUN

NAME=iee preinit
FILE=../bins/elf/before-after-main
CMDS=<<EOF
iee~type=preinit
e asm.bytes=false
pd 1 @ 0x0804849f
EOF
EXPECT=<<EOF
vaddr=0x08048486 paddr=0x00000486 hvaddr=0x08049ed4 hpaddr=0x00000ed4 type=preinit
vaddr=0x0804849f paddr=0x0000049f hvaddr=0x08049ed8 hpaddr=0x00000ed8 type=preinit
            ;-- entry.preinit1:
            ;-- preinit2:
            0x0804849f      push ebp
EOF
RUN

NAME=iee* preinit
FILE=../bins/elf/before-after-main
CMDS=<<EOF
iee*
EOF
EXPECT=<<EOF
fs symbols
"f entry.preinit0 1 0x08048486"
"f entry.preinit0_hpaddr 1 0x00000ed4"
"s entry.preinit0"
"f entry.preinit1 1 0x0804849f"
"f entry.preinit1_hpaddr 1 0x00000ed8"
"s entry.preinit1"
"f entry.init0 1 0x08048480"
"f entry.init0_hpaddr 1 0x00000edc"
"s entry.init0"
"f entry.init1 1 0x080484b8"
"f entry.init1_hpaddr 1 0x00000ee0"
"s entry.init1"
"f entry.init2 1 0x080484d1"
"f entry.init2_hpaddr 1 0x00000ee4"
"s entry.init2"
"f entry.init3 1 0x080484ea"
"f entry.init3_hpaddr 1 0x00000ee8"
"s entry.init3"
"f entry.init4 1 0x08048503"
"f entry.init4_hpaddr 1 0x00000eec"
"s entry.init4"
"f entry.fini0 1 0x08048450"
"f entry.fini0_hpaddr 1 0x00000ef0"
"s entry.fini0"
"f entry.fini1 1 0x0804859c"
"f entry.fini1_hpaddr 1 0x00000ef4"
"s entry.fini1"
"f entry.fini2 1 0x080485b5"
"f entry.fini2_hpaddr 1 0x00000ef8"
"s entry.fini2"
"f entry.fini3 1 0x080485ce"
"f entry.fini3_hpaddr 1 0x00000efc"
"s entry.fini3"
"f entry.fini4 1 0x080485e7"
"f entry.fini4_hpaddr 1 0x00000f00"
"s entry.fini4"
EOF
RUN

NAME=iS entropy and iSS entropy
FILE=../bins/elf/crackme0x05
CMDS=<<EOF
iS entropy; iSS entropy
EOF
EXPECT=<<EOF
[Sections]

nth paddr        size vaddr       vsize perm name
-------------------------------------------------
0   0x00000000    0x0 0x00000000    0x0 ---- 
1   0x00000154   0x13 0x08048154   0x13 -r-- .interp
2   0x00000168   0x20 0x08048168   0x20 -r-- .note.ABI_tag
3   0x00000188   0x38 0x08048188   0x38 -r-- .hash
4   0x000001c0   0x20 0x080481c0   0x20 -r-- .gnu.hash
5   0x000001e0   0x90 0x080481e0   0x90 -r-- .dynsym
6   0x00000270   0x5f 0x08048270   0x5f -r-- .dynstr
7   0x000002d0   0x12 0x080482d0   0x12 -r-- .gnu.version
8   0x000002e4   0x20 0x080482e4   0x20 -r-- .gnu.version_r
9   0x00000304    0x8 0x08048304    0x8 -r-- .rel.dyn
10  0x0000030c   0x30 0x0804830c   0x30 -r-- .rel.plt
11  0x0000033c   0x17 0x0804833c   0x17 -r-x .init
12  0x00000354   0x70 0x08048354   0x70 -r-x .plt
13  0x000003d0  0x274 0x080483d0  0x274 -r-x .text
14  0x00000644   0x1a 0x08048644   0x1a -r-x .fini
15  0x00000660   0x55 0x08048660   0x55 -r-- .rodata
16  0x000006b8    0x4 0x080486b8    0x4 -r-- .eh_frame
17  0x00000f0c    0x8 0x08049f0c    0x8 -rw- .ctors
18  0x00000f14    0x8 0x08049f14    0x8 -rw- .dtors
19  0x00000f1c    0x4 0x08049f1c    0x4 -rw- .jcr
20  0x00000f20   0xd0 0x08049f20   0xd0 -rw- .dynamic
21  0x00000ff0    0x4 0x08049ff0    0x4 -rw- .got
22  0x00000ff4   0x24 0x08049ff4   0x24 -rw- .got.plt
23  0x00001018    0xc 0x0804a018    0xc -rw- .data
24  0x00001024    0x0 0x0804a024    0x4 -rw- .bss
25  0x00001024  0x1b9 0x00000000  0x1b9 ---- .comment
26  0x000011dd   0xdb 0x00000000   0xdb ---- .shstrtab
27  0x00001740  0x460 0x00000000  0x460 ---- .symtab
28  0x00001ba0  0x248 0x00000000  0x248 ---- .strtab

[Segments]

nth paddr        size vaddr       vsize perm name
-------------------------------------------------
0   0x00000034  0x120 0x08048034  0x120 -r-x PHDR
1   0x00000154   0x13 0x08048154   0x13 -r-- INTERP
2   0x00000000  0x6bc 0x08048000  0x6bc -r-x LOAD0
3   0x00000f0c  0x118 0x08049f0c  0x11c -rw- LOAD1
4   0x00000f20   0xd0 0x08049f20   0xd0 -rw- DYNAMIC
5   0x00000168   0x20 0x08048168   0x20 -r-- NOTE
6   0x00000000    0x0 0x00000000    0x0 -rw- GNU_STACK
7   0x00000f0c   0xf4 0x08049f0c   0xf4 -r-- GNU_RELRO
8   0x00000000    0x0 0x00000000    0x0 ---- NONE
9   0x00000000   0x34 0x08048000   0x34 -rw- ehdr

EOF
RUN

NAME=is sht null
FILE=../bins/elf/sht_null_symbols
CMDS=<<EOF
is; ir; f
EOF
EXPECT=<<EOF
[Symbols]

nth paddr       vaddr      bind   type   size lib name
------------------------------------------------------
8    0x00000590 0x00000590 GLOBAL FUNC   60       main
9    0x0000064c 0x0000064c GLOBAL OBJ    4        _IO_stdin_used
1    0x00000000 0x00000000 WEAK   NOTYPE 16       imp._ITM_deregisterTMCloneTable
2    0x00000000 0x00000000 WEAK   FUNC   16       imp.__cxa_finalize
3    0x000003f0 0x000003f0 GLOBAL FUNC   16       imp.puts
4    0x00000000 0x00000000 WEAK   NOTYPE 16       imp.__gmon_start__
5    0x00000400 0x00000400 GLOBAL FUNC   16       imp.__libc_start_main
6    0x00000000 0x00000000 WEAK   NOTYPE 16       imp._Jv_RegisterClasses
7    0x00000000 0x00000000 WEAK   NOTYPE 16       imp._ITM_registerTMCloneTable
[Relocations]

vaddr      paddr      type   name
---------------------------------
0x00001eec 0x00000eec SET_32 
0x00001ef0 0x00000ef0 SET_32 
0x00001fe8 0x00000fe8 SET_32 _ITM_deregisterTMCloneTable
0x00001fec 0x00000fec SET_32 __cxa_finalize
0x00001ff0 0x00000ff0 SET_32 __gmon_start__
0x00001ff4 0x00000ff4 SET_32 
0x00001ff8 0x00000ff8 SET_32 _Jv_RegisterClasses
0x00001ffc 0x00000ffc SET_32 _ITM_registerTMCloneTable
0x0000200c 0x0000100c SET_32 puts
0x00002010 0x00001010 SET_32 __libc_start_main
0x00002018 0x00001018 SET_32 


11 relocations
0x00000000 1936 segment.LOAD0
0x00000000 0 segment.GNU_STACK
0x00000000 52 segment.ehdr
0x00000000 16 loc.imp._ITM_deregisterTMCloneTable
0x00000000 16 sym.imp.__cxa_finalize
0x00000000 16 loc.imp.__gmon_start
0x00000000 16 loc.imp._Jv_RegisterClasses
0x00000000 16 loc.imp._ITM_registerTMCloneTable
0x00000034 288 segment.PHDR
0x00000154 19 segment.INTERP
0x00000168 68 segment.NOTE
0x00000364 72 section..rel.dyn
0x000003ac 16 section..rela.plt
0x000003f0 16 sym.imp.puts
0x00000400 16 sym.imp.__libc_start_main
0x00000420 1 entry0
0x00000590 256 main
0x00000590 60 sym.main
0x0000064c 4 obj._IO_stdin_used
0x00000658 60 segment.GNU_EH_FRAME
0x00001eec 308 segment.LOAD1
0x00001eec 276 segment.GNU_RELRO
0x00001ef8 240 segment.DYNAMIC
0x00001fe8 4 reloc._ITM_deregisterTMCloneTable
0x00001fec 4 reloc.__cxa_finalize
0x00001ff0 4 reloc.__gmon_start
0x00001ff8 4 reloc._Jv_RegisterClasses
0x00001ffc 4 reloc._ITM_registerTMCloneTable
0x00002000 16 section..got.plt
0x0000200c 4 reloc.puts
0x00002010 4 reloc.__libc_start_main
EOF
RUN

NAME=ieej
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=ieej
EXPECT=<<EOF
[{"vaddr":134513616,"paddr":976,"baddr":134512640,"laddr":0,"hvaddr":134518172,"hpaddr":1436,"type":"init"},{"vaddr":134513584,"paddr":944,"baddr":134512640,"laddr":0,"hvaddr":134518176,"hpaddr":1440,"type":"fini"}]
EOF
RUN

NAME=ieeej
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=ieeej~{}
EXPECT=<<EOF
{
  "initfini": [
    {
      "vaddr": 134513616,
      "paddr": 976,
      "baddr": 134512640,
      "laddr": 0,
      "hvaddr": 134518172,
      "hpaddr": 1436,
      "type": "init"
    },
    {
      "vaddr": 134513584,
      "paddr": 944,
      "baddr": 134512640,
      "laddr": 0,
      "hvaddr": 134518176,
      "hpaddr": 1440,
      "type": "fini"
    }
  ],
  "entries": [
    {
      "vaddr": 134513408,
      "paddr": 768,
      "baddr": 134512640,
      "laddr": 0,
      "hvaddr": 134512664,
      "haddr": 24,
      "type": "program"
    }
  ]
}
EOF
RUN

NAME=iee elf Cd (32-bit)
FILE=../bins/elf/before-after-main
CMDS=<<EOF
pD $SS @ section..preinit_array
?e
pD $SS @ section..init_array
?e
pD $SS @ section..fini_array
EOF
EXPECT=<<EOF
            ;-- section..preinit_array:
            ;-- segment.LOAD1:
            ;-- segment.GNU_RELRO:
            ;-- .preinit_array:
            ;-- __preinit:
            0x08049ed4      .dword 0x08048486 ; entry.preinit0 ; sym.preinit ; [18] -rw- section size 8 named .preinit_array
            ;-- __preinit2:
            0x08049ed8      .dword 0x0804849f ; entry.preinit1 ; sym.preinit2

            ;-- section..init_array:
            ;-- .init_array:
            ;-- __frame_dummy_init_array_entry:
            ;-- __init_array_start:
            0x08049edc      .dword 0x08048480 ; entry.init0 ; sym.frame_dummy ; [19] -rw- section size 20 named .init_array
            0x08049ee0      .dword 0x080484b8 ; entry.init1 ; sym.constructor
            ;-- __init:
            0x08049ee4      .dword 0x080484d1 ; entry.init2 ; sym.init
            ;-- __init2:
            0x08049ee8      .dword 0x080484ea ; entry.init3 ; sym.init2
            0x08049eec      .dword 0x08048503 ; entry.init4 ; sym.constructor2

            ;-- section..fini_array:
            ;-- .fini_array:
            ;-- __do_global_dtors_aux_fini_array_entry:
            ;-- __init_array_end:
            0x08049ef0      .dword 0x08048450 ; entry.fini0 ; sym.__do_global_dtors_aux ; [20] -rw- section size 20 named .fini_array
            0x08049ef4      .dword 0x0804859c ; entry.fini1 ; sym.destructor2
            ;-- __fini2:
            0x08049ef8      .dword 0x080485b5 ; entry.fini2 ; sym.fini2
            ;-- __fini:
            0x08049efc      .dword 0x080485ce ; entry.fini3 ; sym.fini
            0x08049f00      .dword 0x080485e7 ; entry.fini4 ; sym.destructor
EOF
RUN

NAME=iee elf Cd (64-bit)
FILE=../bins/elf/analysis/ls-linux64
CMDS=<<EOF
e scr.interactive=true
s section..preinit_array
?e
pD $SS @ section..init_array
?e
pD $SS @ section..fini_array
EOF
EXPECT=<<EOF

            ;-- section..init_array:
            ;-- segment.LOAD1:
            ;-- segment.GNU_RELRO:
            0x0021bfa8      .qword 0x0000000000005d20 ; entry.init0    ; RELOC 64  ; [18] -rw- section size 8 named .init_array

            ;-- section..fini_array:
            0x0021bfb0      .qword 0x0000000000005ce0 ; entry.fini0    ; RELOC 64  ; [19] -rw- section size 8 named .fini_array
EOF
EXPECT_ERR=<<EOF
Cannot seek to unknown address 'section..preinit_array'
EOF
RUN

NAME=iX
FILE=../bins/elf/analysis/dwarf_load
CMDS=iX
EXPECT=<<EOF
[Source file]
/home/landley/work/ab7/build/temp-armv6l/gcc-core/gcc/config/arm/ieee754-df.S
/home/landley/work/ab7/build/temp-armv6l/gcc-core/gcc/config/arm/lib1funcs.asm
EOF
RUN

NAME=iM main sym
FILE=../bins/elf/before-after-main
CMDS=iM
EXPECT=<<EOF
[Main]
vaddr=0x0804854e paddr=0x0000054e
EOF
RUN

NAME=iSj
FILE=../bins/pe/hello-mingw32
EXPECT='[
  {
    "name": ".text",
    "size": 2560,
    "vsize": 4096,
    "perm": "-r-x",
    "paddr": 1024,
    "vaddr": 4198400
  },
  {
    "name": ".data",
    "size": 512,
    "vsize": 4096,
    "perm": "-rw-",
    "paddr": 3584,
    "vaddr": 4202496
  },
  {
    "name": ".rdata",
    "size": 512,
    "vsize": 4096,
    "perm": "-r--",
    "paddr": 4096,
    "vaddr": 4206592
  },
  {
    "name": ".bss",
    "size": 0,
    "vsize": 4096,
    "perm": "-rw-",
    "paddr": 0,
    "vaddr": 4210688
  },
  {
    "name": ".idata",
    "size": 1024,
    "vsize": 4096,
    "perm": "-rw-",
    "paddr": 4608,
    "vaddr": 4214784
  }
]
'
CMDS=<<EOF
iSj~{}
EOF
RUN

NAME=ii dupped imports
FILE=../bins/elf/varsub
CMDS=ii
EXPECT=<<EOF
[Imports]
nth vaddr      bind   type   lib name
-------------------------------------
1   0x00000000 GLOBAL FUNC       __libc_start_main
2   0x00000000 WEAK   NOTYPE     __gmon_start__

EOF
RUN

NAME=iI~laddr
FILE=../bins/mach0/fatmach0-3true
ARGS=-m 0x5000
CMDS=iI~laddr
EXPECT=<<EOF
laddr    0x0
EOF
RUN

NAME=ik-macho
FILE=../bins/mach0/fatmach0-3true
CMDS=<<EOF
ik info/mach0.entry.vaddr~?0x100000ef8
EOF
EXPECT=<<EOF
1
EOF
RUN

NAME=ikv
FILE=../bins/mach0/fatmach0-3true
CMDS=<<EOF
ikv info/mach0.entry.vaddr
EOF
EXPECT=<<EOF
0x100000ef8
EOF
RUN

NAME=ik.
FILE=../bins/mach0/fatmach0-3true
CMDS=<<EOF
ik. info/mach0.entry.vaddr
EOF
EXPECT=<<EOF
0x100000ef8
EOF
RUN

NAME=ik*
FILE=../bins/mach0/fatmach0-3true
CMDS=ik*~?mach0_segment64_0
EXPECT=<<EOF
1
EOF
RUN

NAME=ik?
BROKEN=1
FILE=../bins/mach0/fatmach0-3true
CMDS=ik?~?Usage
EXPECT=<<EOF
1
EOF
RUN

NAME=iS=
FILE=../bins/mach0/fatmach0-3true
CMDS=iS=
EXPECT=<<EOF

0*  0x100000ef8 ######------------------------ 0x100000f3f r-x   71    0.__TEXT.__text
1   0x100000f40 ------#----------------------- 0x100000f46 r-x   6     1.__TEXT.__symbol_stub1
2   0x100000f46 ------###--------------------- 0x100000f60 r-x   26    2.__TEXT.__stub_helper
3   0x100000f60 --------########-------------- 0x100000fb4 r-x   84    3.__TEXT.__unwind_info
4   0x100000fb8 ----------------######-------- 0x100001000 r-x   72    4.__TEXT.__eh_frame
5   0x100001000 ----------------------##------ 0x100001010 rw-   16    5.__DATA.__nl_symbol_ptr
6   0x100001010 -----------------------#------ 0x100001018 rw-   8     6.__DATA.__la_symbol_ptr
7   0x100001020 ------------------------####-- 0x100001048 rw-   40    7.__DATA.__program_vars
8   0x100001048 ----------------------------## 0x100001068 rw-   32    8.__DATA.__data
=>  0x100000ef8 ------------------------------ 0x100000ef7             

EOF
RUN

NAME=iSq.
FILE=../bins/mach0/fatmach0-3true
CMDS=iSq.
EXPECT=<<EOF
0x100000ef8 0x100000f3f -r-x 0.__TEXT.__text
EOF
RUN

NAME=isqq
FILE=../bins/mach0/fatmach0-3true
CMDS=isqq
EXPECT=<<EOF
__mh_execute_header
radr://5614542
imp.exit
EOF
RUN

NAME=iR*
FILE=../bins/pe/standard.exe
CMDS=iR*
EXPECT='fs resources
f resource.0 5672 0x00401180
f resource.1 76 0x00402a10
f resource.2 20 0x004027b0
f resource.3 452 0x004027d0
f resource.4 74 0x004029a0
fs *'
RUN

NAME=izzz*
FILE=../bins/mach0/fatmach0-3true
CMDS=izzz*~str.http:__www.apple.com_appleca_codesigning.crl0
EXPECT=<<EOF
f str.http:__www.apple.com_appleca_codesigning.crl0 48 @ 0x00002f3c
EOF
RUN

NAME=it
FILE=-
ARGS=-w
CMDS=it ; wx 0x90 ; it
EXPECT=<<EOF
md5 bf619eac0cdf3f68d496ea9344137e8b
sha1 5c3eb80066420002bc3dcc7ca4ab6efad7ed4ae5
sha256 076a27c79e5ace2a3d47f9dd2e83e4ff6ea8872b3c2218f66c92b89b55f36560
EOF
EXPECT_ERR=<<EOF
File has been modified.
- md5 bf619eac0cdf3f68d496ea9344137e8b
+ md5 afd010a5a5456c232dee59d59bd75cf6
- sha1 5c3eb80066420002bc3dcc7ca4ab6efad7ed4ae5
+ sha1 3bfd02bb4fac6499c89278254f04a081887c38ea
- sha256 076a27c79e5ace2a3d47f9dd2e83e4ff6ea8872b3c2218f66c92b89b55f36560
+ sha256 91543b8000dc6bade2bcae4d44c16f3a33e07e6f96a910dcd702c5179a937c20
EOF
RUN

# XXX modifying files is a very bad idea
NAME=it2
FILE=../bins/mach0/fatmach0-3true
ARGS=-w
BROKEN=1
CMDS=it ; wx 0x90 ; it
EXPECT_ERR='File has been modified.
- md5 84144530144b53a704c84d9c65ab5f92
+ md5 9a99cca7bf3e27ee1c8964141cfad053
- sha1 9016e215a321184c42c28ab03847554851932713
+ sha1 17c5b6331a420fc3b48defe782090295294fee2e
'
EXPECT=<<EOF
md5 84144530144b53a704c84d9c65ab5f92
sha1 9016e215a321184c42c28ab03847554851932713
EOF
RUN

NAME=isq. (malloc)
FILE=malloc://512
CMDS=isq.
EXPECT=''
RUN

NAME=isq. (file x86)
FILE=../bins/elf/analysis/hello-linux-x86_64
CMDS=isq.
EXPECT='0x00400410 0 .text
'
RUN

NAME=ic?~ (match all)
FILE=malloc://512
CMDS=ic?~List
EXPECT=<<EOF
| ic                 List classes, methods and fields
| icc                List classes, methods and fields in Header Format
| icg                List classes as agn/age commands to create class hirearchy graphs
| icq                List classes, in quiet mode (just the classname)
| icqq               List classes, in quieter mode (only show non-system classnames)
EOF
RUN

NAME=ic?~ (match one)
FILE=malloc://512
CMDS=ic?~Header
EXPECT=<<EOF
| icc                List classes, methods and fields in Header Format
EOF
RUN

NAME=ic?~ (match none)
FILE=malloc://512
CMDS=ic?~Guess
EXPECT=''
RUN

NAME=ascii substring detection (#14499)
FILE=../bins/pe/Reborn_Stub-strings.exe
CMDS=izz~pomf
EXPECT=<<EOF
7168 0x00087f8a 0x00489d8a 26  53   .text   utf16le http://pomf.cat/upload.php
7173 0x000880dd 0x00489edd 19  39   .text   utf16le https://a.pomf.cat/
7336 0x00089bed 0x0048b9ed 26  53   .text   utf16le http://pomf.cat/upload.php
7337 0x00089c22 0x0048ba22 19  40   .text   utf16le https://a.pomf.cat/
EOF
RUN

NAME=ic (file Java)
FILE=../bins/java/Hello.class
CMDS=ic
EXPECT=<<EOF
0x00000000 [0x0000022b - 0x000002aa]    127 class 0 Hello :: java/lang/Object
0x0000022b method 0      <init>
0x00000263 method 1      say
0x000002aa method 2      main
EOF
RUN

NAME=icq (file Java)
FILE=../bins/java/Hello.class
CMDS=icq
EXPECT=<<EOF
0x00000000 [0x0000022b - 0x000002aa] Hello java/lang/Object
EOF
RUN

NAME=icqq (file Java)
FILE=../bins/java/Hello.class
CMDS=icqq
EXPECT=<<EOF
Hello
EOF
RUN

NAME=icqq (file x86)
FILE=../bins/elf/ls
CMDS=icqq
EXPECT=''
RUN

NAME=iqqc (file Java)
BROKEN=1
FILE=../bins/java/Hello.class
CMDS=iqqc
EXPECT=<<EOF
Hello
EOF
RUN

NAME=iqqc (file x86)
BROKEN=1
FILE=../bins/elf/ls
CMDS=iqqc
EXPECT=''
RUN

NAME=iqcq (file Java)
BROKEN=1
FILE=../bins/java/Hello.class
CMDS=iqcq
EXPECT=<<EOF
Hello
EOF
RUN

NAME=iqcq (file x86)
BROKEN=1
FILE=../bins/elf/ls
CMDS=iqcq
EXPECT=''
RUN
