NAME=java prototypes in json
FILE=../bins/java/jdwpexeccmd.class
EXPECT='{"access_flags":33,"is_public":1,"is_final":0,"is_super":1,"is_interface":0,"is_abstract":0,"is_synthetic":0,"is_annotation":0,"is_enum":0,"name":"JDWPExecCmd","super":"java/lang/Object","interfaces":[],"methods":[],"fields":[],"imports":[]}
'
CMDS=<<EOF
java prototypes j
EOF
RUN

NAME=java prototypes in ascii
FILE=../bins/java/jdwpexeccmd.class
CMDS=<<EOF
java prototypes a
EOF
EXPECT=<<EOF
import java.lang.StringBuilder;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.Exception;
import JDWPExecCmd;
import java.lang.Object;
import java.lang.String;
import java.lang.Process;
import java.io.BufferedReader;
import java.lang.Exception;
import java.lang.Runtime;
import java.lang.Process;
import java.lang.String;

class JDWPExecCmd { // @0x0000

  // Methods defined in the class
  public void <init> (); // @0x0323
  public static java.lang.String run (java.lang.String); // @0x034e
}
EOF
RUN

NAME=java huge switch case crash
FILE=../../bins/java/sjybq.class
CMDS=<<EOF
e asm.arch=java e scr.null=true pd 200
EOF
EXPECT=<<EOF
EOF
RUN

NAME=use java prototypes command to print methods and fields
FILE=malloc://4096
CMDS=<<EOF
e asm.comments=false ; e asm.cmt.flgrefs=false ; e scr.color=false ; e asm.lines.bb=false ; e asm.xrefs=false ; wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000 ; ib ; af ; java prototypes m ; java prototypes f
EOF
EXPECT=<<EOF
public void <init> (); // @0x02eb
public static java.lang.String a (java.lang.String); // @0x030a
private static java.lang.String a (java.lang.String, java.lang.String, java.lang.String); // @0x033b
private static java.lang.String a (java.lang.String, java.lang.String); // @0x0425
static void <clinit> (); // @0x04ef
private static java.lang.String a; // @0x02d1
private static java.lang.String b; // @0x02d9
private static java.lang.String c; // @0x02e1
EOF
RUN

NAME=use java calc_flags command to calculate java flags
FILE=malloc://4096
CMDS=<<EOF
e asm.comments=false
e asm.cmt.flgrefs=false
e scr.color=false
e asm.lines.bb=false
e asm.xrefs=false
wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000
ib
af;
java calc_flags l;
java calc_flags m static private;
java calc_flags m static public;
java calc_flags c super static public abstract;
EOF
EXPECT=<<EOF
[=] Class Access Flags List
public = 0x0001
undefined.0x0002 = 0x0002
undefined.0x0004 = 0x0004
undefined.0x0008 = 0x0008
final = 0x0010
super = 0x0020
undefined.0x0040 = 0x0040
undefined.0x0080 = 0x0080
undefined.0x0100 = 0x0100
interface = 0x0200
abstract = 0x0400
undefined.0x0800 = 0x0800
synthetic = 0x1000
annotation = 0x2000
enum = 0x4000
undefined.0x8000 = 0x8000
[=] Methods Access Flags List
public = 0x0001
private = 0x0002
protected = 0x0004
static = 0x0008
final = 0x0010
synchronized = 0x0020
bridge = 0x0040
varargs = 0x0080
native = 0x0100
interface = 0x0200
abstract = 0x0400
strict = 0x0800
synthetic = 0x1000
annotation = 0x2000
enum = 0x4000
undefined.0x8000 = 0x8000
[=] Fields Access Flags List
public = 0x0001
private = 0x0002
protected = 0x0004
static = 0x0008
final = 0x0010
undefined.0x0020 = 0x0020
volatile = 0x0040
transient = 0x0080
undefined.0x0100 = 0x0100
undefined.0x0200 = 0x0200
undefined.0x0400 = 0x0400
undefined.0x0800 = 0x0800
synthetic = 0x1000
undefined.0x2000 = 0x2000
enum = 0x4000
undefined.0x8000 = 0x8000
Access Value for static private = 0x000a
Access Value for static public = 0x0009
Access Value for super static public abstract = 0x0421
EOF
RUN

