52 Disassembler dis = new Disassembler(startPc, code);
53 dis.decode(visitor);
54 }
55
56 private Disassembler(long startPc, byte[] code) {
57 this.startPc = startPc;
58 this.code = code;
59
60 // Lazily load hsdis
61 if (decode_function == 0) {
62 StringBuilder path = new StringBuilder(System.getProperty("java.home"));
63 String sep = System.getProperty("file.separator");
64 String os = System.getProperty("os.name");
65 String libname = "hsdis";
66 String arch = System.getProperty("os.arch");
67 if (os.lastIndexOf("Windows", 0) != -1) {
68 if (arch.equals("x86")) {
69 libname += "-i386";
70 } else if (arch.equals("amd64")) {
71 libname += "-amd64";
72 } else {
73 libname += "-" + arch;
74 }
75 path.append(sep + "bin" + sep);
76 libname += ".dll";
77 } else if (os.lastIndexOf("Linux", 0) != -1) {
78 if (arch.equals("x86") || arch.equals("i386")) {
79 path.append(sep + "lib" + sep + "i386" + sep);
80 libname += "-i386.so";
81 } else if (arch.equals("amd64") || arch.equals("x86_64")) {
82 path.append(sep + "lib" + sep + "amd64" + sep);
83 libname += "-amd64.so";
84 } else {
85 path.append(sep + "lib" + sep + arch + sep);
86 libname += "-" + arch + ".so";
87 }
88 } else if (os.lastIndexOf("Mac OS X", 0) != -1) {
89 path.append(sep + "lib" + sep);
90 libname += "-amd64" + ".dylib"; // x86_64 => amd64
91 } else {
|
52 Disassembler dis = new Disassembler(startPc, code);
53 dis.decode(visitor);
54 }
55
56 private Disassembler(long startPc, byte[] code) {
57 this.startPc = startPc;
58 this.code = code;
59
60 // Lazily load hsdis
61 if (decode_function == 0) {
62 StringBuilder path = new StringBuilder(System.getProperty("java.home"));
63 String sep = System.getProperty("file.separator");
64 String os = System.getProperty("os.name");
65 String libname = "hsdis";
66 String arch = System.getProperty("os.arch");
67 if (os.lastIndexOf("Windows", 0) != -1) {
68 if (arch.equals("x86")) {
69 libname += "-i386";
70 } else if (arch.equals("amd64")) {
71 libname += "-amd64";
72 } else if (arch.equals("aarch64")) {
73 libname += "-arm64";
74 } else {
75 libname += "-" + arch;
76 }
77 path.append(sep + "bin" + sep);
78 libname += ".dll";
79 } else if (os.lastIndexOf("Linux", 0) != -1) {
80 if (arch.equals("x86") || arch.equals("i386")) {
81 path.append(sep + "lib" + sep + "i386" + sep);
82 libname += "-i386.so";
83 } else if (arch.equals("amd64") || arch.equals("x86_64")) {
84 path.append(sep + "lib" + sep + "amd64" + sep);
85 libname += "-amd64.so";
86 } else {
87 path.append(sep + "lib" + sep + arch + sep);
88 libname += "-" + arch + ".so";
89 }
90 } else if (os.lastIndexOf("Mac OS X", 0) != -1) {
91 path.append(sep + "lib" + sep);
92 libname += "-amd64" + ".dylib"; // x86_64 => amd64
93 } else {
|