NAME=ac
FILE=-
CMDS=<<EOF
ac Flatline
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
EOF
EXPECT=<<EOF
Flatline
Flatline=c
-
EOF
RUN

NAME=acm
FILE=-
CMDS=<<EOF
ac Flatline
acm Flatline PrayerPosition 0x1337 0x42
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
EOF
EXPECT=<<EOF
Flatline
  PrayerPosition @ 0x1337 (vtable + 0x42)
Flatline=c
-
attr.Flatline.method=PrayerPosition
attr.Flatline.method.PrayerPosition=4919,66
attrtypes.Flatline=method
0x00001337 0 method.Flatline.PrayerPosition
EOF
RUN

NAME=acm-
FILE=-
CMDS=<<EOF
ac Flatline
acm Flatline PrayerPosition 0x1337 0x42
acm Flatline RemainIndoors 0xdeadbeef
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
?e --
acm- Flatline PrayerPosition
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
?e --
acm- Flatline RemainIndoors
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
EOF
EXPECT=<<EOF
Flatline
  PrayerPosition @ 0x1337 (vtable + 0x42)
  RemainIndoors @ 0xdeadbeef
Flatline=c
-
attr.Flatline.method=PrayerPosition,RemainIndoors
attr.Flatline.method.PrayerPosition=4919,66
attr.Flatline.method.RemainIndoors=3735928559,-1
attrtypes.Flatline=method
0x00001337 0 method.Flatline.PrayerPosition
0xdeadbeef 0 method.Flatline.RemainIndoors
--
Flatline
  RemainIndoors @ 0xdeadbeef
Flatline=c
-
attr.Flatline.method=RemainIndoors
attr.Flatline.method.RemainIndoors=3735928559,-1
attrtypes.Flatline=method
0xdeadbeef 0 method.Flatline.RemainIndoors
--
Flatline
Flatline=c
-
EOF
RUN

NAME=acmn
FILE=-
CMDS=<<EOF
ac Flatline
acm Flatline PrayerPosition 0x1337 0x42
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
?e --
acmn Flatline PrayerPosition Marigold
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
EOF
EXPECT=<<EOF
Flatline
  PrayerPosition @ 0x1337 (vtable + 0x42)
Flatline=c
-
attr.Flatline.method=PrayerPosition
attr.Flatline.method.PrayerPosition=4919,66
attrtypes.Flatline=method
0x00001337 0 method.Flatline.PrayerPosition
--
Flatline
  Marigold @ 0x1337 (vtable + 0x42)
Flatline=c
-
attr.Flatline.method=Marigold
attr.Flatline.method.Marigold=4919,66
attrtypes.Flatline=method
0x00001337 0 method.Flatline.Marigold
EOF
RUN

NAME=ac-
FILE=-
CMDS=<<EOF
ac Album
ac PeripheryAlbum
acb PeripheryAlbum Album
ac Flatline
acb Flatline PeripheryAlbum
acm Flatline PrayerPosition 0x1337 0x42
acv Flatline 0x1337

acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes

?e --
ac- Album
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes

?e --
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
?e --
ac- Flatline
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
EOF
EXPECT=<<EOF
Album
Flatline: PeripheryAlbum
  (vtable at 0x1337)
  PrayerPosition @ 0x1337 (vtable + 0x42)
PeripheryAlbum: Album
Album=c
Flatline=c
PeripheryAlbum=c
-
attr.Flatline.base=0
attr.Flatline.base.0=PeripheryAlbum,0
attr.Flatline.method=PrayerPosition
attr.Flatline.method.PrayerPosition=4919,66
attr.Flatline.vtable=0
attr.Flatline.vtable.0=0x1337,0,0
attr.PeripheryAlbum.base=0
attr.PeripheryAlbum.base.0=Album,0
attrtypes.Flatline=base,method,vtable
attrtypes.PeripheryAlbum=base
0x00001337 0 method.Flatline.PrayerPosition
0x00001337 0 vtable.Flatline.0
--
Flatline: PeripheryAlbum
  (vtable at 0x1337)
  PrayerPosition @ 0x1337 (vtable + 0x42)
PeripheryAlbum
Flatline=c
PeripheryAlbum=c
-
attr.Flatline.base=0
attr.Flatline.base.0=PeripheryAlbum,0
attr.Flatline.method=PrayerPosition
attr.Flatline.method.PrayerPosition=4919,66
attr.Flatline.vtable=0
attr.Flatline.vtable.0=0x1337,0,0
attrtypes.Flatline=base,method,vtable
0x00001337 0 method.Flatline.PrayerPosition
0x00001337 0 vtable.Flatline.0
--
Flatline: PeripheryAlbum
  (vtable at 0x1337)
  PrayerPosition @ 0x1337 (vtable + 0x42)