NAME=use java set_flags and flags_str_at to reset the access flag on class file entities
FILE=malloc://4096
CMDS=<<EOF
e asm.comments=false
e asm.cmt.flgrefs=false
e scr.color=false
e asm.lines.bb=false
e asm.xrefs=false
wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000
ib;af;
s 0x425; p8 2;
java flags_str_at m 0x425
java set_flags 0x425 0x009
p8 2;
java flags_str_at m 0x425
EOF
EXPECT=<<EOF
000a
Method Access Flags String: private static
0009
Method Access Flags String: public static
EOF
RUN

NAME=use java to get constant pool objects
FILE=malloc://4096
CMDS=<<EOF
e asm.comments=false
e asm.cmt.flgrefs=false
e scr.color=false
e asm.lines.bb=false
e asm.xrefs=false
wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000
ib;af;
java resolve_cp k 5
java resolve_cp e 5
java resolve_cp c 5
java resolve_cp e 58
java resolve_cp a 58
java resolve_cp k 58
java resolve_cp c 58
EOF
EXPECT=<<EOF
5.0x0016.Class.54
amF2YS9sYW5nL0V4Y2VwdGlvbg==
java/lang/Exception
a3dpY3M1amU=
0x286
58.0x0286.Utf8.8.6b77696373356a65
"kwics5je"
EOF
RUN

