NAME=ic dot
FILE=bins/mach0/BatteryLife.arm_64.1
CMDS=<<EOF
s 0x1000fbef0
ic.
fd
pd 3
EOF
EXPECT=<<EOF
GADDevice::jailbroken
method.GADDevice.jailbroken
            ;-- method.GADDevice.jailbroken:
            ;-- func.1000fbef0:
            0x1000fbef0      f44fbea9       stp x20, x19, [sp, -0x20]!
            0x1000fbef4      fd7b01a9       stp x29, x30, [sp, 0x10]
            0x1000fbef8      fd430091       add x29, sp, 0x10
EOF
RUN

NAME=ic swift
FILE=bins/mach0/main-inherit
CMDS=<<EOF
ic
?e ---
icc
?e ---
icj~{}
EOF
EXPECT=<<EOF
0x100003e44 [0x10000366c - 0x1000039bc]    848 swift class 0 main.Employee
0x10000366c swift   method   0      name
0x1000036c4 swift   method   1      name
0x100003730 swift   method   2      name
0x1000037ac swift   method   3      message
0x100003984 swift   method   4 sC   init
0x100003918 swift   method   5      deinit
0x100003948 swift   method   6      deinit
0x1000039bc swift   method   7 C    init
0x100003f44 swift property   0      name
0x100003eac [0x100003a5c - 0x100003bec]    400 swift class 1 main.Employer :: main.Employee
0x100003a5c swift   method   0      main
0x100003b40 swift   method   1 C    init
0x100003b78 swift   method   2 C    init
0x100003bc4 swift   method   3      deinit
0x100003bec swift   method   4      deinit
0x100003e04 [0x100003e04 - 0x100003e04]      0 swift class 2 main.Greet
0x100008148 [0x100008148 - 0x100008148]      0 objc class 3 main.Employee :: Swift._SwiftObject
0x00000000 objc      var   0      isa
0x100003e30 objc      var   1      name
0x100008200 [0x100008200 - 0x100008200]      0 objc class 4 main.Employer :: main.Employee
0x00000000 [0x100003f04 - 0x100003f04]      0 ? class 5 Greet
0x100003f04 ?   method   0      symbolic main.Greet.
0x00000000 [0x100003f14 - 0x100003f14]      0 ? class 6 Employee
0x100003f14 ?   method   0      symbolic main.Employee.allocator
0x00000000 [0x100003f1e - 0x100003f1e]      0 ? class 7 Employer
0x100003f1e ?   method   0      symbolic main.Employer.allocator
---
class main.Employee {
  var name : Swift.String
  var name { get }  // 0x10000366c
  var name { set }  // 0x1000036c4
  func name() {}  // 0x100003730
  func message() {}  // 0x1000037ac
  init()  // 0x100003984
  func deinit() {}  // 0x100003918
  func deinit() {}  // 0x100003948
  init()  // 0x1000039bc
}
class main.Employer : main.Employee {
  func main() {}  // 0x100003a5c
  init()  // 0x100003b40
  init()  // 0x100003b78
  func deinit() {}  // 0x100003bc4
  func deinit() {}  // 0x100003bec
}
protocol main.Greet {
}
@objc
class main.Employee : Swift._SwiftObject {
  var isa : struct objc_class *
  var name
}
@objc
class main.Employer : main.Employee {
}
class Greet {
  func symbolic main.Greet.() {}  // 0x100003f04
}
class Employee {
  func symbolic main.Employee.allocator() {}  // 0x100003f14
}
class Employer {
  func symbolic main.Employer.allocator() {}  // 0x100003f1e
}
---
[
  {
    "classname": "main.Employee",
    "addr": 4294983236,
    "lang": "swift",
    "index": 0,
    "methods": [
      {
        "name": "name",
        "flag": "method.getter.main.Employee.name",
        "flags": [
          "getter"
        ],
        "rawname": "_$s4main8EmployeeC4nameSSvg",
        "lang": "swift",
        "addr": 4294981228
      },
      {
        "name": "name",
        "flag": "method.setter.main.Employee.name",
        "flags": [
          "setter"
        ],
        "rawname": "_$s4main8EmployeeC4nameSSvs",
        "lang": "swift",
        "addr": 4294981316
      },
      {
        "name": "name",
        "flag": "method.main.Employee.name",
        "rawname": "_$s4main8EmployeeC4nameSSvM",
        "lang": "swift",
        "addr": 4294981424
      },
      {
        "name": "message",
        "flag": "method.main.Employee.message",
        "rawname": "_$s4main8EmployeeC7messageyyF",
        "lang": "swift",
        "addr": 4294981548
      },
      {
        "name": "init",
        "flag": "method.static.constructor.main.Employee.init",
        "flags": [
          "static constructor"
        ],
        "rawname": "_$s4main8EmployeeCACycfC",
        "lang": "swift",
        "addr": 4294982020
      },
      {
        "name": "deinit",
        "flag": "func.100003918",
        "rawname": "$s4main8EmployeeCfd",
        "lang": "swift",
        "addr": 4294981912
      },
      {
        "name": "deinit",
        "flag": "method.main.Employee.deinit",
        "rawname": "$s4main8EmployeeCfD",
        "lang": "swift",
        "addr": 4294981960
      },
      {
        "name": "init",
        "flag": "method.constructor.main.Employee.init",
        "flags": [
          "constructor"
        ],
        "rawname": "$s4main8EmployeeCACycfc",
        "lang": "swift",
        "addr": 4294982076
      }
    ],
    "fields": [
      {
        "name": "name",
        "kind": "property",
        "type": "Swift.String",
        "addr": 4294983492
      }
    ]
  },
  {
    "classname": "main.Employer",
    "addr": 4294983340,
    "lang": "swift",
    "index": 1,
    "super": [
      "main.Employee"
    ],
    "rawsuper": [
      "main.Employee"
    ],
    "methods": [
      {
        "name": "main",
        "flag": "method.main.Employer.main",
        "rawname": "_$s4main8EmployerCAAyyF",
        "lang": "swift",
        "addr": 4294982236
      },
      {
        "name": "init",
        "flag": "func.100003b40",
        "flags": [
          "constructor"
        ],
        "rawname": "$s4main8EmployerCACycfC",
        "lang": "swift",
        "addr": 4294982464
      },
      {
        "name": "init",
        "flag": "method.constructor.main.Employer.init",
        "flags": [
          "constructor"
        ],
        "rawname": "$s4main8EmployerCACycfc",
        "lang": "swift",
        "addr": 4294982520
      },
      {
        "name": "deinit",
        "flag": "func.100003bc4",
        "rawname": "$s4main8EmployerCfd",
        "lang": "swift",
        "addr": 4294982596
      },
      {
        "name": "deinit",
        "flag": "method.main.Employer.deinit",
        "rawname": "$s4main8EmployerCfD",
        "lang": "swift",
        "addr": 4294982636
      }
    ]
  },
  {
    "classname": "main.Greet",
    "addr": 4294983172,
    "lang": "swift",
    "attr": [
      "interface"
    ],
    "index": 2
  },
  {
    "classname": "main.Employee",
    "rawclassname": "main.Employee_1",
    "addr": 4295000392,
    "lang": "objc",
    "attr": [
      "public"
    ],
    "index": 3,
    "super": [
      "Swift._SwiftObject"
    ],
    "rawsuper": [
      "_OBJC_CLASS_$__TtCs12_SwiftObject"
    ],
    "fields": [
      {
        "name": "isa",
        "kind": "var",
        "type": "struct objc_class *",
        "size": 8,
        "addr": 0
      },
      {
        "name": "name",
        "kind": "var",
        "offset": 16,
        "addr": 4294983216
      }
    ]
  },
  {
    "classname": "main.Employer",
    "rawclassname": "main.Employer_1",
    "addr": 4295000576,
    "lang": "objc",
    "attr": [
      "public"
    ],
    "index": 4,
    "super": [
      "main.Employee"
    ],
    "rawsuper": [
      "_TtC4main8Employee"
    ]
  },
  {
    "classname": "Greet",
    "addr": 0,
    "index": 5,
    "methods": [
      {
        "name": "symbolic main.Greet.",
        "flag": "method.Greet.symbolic_main.Greet.",
        "rawname": "_symbolic $s4main5GreetP",
        "addr": 4294983428
      }
    ]
  },
  {
    "classname": "Employee",
    "addr": 0,
    "index": 6,
    "methods": [
      {
        "name": "symbolic main.Employee.allocator",
        "flag": "method.Employee.symbolic_main.Employee.allocator",
        "rawname": "_symbolic _____ 4main8EmployeeC",
        "addr": 4294983444
      }
    ]
  },
  {
    "classname": "Employer",
    "addr": 0,
    "index": 7,
    "methods": [
      {
        "name": "symbolic main.Employer.allocator",
        "flag": "method.Employer.symbolic_main.Employer.allocator",
        "rawname": "_symbolic _____ 4main8EmployerC",
        "addr": 4294983454
      }
    ]
  }
]
EOF
RUN

NAME=icqq swift
FILE=bins/mach0/main-inherit
CMDS=<<EOF
icqq
EOF
EXPECT=<<EOF
main.Employee
main.Employer
main.Greet
main.Employee
main.Employer
Greet
Employee
Employer
EOF
RUN

NAME=icq swift
FILE=bins/mach0/main-inherit
CMDS=<<EOF
icq
EOF
EXPECT=<<EOF
0x100003e44 [0x10000366c - 0x1000039bc] swift main.Employee
0x100003eac [0x100003a5c - 0x100003bec] swift main.Employer main.Employee
0x100003e04 [0x100003e04 - 0x100003e04] swift main.Greet
0x100008148 [0x100008148 - 0x100008148] objc main.Employee Swift._SwiftObject
0x100008200 [0x100008200 - 0x100008200] objc main.Employer main.Employee
0x00000000 [0x100003f04 - 0x100003f04] ? Greet
0x00000000 [0x100003f14 - 0x100003f14] ? Employee
0x00000000 [0x100003f1e - 0x100003f1e] ? Employer
EOF
RUN