PeripheryAlbum
Flatline=c
PeripheryAlbum=c
-
attr.Flatline.base=0
attr.Flatline.base.0=PeripheryAlbum,0
attr.Flatline.method=PrayerPosition
attr.Flatline.method.PrayerPosition=4919,66
attr.Flatline.vtable=0
attr.Flatline.vtable.0=0x1337,0,0
attrtypes.Flatline=base,method,vtable
0x00001337 0 method.Flatline.PrayerPosition
0x00001337 0 vtable.Flatline.0
--
PeripheryAlbum
PeripheryAlbum=c
-
EOF
RUN

NAME=acb
FILE=-
CMDS=<<EOF
ac PeripherySong
ac NiceSong
ac Flatline
acb Flatline PeripherySong
acb Flatline NiceSong 0x42
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
acb Flatline
EOF
EXPECT=<<EOF
Flatline: PeripherySong, NiceSong
NiceSong
PeripherySong
Flatline=c
NiceSong=c
PeripherySong=c
-
attr.Flatline.base=0,1
attr.Flatline.base.0=PeripherySong,0
attr.Flatline.base.1=NiceSong,66
attrtypes.Flatline=base
Flatline:
     0 PeripherySong @ +0x0
     1 NiceSong @ +0x42
EOF
RUN