NAME=af java multiple classes loaded via malloc and ib
BROKEN=11
FILE=malloc://1024
CMDS=<<EOF
e asm.calls=false
e asm.comments=false
e asm.cmt.flgrefs=false
e scr.color=false
e asm.lines.bb=false
e asm.xrefs=false
e asm.flags.middle=0
wx cafebabe00000033001707000201001b7261646172655f746573745f63617365732f6368616c6c656e67650700040100106a6176612f6c616e672f4f626a6563740100063c696e69743e010003282956010004436f64650a000300090c0005000601000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c650100047468697301001d4c7261646172655f746573745f63617365732f6368616c6c656e67653b01001573696d706c655f636173655f73746d745f3476616c01000328294901000169010001490100016a0100016b01000d537461636b4d61705461626c6501000a536f7572636546696c6501000e6368616c6c656e67652e6a617661002100010003000000000002000100050006000100070000002f00010001000000052ab70008b100000002000a00000006000100000003000b0000000c000100000005000c000d00000008000e000f00010007000000c10002000300000048033b033ca7003c1a08703d1caa0000000000003200000000000000030000002000000026000000320000002c840202a70011840203a7000b840209a70005033c1a100aa1ffc41bac00000003000a0000002a000a000000050004000600070007000b0008002c00090032000a0038000b003e000c004000060046000f000b0000002000030002004600100011000000040044001200110001000b00350013001100020014000000110006fd00070101fc002401050505fa000100010015000000020016
ib;if;
pd 3 @ sym.java_lang_Object._init_
# pd 20 @ s sym.radare_test_cases_challenge.simple_case_stmt_4val
o malloc://1024 0xa00~a
s 0xa00
wx cafebabe0000003300180700020100177261646172655f746573745f63617365732f6c6f6f70730700040100106a6176612f6c616e672f4f626a6563740100063c696e69743e010003282956010004436f64650a000300090c0005000601000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c65010004746869730100194c7261646172655f746573745f63617365732f6c6f6f70733b01000f73696d706c655f666f725f6c6f6f7001000328294201000169010001490100016a0100016b01000d537461636b4d61705461626c6501001c73696d706c655f666f725f6c6f6f705f6d756c74695f72657475726e01000a536f7572636546696c6501000a6c6f6f70732e6a617661002100010003000000000003000100050006000100070000002f00010001000000052ab70008b100000002000a00000006000100000003000b0000000c000100000005000c000d00000008000e000f000100070000006c0002000300000017033d033b043d10643ca700068400011a1ba1fffb1c91ac00000003000a0000000e000300000006000200080014000b000b000000200003000400130010001100000009000e001200110001000200150013001100020014000000090002fe000c0101010200080015000f0001000700000095000200030000002b033d033b043d10643ca7001a1c1a823d1c1100ffa000061c91ac1c1100ff703d8400011a1ba1ffe71c91ac00000003000a0000002200080000000e00020010000c00110010001300170014001a00150020001000280018000b00000020000300040027001000110000000900220012001100010002002900130011000200140000000a0003fe000c0101010d0800010016000000020017
oba 0xa00
pdf
ib
af
pdf
# s sym.radare_test_cases_challenge.simple_case_stmt_4val; pdf
# pd 3 @ entry1
# pd 3 @ entry2
EOF
EXPECT=<<EOF
fd       42
file     malloc://1024
size     0x400
humansz  1K
mode     -rwx
format   java
iorw     true
blksz    0x0
block    0x100
type     JAVA CLASS
arch     java
binsz    1024
bintype  class
bits     32
canary   false
class    0x3300 0x0000
crypto   false
endian   little
havecode true
lang     java
linenum  true
lsyms    true
machine  jvm
nx       false
os       any
pic      false
relocs   false
static   false
stripped false
subsys   any
va       false
  ;-- entry0:
  ;-- sym.java_lang_Object._init_:
  ;-- method.radare_test_cases_challenge._init_:
 0x0000012d      2a             aload_0
 0x0000012e      b70008         invokespecial java/lang/Object/<init>()V
 0x00000131      b1             return
  ;-- entry1:
  ;-- sym.radare_test_cases_challenge.simple_case_stmt_4val:
  ;-- method.radare_test_cases_challenge.simple_case_stmt_4val:
 0x0000016a      03             iconst_0
 0x0000016b      3b             istore_0
 0x0000016c      03             iconst_0
 0x0000016d      3c             istore_1
 0x0000016e      a7003c         goto 0x01aa
 0x00000171      1a             iload_0
 0x00000172      08             iconst_5
 0x00000173      70             irem
 0x00000174      3d             istore_2
 0x00000175      1c             iload_2
 0x00000176      aa0000000000.  tableswitch default: 0x01a8
 0x00000186      00000020       case 0: goto 0x0196
 0x0000018a      00000026       case 1: goto 0x019c
 0x0000018e      00000032       case 2: goto 0x01a8
 0x00000192      0000002c       case 3: goto 0x01a2
 0x00000196      840202         iinc 2 2
 0x00000199      a70011         goto 0x01aa
 0x0000019c      840203         iinc 2 3
 0x0000019f      a7000b         goto 0x01aa
 0x000001a2      840209         iinc 2 9
 0x000001a5      a70005         goto 0x01aa
 0x000001a8      03             iconst_0
 0x000001a9      3c             istore_1
 0x000001aa      1a             iload_0
 0x000001ab      100a           bipush 10
 0x000001ad      a1ffc4         if_icmplt 0x0171
 0x000001b0      1b             iload_1
 0x000001b1      ac             ireturn
  ;-- entry2:
  ;-- method.radare_test_cases_loops.simple_for_loop_multi_return:
/ (fcn) sym.radare_test_cases_loops.simple_for_loop_multi_return 43
| 0x000001f1      46             fstore_3
| 0x000001f2      00             nop
| 0x000001f3      1000           bipush 0
| 0x000001f5      110000         sipush 0
| 0x000001f8      00             nop
| 0x000001f9      04             iconst_1
| 0x000001fa      00             nop
| 0x000001fb      44             fstore_1
| 0x000001fc      00             nop
| 0x000001fd      1200           ldc (null)
| 0x000001ff      110001         sipush 1
| 0x00000202      00             nop
| 0x00000203      0b             fconst_0
| 0x00000204      00             nop
| 0x00000205      35             saload
| 0x00000206      00             nop
| 0x00000207      130011         ldc_w "I"
| 0x0000020a      00             nop
| 0x0000020b      02             iconst_m1
| 0x0000020c      00             nop
| 0x0000020d      140000         ldc2_w (null)
| 0x00000210      00             nop
| 0x00000211      110006         sipush 6
| 0x00000214      fd             UNDEFINED
| 0x00000215      00             nop
| 0x00000216      07             iconst_4
| 0x00000217      01             aconst_null
| 0x00000218      01             aconst_null
| 0x00000219      fc             UNDEFINED
| 0x0000021a      00             nop
\ 0x0000021b      24             fload_2
  ;-- method.radare_test_cases_challenge.simple_case_stmt_4val:
