Compare commits
3 commits
cedcca2f98
...
ea60f37957
Author | SHA1 | Date | |
---|---|---|---|
ea60f37957 | |||
bbbd60ce0a | |||
9eaafb50fb |
5 changed files with 38 additions and 15 deletions
1
.idea/.name
Normal file
1
.idea/.name
Normal file
|
@ -0,0 +1 @@
|
||||||
|
bf
|
|
@ -4,7 +4,7 @@
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
24
src/main/java/dev/ashhhleyyy/bad/ClassInspector.java
Normal file
24
src/main/java/dev/ashhhleyyy/bad/ClassInspector.java
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package dev.ashhhleyyy.bad;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class ClassInspector {
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
if (args.length < 1) {
|
||||||
|
System.err.println("Usage: <class>");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
String path = args[0];
|
||||||
|
byte[] data = Files.readAllBytes(Path.of(path));
|
||||||
|
ClassReader reader = new ClassReader(data);
|
||||||
|
ClassNode cls = new ClassNode(Opcodes.ASM9);
|
||||||
|
reader.accept(cls, 0);
|
||||||
|
System.out.println("Set breakpoint here.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,22 +3,10 @@ package dev.ashhhleyyy.bad.framework;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.objectweb.asm.Handle;
|
||||||
import org.objectweb.asm.Label;
|
import org.objectweb.asm.Label;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
import org.objectweb.asm.tree.*;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
import org.objectweb.asm.tree.FieldInsnNode;
|
|
||||||
import org.objectweb.asm.tree.IincInsnNode;
|
|
||||||
import org.objectweb.asm.tree.InsnNode;
|
|
||||||
import org.objectweb.asm.tree.IntInsnNode;
|
|
||||||
import org.objectweb.asm.tree.JumpInsnNode;
|
|
||||||
import org.objectweb.asm.tree.LabelNode;
|
|
||||||
import org.objectweb.asm.tree.LdcInsnNode;
|
|
||||||
import org.objectweb.asm.tree.LocalVariableNode;
|
|
||||||
import org.objectweb.asm.tree.MethodInsnNode;
|
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
|
||||||
import org.objectweb.asm.tree.TypeInsnNode;
|
|
||||||
import org.objectweb.asm.tree.VarInsnNode;
|
|
||||||
|
|
||||||
public final class BytecodeBuilder {
|
public final class BytecodeBuilder {
|
||||||
private final ClassNode classNode;
|
private final ClassNode classNode;
|
||||||
|
@ -163,6 +151,10 @@ public final class BytecodeBuilder {
|
||||||
this.add(new MethodInsnNode(Opcodes.INVOKESTATIC, owner, name, desc));
|
this.add(new MethodInsnNode(Opcodes.INVOKESTATIC, owner, name, desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void invokedynamic(String name, String descriptor, Handle bsm, Object... bsmArgs) {
|
||||||
|
this.add(new InvokeDynamicInsnNode(name, descriptor, bsm, bsmArgs));
|
||||||
|
}
|
||||||
|
|
||||||
private LabelNode getCurrentLabel() {
|
private LabelNode getCurrentLabel() {
|
||||||
if (this.currentLabel != null) {
|
if (this.currentLabel != null) {
|
||||||
return this.currentLabel;
|
return this.currentLabel;
|
||||||
|
|
Loading…
Reference in a new issue