NAME=acb-
FILE=-
CMDS=<<EOF
ac PeripherySong
ac NiceSong
ac Flatline
acb Flatline PeripherySong
acb Flatline NiceSong 0x42
acb Flatline
k analysis/classes/*
?e -
k analysis/classes/attrs/*
?e --
acb- Flatline 0
acb Flatline
k analysis/classes/*
?e -
k analysis/classes/attrs/*
EOF
EXPECT=<<EOF
Flatline:
     0 PeripherySong @ +0x0
     1 NiceSong @ +0x42
Flatline=c
NiceSong=c
PeripherySong=c
-
attr.Flatline.base=0,1
attr.Flatline.base.0=PeripherySong,0
attr.Flatline.base.1=NiceSong,66
attrtypes.Flatline=base
--
Flatline:
     1 NiceSong @ +0x42
Flatline=c
NiceSong=c
PeripherySong=c
-
attr.Flatline.base=1
attr.Flatline.base.1=NiceSong,66
attrtypes.Flatline=base
EOF
RUN

NAME=acv
FILE=-
CMDS=<<EOF
ac Deadwing
acv Deadwing 0x1337
acv Deadwing 0xdeadbeef 0x42
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
EOF
EXPECT=<<EOF
Deadwing
  (vtable at 0x1337)
  (vtable at 0xdeadbeef in class at +0x42)
Deadwing=c
-
attr.Deadwing.vtable=0,1
attr.Deadwing.vtable.0=0x1337,0,0
attr.Deadwing.vtable.1=0xdeadbeef,66,0
attrtypes.Deadwing=vtable
0x00001337 0 vtable.Deadwing.0
0xdeadbeef 0 vtable.Deadwing.1
EOF

RUN

NAME=acv-
FILE=-
CMDS=<<EOF
ac Deadwing
acv Deadwing 0x1337
acv Deadwing 0xdeadbeef 0x42
acv Deadwing 0xefefef 0x42 0x20
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
?e --
acv- Deadwing 0
acll
f@F:classes
EOF
EXPECT=<<EOF
Deadwing
  (vtable at 0x1337)
  (vtable at 0xdeadbeef in class at +0x42)
  (vtable at 0xefefef in class at +0x42)
Deadwing=c
-
attr.Deadwing.vtable=0,1,2
attr.Deadwing.vtable.0=0x1337,0,0
attr.Deadwing.vtable.1=0xdeadbeef,66,0
attr.Deadwing.vtable.2=0xefefef,66,32
attrtypes.Deadwing=vtable
0x00001337 0 vtable.Deadwing.0
0x00efefef 32 vtable.Deadwing.2
0xdeadbeef 0 vtable.Deadwing.1
--
Deadwing
  (vtable at 0xdeadbeef in class at +0x42)
  (vtable at 0xefefef in class at +0x42)
0x00efefef 32 vtable.Deadwing.2
0xdeadbeef 0 vtable.Deadwing.1
EOF
RUN

NAME=acn
FILE=-
CMDS=<<EOF
ac Album
ac PorcupineTreeAlbum
acb PorcupineTreeAlbum Album
ac Deadwing
acb Deadwing PorcupineTreeAlbum 0x8
acv PorcupineTreeAlbum 0x1337 0x42
acm PorcupineTreeAlbum Listen 0xdeadbeef
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
?e --
acn PorcupineTreeAlbum Masterpiece
acll
k analysis/classes/*
?e -
k analysis/classes/attrs/*
f@F:classes
EOF
EXPECT=<<EOF
Album
Deadwing: PorcupineTreeAlbum
PorcupineTreeAlbum: Album
  (vtable at 0x1337 in class at +0x42)
  Listen @ 0xdeadbeef
Album=c
Deadwing=c
PorcupineTreeAlbum=c
-
attr.Deadwing.base=0
attr.Deadwing.base.0=PorcupineTreeAlbum,8
attr.PorcupineTreeAlbum.base=0
attr.PorcupineTreeAlbum.base.0=Album,0
attr.PorcupineTreeAlbum.method=Listen
attr.PorcupineTreeAlbum.method.Listen=3735928559,-1
attr.PorcupineTreeAlbum.vtable=0
attr.PorcupineTreeAlbum.vtable.0=0x1337,66,0
attrtypes.Deadwing=base
attrtypes.PorcupineTreeAlbum=base,vtable,method
0x00001337 0 vtable.PorcupineTreeAlbum.0
0xdeadbeef 0 method.PorcupineTreeAlbum.Listen
--
Album
Deadwing: Masterpiece
Masterpiece: Album
  (vtable at 0x1337 in class at +0x42)
  Listen @ 0xdeadbeef
Album=c
Deadwing=c
Masterpiece=c
-
attr.Deadwing.base=0
attr.Deadwing.base.0=Masterpiece,8
attr.Masterpiece.base=0
attr.Masterpiece.base.0=Album,0
attr.Masterpiece.method=Listen
attr.Masterpiece.method.Listen=3735928559,-1
attr.Masterpiece.vtable=0
attr.Masterpiece.vtable.0=0x1337,66,0
attrtypes.Deadwing=base
attrtypes.Masterpiece=base,vtable,method
0x00001337 0 vtable.Masterpiece.0
0xdeadbeef 0 method.Masterpiece.Listen
EOF
RUN

NAME=acl*
FILE=-
CMDS=<<EOF
ac Album
ac PorcupineTreeAlbum
acb PorcupineTreeAlbum Album
ac Deadwing
acb Deadwing PorcupineTreeAlbum 0x8
acv PorcupineTreeAlbum 0x1337 0x42
acm PorcupineTreeAlbum Listen 0xdeadbeef
acl*
EOF
EXPECT=<<EOF
ac Deadwing
ac PorcupineTreeAlbum
ac Album
acb Deadwing PorcupineTreeAlbum 8
acb PorcupineTreeAlbum Album 0
acv PorcupineTreeAlbum 0x1337 66
acm PorcupineTreeAlbum Listen 0xdeadbeef -1
EOF
RUN

NAME=aclj
FILE=-
CMDS=<<EOF
ac PorcupineTreeAlbum
ac Deadwing
acb Deadwing PorcupineTreeAlbum 0x8
acv PorcupineTreeAlbum 0x1337 0x42
acm PorcupineTreeAlbum Listen 0xdeadbeef
aclj
EOF
EXPECT=<<EOF
[{"name":"PorcupineTreeAlbum","bases":[],"vtables":[{"id":"0","addr":4919,"offset":66}],"methods":[{"name":"Listen","addr":3735928559}]},{"name":"Deadwing","bases":[{"id":"0","name":"PorcupineTreeAlbum","offset":8}],"vtables":[],"methods":[]}]
EOF
RUN

NAME=acvf
FILE=bins/elf/analysis/elf-virtualtable
CMDS=<<EOF
ac A
ac B
ac C
acv A 0x00400d28 0x0 0x10
acv B 0x00400d08 0x0 0x10
acv C 0x00400ce8 0x0 0x10
acll
acvf 0x0 A
acvf 0x8 B
acvf 0x16 C dasdass
acvf 0x0
acvf -50
acvf 0x0 000ASDASdjpsadoaspdjasdaspodasDDD
acv A 0x00400d28 0x0
EOF
EXPECT=<<EOF
A
  (vtable at 0x400d28)
B
  (vtable at 0x400d08)
C
  (vtable at 0x400ce8)
Function address: 0x00400ac8, in A vtable 0
Function address: 0x00400b82, in B vtable 0
Function address: 0x00400ac8, in A vtable 0
Function address: 0x00400ac8, in B vtable 0
Function address: 0x00400ac8, in C vtable 0
EOF
RUN