/ (fcn) sym.radare_test_cases_challenge.simple_case_stmt_4val 72
| 0x0000016a      03             iconst_0
| 0x0000016b      3b             istore_0
| 0x0000016c      03             iconst_0
| 0x0000016d      3c             istore_1
| 0x0000016e      a7003c         goto 0x01aa
| ;-- section_end.attrs._init_:
| 0x00000171      1a             iload_0
| 0x00000172      08             iconst_5
| 0x00000173      70             irem
| 0x00000174      3d             istore_2
| 0x00000175      1c             iload_2
| 0x00000176      aa0000000000.  tableswitch default: 0x01a8
| 0x00000186      00000020       case 0: goto 0x0196
| 0x0000018a      00000026       case 1: goto 0x019c
| 0x0000018e      00000032       case 2: goto 0x01a8
| 0x00000192      0000002c       case 3: goto 0x01a2
| 0x00000196      840202         iinc 2 2
| 0x00000199      a70011         goto 0x01aa
| 0x0000019c      840203         iinc 2 3
| 0x0000019f      a7000b         goto 0x01aa
| 0x000001a2      840209         iinc 2 9
| 0x000001a5      a70005         goto 0x01aa
| 0x000001a8      03             iconst_0
| 0x000001a9      3c             istore_1
| 0x000001aa      1a             iload_0
| 0x000001ab      100a           bipush 10
| 0x000001ad      a1ffc4         if_icmplt section_end.attrs._init_
| 0x000001b0      1b             iload_1
\ 0x000001b1      ac             ireturn
EOF
RUN

NAME=java summary
FILE=zip://../bins/java/example.zip::0
CMDS=<<EOF
java summary
EOF
EXPECT=<<EOF
Summary for zip://../bins/java/example.zip::0:
  Size 0x0:
  Constants  size: 0x275 count: 69:
  Methods    size: 0x24e count: 4:
  Fields     size: 0x12 count: 2:
  Attributes size: 0xa count: 1:
  Interfaces size: 0x2 count: 0:
EOF
RUN

NAME=java prototypes a
FILE=zip://../bins/java/example.zip::0
CMDS=<<EOF
java prototypes a
EOF
EXPECT=<<EOF
import java.lang.Object;
import java.lang.String;
import c;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import a;
import java.lang.NumberFormatException;
import [C;

class c { // @0x0000

  // Fields defined in the class
  public static boole; // @0x0287
  private static final java.lang.String z; // @0x028f

  // Methods defined in the class
  public void <init> (); // @0x0299
  public static java.lang.String a (java.lang.String); // @0x02c4
  public static java.lang.String b (java.lang.String); // @0x02fc
  static void <clinit> (); // @0x0395
}
EOF
RUN

NAME=java m_info s
FILE=zip://../bins/java/example.zip::0
CMDS=<<EOF
s 0x312
java m_info s
EOF
EXPECT=<<EOF
Method Summary Information:
  File Offset: 0x00000299
  Name Index: 24 (<init>)
  Descriptor Index: 19 (()V)
  Access Flags: 0x01 (public)
  Method Attributes Count: 1
  Method Attributes:
Code Attribute Information:
  Attribute Offset: 0x000002a1
  Attribute Name Index: 26 (Code)
  Attribute Length: 29, Attribute Count: 1
    Max Stack: 1
    Max Locals: 1
    Code Length: 5
    Code At Offset: 0x000002af
Code Attribute Exception Table Information:
  Exception Table Length: 0
  Implicit Method Stack Frame:
Stack Map Frame Information
  Tag Value = 0x00 Name: ImplicitStackFrame
  Offset: 0x00000000
  Local Variable Count = 0x0000
  Stack Items Count = 0x0000
  Local Variables:
  Stack Items:
Code Attribute Attributes Information:
  Code Attribute Attributes Count: 1
Line Number Table Attribute Information:
  Attribute Offset: 0x000002b8
  Attribute Name Index: 27 (LineNumberTable)
  Attribute Length: 6
  Line Number Attribute Offset: 0x000002c0
  Line Number Attribute StartPC: 0
  Line Number Attribute LineNumber: 7
EOF
RUN

NAME=java f_info s
FILE=zip://../bins/java/example.zip::0
CMDS=<<EOF
java f_info s
EOF
EXPECT=<<EOF
Field Summary Information:
  File Offset: 0x00000287
  Name Index: 40 (a)
  Descriptor Index: 41 (Z)
  Access Flags: 0x09 (public static)
  Field Attributes Count: 0
  Field Attributes:
EOF
RUN

NAME=java simple switch statement 4 values no breaks
FILE=malloc://128
CMDS=<<EOF
e asm.arch=java
wx 033b043ca700371a08703d1caa00000000000029000000000000000300000020000000230000002900000026840202840203840209033c1b1c823c1a100aa1ffc91bac
pi 29 @ 0
EOF
EXPECT=<<EOF
iconst_0
istore_0
iconst_1
istore_1
goto 0x003b
iload_0
iconst_5
irem
istore_2
iload_2
tableswitch default: 0x0035
case 0: goto 0x002c
case 1: goto 0x002f
case 2: goto 0x0035
case 3: goto 0x0032
iinc 2 2
iinc 2 3
iinc 2 9
iconst_0
istore_1
iload_1
iload_2
ixor
istore_1
iload_0
bipush 10
if_icmplt 0x0007
iload_1
ireturn
EOF
RUN

NAME=java simple switch statement 3 values no breaks
FILE=malloc://128
CMDS=<<EOF
e asm.arch=java
wx 033b043ca7002c1a08703d1caa0000000000001e0000000000000001000000180000001b8402fe8402ff033c1b1c823c1a100aa1ffd41bac00000003000a0000
pi 26 @ 0
EOF
EXPECT=<<EOF
iconst_0
istore_0
iconst_1
istore_1
goto 0x0030
iload_0
iconst_5
irem
istore_2
iload_2
tableswitch default: 0x002a
case 0: goto 0x0024
case 1: goto 0x0027
iinc 2 254
iinc 2 255
iconst_0
istore_1
iload_1
iload_2
ixor
istore_1
iload_0
bipush 10
if_icmplt 0x0007
iload_1
ireturn
EOF
RUN

NAME=java simple switch statement 4 values
FILE=malloc://128
CMDS=<<EOF
e asm.arch=java
wx 033b033ca7003c1a08703d1caa0000000000003200000000000000030000002000000026000000320000002c840202a70011840203a7000b840209a70005033c1a100aa1ffc41bac00000003000a0000
pi 28 @ 0
EOF
EXPECT=<<EOF
iconst_0
istore_0
iconst_0
istore_1
goto 0x0040
iload_0
iconst_5
irem
istore_2
iload_2
tableswitch default: 0x003e
case 0: goto 0x002c
case 1: goto 0x0032
case 2: goto 0x003e
case 3: goto 0x0038
iinc 2 2
goto 0x0040
iinc 2 3
goto 0x0040
iinc 2 9
goto 0x0040
iconst_0
istore_1
iload_0
bipush 10
if_icmplt 0x0007
iload_1
ireturn
EOF
RUN

NAME=java simple switch statement 3 values
FILE=malloc://128
CMDS=<<EOF
e asm.arch=java
wx 033b033ca7003c1a08703d1caa0000000000003200000000000000030000002000000026000000320000002c840202a70011840203a7000b840209a70005033c1a100aa1ffc41bac00000003000a0000
pi 28 @ 0
EOF
EXPECT=<<EOF
iconst_0
istore_0
iconst_0
istore_1
goto 0x0040
iload_0
iconst_5
irem
istore_2
iload_2
tableswitch default: 0x003e
case 0: goto 0x002c
case 1: goto 0x0032
case 2: goto 0x003e
case 3: goto 0x0038
iinc 2 2
goto 0x0040
iinc 2 3
goto 0x0040
iinc 2 9
goto 0x0040
iconst_0
istore_1
iload_0
bipush 10
if_icmplt 0x0007
iload_1
ireturn
EOF
RUN