dashg-commit Mailing List for dashg
Status: Pre-Alpha
Brought to you by:
dbrosius
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(40) |
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dbr...@us...> - 2010-06-09 06:02:07
|
Revision: 50 http://dashg.svn.sourceforge.net/dashg/?rev=50&view=rev Author: dbrosius Date: 2010-06-09 06:02:01 +0000 (Wed, 09 Jun 2010) Log Message: ----------- warnings Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2010-01-02 05:11:06 UTC (rev 49) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2010-06-09 06:02:01 UTC (rev 50) @@ -26,16 +26,16 @@ import org.objectweb.asm.Attribute; import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.util.TraceClassVisitor; +import org.objectweb.asm.util.AbstractVisitor; public class DashGMethodSourcePrintingVisitor implements MethodVisitor { private static final String BLANKS = " "; - private MethodVisitor mv; - private PrintWriter pw; - private DashGLineNumberer ln; - private Map<String, Integer> labelsToOffset; + private final MethodVisitor mv; + private final PrintWriter pw; + private final DashGLineNumberer ln; + private final Map<String, Integer> labelsToOffset; public DashGMethodSourcePrintingVisitor(MethodVisitor mVisitor, PrintWriter pWriter, DashGLineNumberer lineNumberer) { mv = mVisitor; @@ -71,7 +71,7 @@ } public void visitFieldInsn(int opcode, String owner, String name, String desc) { - String insn = TraceClassVisitor.OPCODES[opcode]; + String insn = AbstractVisitor.OPCODES[opcode]; insn += ' ' + name; emitInsn(insn); mv.visitFieldInsn(opcode, owner, name, desc); @@ -89,20 +89,20 @@ } public void visitInsn(int opcode) { - String insn = TraceClassVisitor.OPCODES[opcode]; + String insn = AbstractVisitor.OPCODES[opcode]; emitInsn(insn); mv.visitInsn(opcode); } public void visitIntInsn(int opcode, int operand) { - String insn = TraceClassVisitor.OPCODES[opcode]; + String insn = AbstractVisitor.OPCODES[opcode]; insn += " " + operand; emitInsn(insn); mv.visitIntInsn(opcode, operand); } public void visitJumpInsn(int opcode, Label label) { - String insn = TraceClassVisitor.OPCODES[opcode]; + String insn = AbstractVisitor.OPCODES[opcode]; insn += " " + label.toString(); emitInsn(insn); mv.visitJumpInsn(opcode, label); @@ -148,7 +148,7 @@ } public void visitMethodInsn(int opcode, String owner, String name, String desc) { - String insn = TraceClassVisitor.OPCODES[opcode]; + String insn = AbstractVisitor.OPCODES[opcode]; insn += ' ' + name + desc; emitInsn(insn); mv.visitMethodInsn(opcode, owner, name, desc); @@ -188,14 +188,14 @@ } public void visitTypeInsn(int opcode, String type) { - String insn = TraceClassVisitor.OPCODES[opcode]; + String insn = AbstractVisitor.OPCODES[opcode]; insn += ' ' + type; emitInsn(insn); mv.visitTypeInsn(opcode, type); } public void visitVarInsn(int opcode, int var) { - String insn = TraceClassVisitor.OPCODES[opcode]; + String insn = AbstractVisitor.OPCODES[opcode]; insn += " " + var; emitInsn(insn); mv.visitVarInsn(opcode, var); Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2010-01-02 05:11:06 UTC (rev 49) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2010-06-09 06:02:01 UTC (rev 50) @@ -42,7 +42,7 @@ public class DashGTask extends Task { static final int BUFFER_SIZE = 5120; - enum State {LookForMethod, ProcessLine}; + enum State {LookForMethod, ProcessLine} FileSet classSource; File directory; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-02 05:11:14
|
Revision: 49 http://dashg.svn.sourceforge.net/dashg/?rev=49&view=rev Author: dbrosius Date: 2010-01-02 05:11:06 +0000 (Sat, 02 Jan 2010) Log Message: ----------- fix linenumbers Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2010-01-02 04:55:14 UTC (rev 48) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2010-01-02 05:11:06 UTC (rev 49) @@ -64,7 +64,7 @@ pw.println("package " + packageName + ";"); pw.println(); - lineNumber += 2; + inc(2); } else { packageName = null; clsName = name; @@ -86,7 +86,7 @@ pw.println(" {"); - ++lineNumber; + inc(); cw.visit(version, access, name, signature, superName, interfaces); } @@ -103,7 +103,7 @@ @Override public void visitEnd() { pw.println("}"); - ++lineNumber; + inc(); } @Override @@ -114,7 +114,7 @@ if (value != null) pw.print(" = " + value); pw.println(";"); - ++lineNumber; + inc(); return null; } @@ -148,12 +148,12 @@ if ((access & Opcodes.ACC_ABSTRACT) != 0) { pw.println(";"); - lineNumber += 1; + inc(2); } else { pw.println("{"); pw.println("\t\tint pc;"); pw.println(); - lineNumber += 3; + inc(4); } return new DashGMethodSourcePrintingVisitor(cw.visitMethod(access, name, desc, signature, exceptions), pw, this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-02 04:55:20
|
Revision: 48 http://dashg.svn.sourceforge.net/dashg/?rev=48&view=rev Author: dbrosius Date: 2010-01-02 04:55:14 +0000 (Sat, 02 Jan 2010) Log Message: ----------- add @Override Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2010-01-02 04:42:17 UTC (rev 47) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2010-01-02 04:55:14 UTC (rev 48) @@ -54,6 +54,7 @@ return lineNumber; } + @Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { int slashPos = name.lastIndexOf('/'); if (slashPos >= 0) { @@ -89,19 +90,23 @@ cw.visit(version, access, name, signature, superName, interfaces); } - + + @Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { return null; } + @Override public void visitAttribute(Attribute attr) { } + @Override public void visitEnd() { pw.println("}"); ++lineNumber; } + @Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { pw.print('\t' + DashGUtils.getAttribute(access)); String type = DashGUtils.convertType(desc); @@ -114,9 +119,11 @@ return null; } + @Override public void visitInnerClass(String name, String outerName, String innerName, int access) { } - + + @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { pw.println(); pw.print('\t' + DashGUtils.getAttribute(access)); @@ -152,9 +159,11 @@ return new DashGMethodSourcePrintingVisitor(cw.visitMethod(access, name, desc, signature, exceptions), pw, this); } + @Override public void visitOuterClass(String owner, String name, String desc) { } + @Override public void visitSource(String source, String debug) { } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-02 04:42:23
|
Revision: 47 http://dashg.svn.sourceforge.net/dashg/?rev=47&view=rev Author: dbrosius Date: 2010-01-02 04:42:17 +0000 (Sat, 02 Jan 2010) Log Message: ----------- stub abstract methods Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2010-01-02 04:28:41 UTC (rev 46) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2010-01-02 04:42:17 UTC (rev 47) @@ -139,10 +139,15 @@ } pw.print(") "); - pw.println("{"); - pw.println("\t\tint pc;"); - pw.println(); - lineNumber += 4; + if ((access & Opcodes.ACC_ABSTRACT) != 0) { + pw.println(";"); + lineNumber += 1; + } else { + pw.println("{"); + pw.println("\t\tint pc;"); + pw.println(); + lineNumber += 3; + } return new DashGMethodSourcePrintingVisitor(cw.visitMethod(access, name, desc, signature, exceptions), pw, this); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-02 04:28:50
|
Revision: 46 http://dashg.svn.sourceforge.net/dashg/?rev=46&view=rev Author: dbrosius Date: 2010-01-02 04:28:41 +0000 (Sat, 02 Jan 2010) Log Message: ----------- fix the classpath for test Modified Paths: -------------- trunk/dashg/build.xml Modified: trunk/dashg/build.xml =================================================================== --- trunk/dashg/build.xml 2010-01-02 04:24:01 UTC (rev 45) +++ trunk/dashg/build.xml 2010-01-02 04:28:41 UTC (rev 46) @@ -118,7 +118,7 @@ <target name="release" depends="build, srczip, javadoc" description="prepares everything for a release"/> <target name="test" depends="build"> - <taskdef name="dashg" classname="com.mebigfatguy.dashg.DashGTask" classpath="${basedir}/dashg-${dashg.version}.jar;${lib.dir}/asm-3.1.jar"/> + <taskdef name="dashg" classname="com.mebigfatguy.dashg.DashGTask" classpath="${basedir}/dashg-${dashg.version}.jar;${lib.dir}/asm-3.1.jar;${lib.dir}/asm-util-3.1.jar"/> <delete dir="${basedir}/test_output"/> <dashg outputdirectory="${basedir}/test_output"> <fileset dir="${classes.dir}"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-02 04:24:12
|
Revision: 45 http://dashg.svn.sourceforge.net/dashg/?rev=45&view=rev Author: dbrosius Date: 2010-01-02 04:24:01 +0000 (Sat, 02 Jan 2010) Log Message: ----------- use 1.6 Modified Paths: -------------- trunk/dashg/build.xml Modified: trunk/dashg/build.xml =================================================================== --- trunk/dashg/build.xml 2010-01-02 04:22:29 UTC (rev 44) +++ trunk/dashg/build.xml 2010-01-02 04:24:01 UTC (rev 45) @@ -28,8 +28,8 @@ <property name="lib.dir" value="${basedir}/lib"/> <property name="javadoc.dir" value="${basedir}/javadoc"/> <property name="htdocs.dir" value="${basedir}/htdocs"/> - <property name="javac.source" value="1.5"/> - <property name="javac.target" value="1.5"/> + <property name="javac.source" value="1.6"/> + <property name="javac.target" value="1.6"/> <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-02 04:22:35
|
Revision: 44 http://dashg.svn.sourceforge.net/dashg/?rev=44&view=rev Author: dbrosius Date: 2010-01-02 04:22:29 +0000 (Sat, 02 Jan 2010) Log Message: ----------- (c) 2010 Modified Paths: -------------- trunk/dashg/build.xml trunk/dashg/src/Drvr.java trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGCloser.java trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java Added Paths: ----------- trunk/dashg/.settings/ Modified: trunk/dashg/build.xml =================================================================== --- trunk/dashg/build.xml 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/build.xml 2010-01-02 04:22:29 UTC (rev 44) @@ -1,7 +1,7 @@ <!-- /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/Drvr.java =================================================================== --- trunk/dashg/src/Drvr.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/Drvr.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGCloser.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGCloser.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGCloser.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2009-01-02 02:08:32 UTC (rev 43) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2010-01-02 04:22:29 UTC (rev 44) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008-2009 Dave Brosius + * Copyright (C) 2008-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-01-02 02:08:42
|
Revision: 43 http://dashg.svn.sourceforge.net/dashg/?rev=43&view=rev Author: dbrosius Date: 2009-01-02 02:08:32 +0000 (Fri, 02 Jan 2009) Log Message: ----------- update copyright to 2009 Modified Paths: -------------- trunk/dashg/build.xml trunk/dashg/src/Drvr.java trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGCloser.java trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java Modified: trunk/dashg/build.xml =================================================================== --- trunk/dashg/build.xml 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/build.xml 2009-01-02 02:08:32 UTC (rev 43) @@ -1,7 +1,7 @@ <!-- /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/Drvr.java =================================================================== --- trunk/dashg/src/Drvr.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/Drvr.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGCloser.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGCloser.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGCloser.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2008-11-14 06:14:10 UTC (rev 42) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2009-01-02 02:08:32 UTC (rev 43) @@ -1,6 +1,6 @@ /* * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius + * Copyright (C) 2008-2009 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-11-14 06:14:15
|
Revision: 42 http://dashg.svn.sourceforge.net/dashg/?rev=42&view=rev Author: dbrosius Date: 2008-11-14 06:14:10 +0000 (Fri, 14 Nov 2008) Log Message: ----------- web site images Added Paths: ----------- trunk/dashg/htdocs/blend.jpg trunk/dashg/htdocs/vbar.gif Added: trunk/dashg/htdocs/blend.jpg =================================================================== (Binary files differ) Property changes on: trunk/dashg/htdocs/blend.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/dashg/htdocs/vbar.gif =================================================================== (Binary files differ) Property changes on: trunk/dashg/htdocs/vbar.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-11-14 06:12:47
|
Revision: 41 http://dashg.svn.sourceforge.net/dashg/?rev=41&view=rev Author: dbrosius Date: 2008-11-14 06:12:46 +0000 (Fri, 14 Nov 2008) Log Message: ----------- stub in project page Added Paths: ----------- trunk/dashg/htdocs/ trunk/dashg/htdocs/index.html Added: trunk/dashg/htdocs/index.html =================================================================== --- trunk/dashg/htdocs/index.html (rev 0) +++ trunk/dashg/htdocs/index.html 2008-11-14 06:12:46 UTC (rev 41) @@ -0,0 +1,34 @@ +<html> + <head> + <title>DashG - An ant tool for embellishing class files with debug information</title> + <meta name="Keywords" content="ant dashg class debug mebigfatguy"> + </head> + <body background> + <div style="position:absolute;top:0;left:0;width:256;height:65535;z-index:1;background-image:url(blend.jpg);"> + </div> + <div style="position:absolute;top:20;left:20;z-index:3;"> + <h1>DashG</h1> + <hr/> + <a href="http://www.sourceforge.net/projects/dashg">Project Page</a> + <img src="vbar.gif" height="12"/> + <a href="javadoc/index.html">JavaDoc</a> + <hr/> + + <p>Thanks for your interest in DashG.</p> + + <p>This project has just been started, check back soon for more information.</p> + </div> + +<script type="text/javascript"> +var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); +document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); +</script> +<script type="text/javascript"> +var pageTracker = _gat._getTracker("UA-249537-6"); +pageTracker._trackPageview(); +</script> + + </body> +</html> + + Property changes on: trunk/dashg/htdocs/index.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-29 01:05:58
|
Revision: 40 http://dashg.svn.sourceforge.net/dashg/?rev=40&view=rev Author: dbrosius Date: 2008-10-29 01:05:50 +0000 (Wed, 29 Oct 2008) Log Message: ----------- oi Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 22:19:03 UTC (rev 39) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-29 01:05:50 UTC (rev 40) @@ -19,8 +19,6 @@ package com.mebigfatguy.dashg; import java.io.PrintWriter; -import java.text.MessageFormat; -import java.text.NumberFormat; import java.util.HashMap; import java.util.Map; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 22:19:10
|
Revision: 39 http://dashg.svn.sourceforge.net/dashg/?rev=39&view=rev Author: dbrosius Date: 2008-10-28 22:19:03 +0000 (Tue, 28 Oct 2008) Log Message: ----------- cleanup src output Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 22:05:17 UTC (rev 38) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 22:19:03 UTC (rev 39) @@ -71,7 +71,7 @@ pw.print(DashGUtils.getAttribute(access)); - pw.print(clsName + ' '); + pw.print("class " + clsName + ' '); if (!superName.equals("java/lang/Object")) pw.print("extends " + superName.replace('/', '.') + ' '); @@ -126,7 +126,8 @@ name = clsName; pw.print(name); List<String> args = DashGUtils.getArguments(desc); - String comma = "("; + pw.print('('); + String comma = ""; int parmNum = ((access & Opcodes.ACC_STATIC) != 0) ? 0 : 1; for (String a : args) { pw.print(comma); Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 22:05:17 UTC (rev 38) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 22:19:03 UTC (rev 39) @@ -19,6 +19,7 @@ package com.mebigfatguy.dashg; import java.io.PrintWriter; +import java.text.MessageFormat; import java.text.NumberFormat; import java.util.HashMap; import java.util.Map; @@ -31,19 +32,17 @@ public class DashGMethodSourcePrintingVisitor implements MethodVisitor { + private static final String BLANKS = " "; + private MethodVisitor mv; private PrintWriter pw; private DashGLineNumberer ln; - private NumberFormat nf; private Map<String, Integer> labelsToOffset; public DashGMethodSourcePrintingVisitor(MethodVisitor mVisitor, PrintWriter pWriter, DashGLineNumberer lineNumberer) { mv = mVisitor; pw = pWriter; ln = lineNumberer; - nf = NumberFormat.getIntegerInstance(); - nf.setMinimumIntegerDigits(5); - nf.setGroupingUsed(false); labelsToOffset = new HashMap<String, Integer>(); } @@ -208,7 +207,12 @@ Label l = new Label(); mv.visitLabel(l); mv.visitLineNumber(ln.getLineNumber(), l); - pw.println("\t\tpc = " + nf.format(l.getOffset()) + " // \t\t" + insn); + pw.println("\t\tpc = " + formatOffset(l.getOffset()) + "; // \t\t" + insn); ln.inc(); } + + private String formatOffset(int offset) { + String offsetString = String.valueOf(offset); + return BLANKS.substring(0, BLANKS.length() - offsetString.length()) + offsetString; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 22:05:18
|
Revision: 38 http://dashg.svn.sourceforge.net/dashg/?rev=38&view=rev Author: dbrosius Date: 2008-10-28 22:05:17 +0000 (Tue, 28 Oct 2008) Log Message: ----------- ws Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 22:03:16 UTC (rev 37) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 22:05:17 UTC (rev 38) @@ -49,6 +49,7 @@ public void inc(int count) { lineNumber += count; } + public int getLineNumber() { return lineNumber; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 22:03:18
|
Revision: 37 http://dashg.svn.sourceforge.net/dashg/?rev=37&view=rev Author: dbrosius Date: 2008-10-28 22:03:16 +0000 (Tue, 28 Oct 2008) Log Message: ----------- PC -> pc Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 21:59:05 UTC (rev 36) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 22:03:16 UTC (rev 37) @@ -138,7 +138,7 @@ pw.print(") "); pw.println("{"); - pw.println("\t\tint PC;"); + pw.println("\t\tint pc;"); pw.println(); lineNumber += 4; Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 21:59:05 UTC (rev 36) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 22:03:16 UTC (rev 37) @@ -208,7 +208,7 @@ Label l = new Label(); mv.visitLabel(l); mv.visitLineNumber(ln.getLineNumber(), l); - pw.println("\t\tPC = " + nf.format(l.getOffset()) + " // \t\t" + insn); + pw.println("\t\tpc = " + nf.format(l.getOffset()) + " // \t\t" + insn); ln.inc(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 21:59:11
|
Revision: 36 http://dashg.svn.sourceforge.net/dashg/?rev=36&view=rev Author: dbrosius Date: 2008-10-28 21:59:05 +0000 (Tue, 28 Oct 2008) Log Message: ----------- fix parm names Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 21:50:10 UTC (rev 35) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 21:59:05 UTC (rev 36) @@ -27,6 +27,7 @@ import org.objectweb.asm.ClassWriter; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; public class DashGClassSourcePrintingVisitor implements ClassVisitor, DashGLineNumberer { @@ -125,12 +126,14 @@ pw.print(name); List<String> args = DashGUtils.getArguments(desc); String comma = "("; + int parmNum = ((access & Opcodes.ACC_STATIC) != 0) ? 0 : 1; for (String a : args) { pw.print(comma); comma = ", "; pw.print(a); pw.print(' '); - pw.print('x'); + pw.print(DashGUtils.parmName(a, parmNum)); + parmNum += DashGUtils.typeSize(a); } pw.print(") "); Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2008-10-28 21:50:10 UTC (rev 35) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2008-10-28 21:59:05 UTC (rev 36) @@ -111,4 +111,18 @@ return type.substring(1); } + + public static String parmName(String type, int parmNum) { + int dotPos = type.lastIndexOf('.'); + if (dotPos >= 0) + type = type.substring(dotPos+1); + int lBracketPos = type.indexOf('['); + if (lBracketPos >= 0) + type = type.substring(0, lBracketPos) + 's'; + return type.toLowerCase() + parmNum; + } + + public static int typeSize(String typeName) { + return ("long".equals(typeName) || "double".equals(typeName)) ? 2 : 1; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 21:50:19
|
Revision: 35 http://dashg.svn.sourceforge.net/dashg/?rev=35&view=rev Author: dbrosius Date: 2008-10-28 21:50:10 +0000 (Tue, 28 Oct 2008) Log Message: ----------- add LOOKUPSWITCH Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 21:48:36 UTC (rev 34) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 21:50:10 UTC (rev 35) @@ -131,6 +131,18 @@ } public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) { + StringBuilder insn = new StringBuilder(); + insn.append("LOOKUPSWITCH {"); + String comma = ""; + for (int i = 0; i <= keys.length; i++) { + insn.append(comma); + comma = ","; + insn.append(keys[i]); + insn.append(':'); + insn.append(labels[i].toString()); + } + insn.append("}"); + emitInsn(insn.toString()); mv.visitLookupSwitchInsn(dflt, keys, labels); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 21:48:45
|
Revision: 34 http://dashg.svn.sourceforge.net/dashg/?rev=34&view=rev Author: dbrosius Date: 2008-10-28 21:48:36 +0000 (Tue, 28 Oct 2008) Log Message: ----------- add multianewarray Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 19:47:02 UTC (rev 33) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 21:48:36 UTC (rev 34) @@ -146,6 +146,11 @@ } public void visitMultiANewArrayInsn(String desc, int dims) { + StringBuilder insn = new StringBuilder(); + insn.append("MULTIANEWARRAY"); + insn.append(" ").append(desc); + for (int d = 0; d < dims; d++) + insn.append("[]"); mv.visitMultiANewArrayInsn(desc, dims); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 19:47:06
|
Revision: 33 http://dashg.svn.sourceforge.net/dashg/?rev=33&view=rev Author: dbrosius Date: 2008-10-28 19:47:02 +0000 (Tue, 28 Oct 2008) Log Message: ----------- add tableswitch Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 19:27:07 UTC (rev 32) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 19:47:02 UTC (rev 33) @@ -20,6 +20,8 @@ import java.io.PrintWriter; import java.text.NumberFormat; +import java.util.HashMap; +import java.util.Map; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Attribute; @@ -33,6 +35,7 @@ private PrintWriter pw; private DashGLineNumberer ln; private NumberFormat nf; + private Map<String, Integer> labelsToOffset; public DashGMethodSourcePrintingVisitor(MethodVisitor mVisitor, PrintWriter pWriter, DashGLineNumberer lineNumberer) { mv = mVisitor; @@ -41,8 +44,13 @@ nf = NumberFormat.getIntegerInstance(); nf.setMinimumIntegerDigits(5); nf.setGroupingUsed(false); + labelsToOffset = new HashMap<String, Integer>(); } + public Map<String, Integer> getLabelOffsets() { + return labelsToOffset; + } + public AnnotationVisitor visitAnnotation(String desc, boolean visible) { return mv.visitAnnotation(desc, visible); } @@ -98,12 +106,14 @@ public void visitJumpInsn(int opcode, Label label) { String insn = TraceClassVisitor.OPCODES[opcode]; + insn += " " + label.toString(); emitInsn(insn); mv.visitJumpInsn(opcode, label); } public void visitLabel(Label label) { mv.visitLabel(label); + labelsToOffset.put(label.toString(), Integer.valueOf(label.getOffset())); } public void visitLdcInsn(Object cst) { @@ -144,6 +154,18 @@ } public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) { + StringBuilder insn = new StringBuilder(); + insn.append("TABLESWITCH {"); + String comma = ""; + for (int i = min; i <= max; i++) { + insn.append(comma); + comma = ","; + insn.append(i); + insn.append(':'); + insn.append(labels[i-min].toString()); + } + insn.append("}"); + emitInsn(insn.toString()); mv.visitTableSwitchInsn(min, max, dflt, labels); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 19:27:10
|
Revision: 32 http://dashg.svn.sourceforge.net/dashg/?rev=32&view=rev Author: dbrosius Date: 2008-10-28 19:27:07 +0000 (Tue, 28 Oct 2008) Log Message: ----------- oi Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 19:25:16 UTC (rev 31) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 19:27:07 UTC (rev 32) @@ -23,7 +23,6 @@ import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Attribute; -import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.util.TraceClassVisitor; Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-10-28 19:25:16 UTC (rev 31) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-10-28 19:27:07 UTC (rev 32) @@ -37,7 +37,6 @@ import org.objectweb.asm.ClassAdapter; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.util.TraceClassVisitor; public class DashGTask extends Task { @@ -78,16 +77,13 @@ private void generateDashGFiles(File baseDirectory, String fName) { String packagePath; - String packageName; try { int sepPos = fName.lastIndexOf(File.separator); if (sepPos >= 0) { packagePath = fName.substring(0, sepPos); - packageName = packagePath.replaceAll("\\" + File.separator, "."); } else { packagePath = null; - packageName = null; } String fileBaseName = fName.substring(sepPos+1, fName.length() - ".class".length()); @@ -98,13 +94,13 @@ File dstSrcFile = new File(destDir, fileBaseName + ".java"); File dstClsFile = new File(destDir, fileBaseName + ".class"); - buildNewClass(new File(baseDirectory, fName), dstSrcFile, dstClsFile, packageName, fileBaseName); + buildNewClass(new File(baseDirectory, fName), dstSrcFile, dstClsFile, fileBaseName); } catch (Exception ioe) { throw new BuildException("Failed generating output files for file " + fName, ioe); } } - public void buildNewClass(File inputClass, File outputSrc, File outputClass, String packageName, String baseName) throws IOException { + public void buildNewClass(File inputClass, File outputSrc, File outputClass, String baseName) throws IOException { BufferedInputStream bis = null; BufferedOutputStream bos = null; PrintWriter pw = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 19:25:20
|
Revision: 31 http://dashg.svn.sourceforge.net/dashg/?rev=31&view=rev Author: dbrosius Date: 2008-10-28 19:25:16 +0000 (Tue, 28 Oct 2008) Log Message: ----------- start using ASM to build src files Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java Removed Paths: ------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGSourceWriter.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 19:24:51 UTC (rev 30) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 19:25:16 UTC (rev 31) @@ -19,6 +19,7 @@ package com.mebigfatguy.dashg; import java.io.PrintWriter; +import java.util.List; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Attribute; @@ -26,7 +27,6 @@ import org.objectweb.asm.ClassWriter; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; public class DashGClassSourcePrintingVisitor implements ClassVisitor, DashGLineNumberer { @@ -41,15 +41,22 @@ pw = srcWriter; } + public void inc() { + ++lineNumber; + } + + public void inc(int count) { + lineNumber += count; + } public int getLineNumber() { return lineNumber; } public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - int dotPos = name.lastIndexOf('.'); - if (dotPos >= 0) { - packageName = name.substring(0, dotPos); - clsName = name.substring(dotPos+1); + int slashPos = name.lastIndexOf('/'); + if (slashPos >= 0) { + packageName = name.substring(0, slashPos).replace('/', '.'); + clsName = name.substring(slashPos+1); pw.println("package " + packageName + ";"); pw.println(); @@ -60,28 +67,12 @@ clsName = name; } - if ((access & Opcodes.ACC_PUBLIC) != 0) { - pw.print("public "); - } else if ((access & Opcodes.ACC_PRIVATE) != 0) { - pw.print("private "); - } else if ((access & Opcodes.ACC_PROTECTED) != 0) { - pw.print("protected "); - } + pw.print(DashGUtils.getAttribute(access)); - if ((access & Opcodes.ACC_STATIC) != 0) { - pw.println("static "); - } else if ((access & Opcodes.ACC_ABSTRACT) != 0) { - pw.print("abstract "); - } - - if ((access & Opcodes.ACC_FINAL) != 0) { - pw.print("final "); - } - pw.print(clsName + ' '); - if (superName != null) - pw.print("extends " + superName + ' '); + if (!superName.equals("java/lang/Object")) + pw.print("extends " + superName.replace('/', '.') + ' '); String comma = "implements "; for (String inf : interfaces) { @@ -90,9 +81,9 @@ pw.print(inf); } - pw.println(); + pw.println(" {"); - lineNumber+=1; + ++lineNumber; cw.visit(version, access, name, signature, superName, interfaces); } @@ -105,9 +96,19 @@ } public void visitEnd() { + pw.println("}"); + ++lineNumber; } public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { + pw.print('\t' + DashGUtils.getAttribute(access)); + String type = DashGUtils.convertType(desc); + pw.print(type + ' ' + name); + if (value != null) + pw.print(" = " + value); + pw.println(";"); + ++lineNumber; + return null; } @@ -115,7 +116,30 @@ } public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - return new DashGMethodSourcePrintingVisitor(cw, pw); + pw.println(); + pw.print('\t' + DashGUtils.getAttribute(access)); + pw.print(DashGUtils.getReturn(desc)); + pw.print(' '); + if (name.equals("<init>")) + name = clsName; + pw.print(name); + List<String> args = DashGUtils.getArguments(desc); + String comma = "("; + for (String a : args) { + pw.print(comma); + comma = ", "; + pw.print(a); + pw.print(' '); + pw.print('x'); + } + pw.print(") "); + + pw.println("{"); + pw.println("\t\tint PC;"); + pw.println(); + lineNumber += 4; + + return new DashGMethodSourcePrintingVisitor(cw.visitMethod(access, name, desc, signature, exceptions), pw, this); } public void visitOuterClass(String owner, String name, String desc) { @@ -123,5 +147,4 @@ public void visitSource(String source, String debug) { } - } Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java 2008-10-28 19:24:51 UTC (rev 30) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java 2008-10-28 19:25:16 UTC (rev 31) @@ -19,5 +19,7 @@ package com.mebigfatguy.dashg; public interface DashGLineNumberer { + void inc(); + void inc(int count); int getLineNumber(); } Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 19:24:51 UTC (rev 30) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 19:25:16 UTC (rev 31) @@ -19,101 +19,158 @@ package com.mebigfatguy.dashg; import java.io.PrintWriter; +import java.text.NumberFormat; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Attribute; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.util.TraceClassVisitor; public class DashGMethodSourcePrintingVisitor implements MethodVisitor { - private ClassWriter cw; + private MethodVisitor mv; private PrintWriter pw; + private DashGLineNumberer ln; + private NumberFormat nf; - public DashGMethodSourcePrintingVisitor(ClassWriter cWriter, PrintWriter pWriter) { - cw = cWriter; + public DashGMethodSourcePrintingVisitor(MethodVisitor mVisitor, PrintWriter pWriter, DashGLineNumberer lineNumberer) { + mv = mVisitor; pw = pWriter; + ln = lineNumberer; + nf = NumberFormat.getIntegerInstance(); + nf.setMinimumIntegerDigits(5); + nf.setGroupingUsed(false); } - public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) { - return null; + public AnnotationVisitor visitAnnotation(String desc, boolean visible) { + return mv.visitAnnotation(desc, visible); } public AnnotationVisitor visitAnnotationDefault() { - return null; + return mv.visitAnnotationDefault(); } - public void visitAttribute(Attribute arg0) { + public void visitAttribute(Attribute attr) { + mv.visitAttribute(attr); } public void visitCode() { + mv.visitCode(); } public void visitEnd() { + pw.println("\t}"); + ln.inc(1); + mv.visitEnd(); } - public void visitFieldInsn(int arg0, String arg1, String arg2, String arg3) { - + public void visitFieldInsn(int opcode, String owner, String name, String desc) { + String insn = TraceClassVisitor.OPCODES[opcode]; + insn += ' ' + name; + emitInsn(insn); + mv.visitFieldInsn(opcode, owner, name, desc); } - public void visitFrame(int arg0, int arg1, Object[] arg2, int arg3, - Object[] arg4) { + public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) { + mv.visitFrame(type, nLocal, local, nStack, stack); } - public void visitIincInsn(int arg0, int arg1) { + public void visitIincInsn(int var, int increment) { + String insn = "IINC"; + insn += " a" + var + ", " + increment; + emitInsn(insn); + mv.visitIincInsn(var, increment); } - public void visitInsn(int arg0) { + public void visitInsn(int opcode) { + String insn = TraceClassVisitor.OPCODES[opcode]; + emitInsn(insn); + mv.visitInsn(opcode); } - public void visitIntInsn(int arg0, int arg1) { + public void visitIntInsn(int opcode, int operand) { + String insn = TraceClassVisitor.OPCODES[opcode]; + insn += " " + operand; + emitInsn(insn); + mv.visitIntInsn(opcode, operand); } - public void visitJumpInsn(int arg0, Label arg1) { + public void visitJumpInsn(int opcode, Label label) { + String insn = TraceClassVisitor.OPCODES[opcode]; + emitInsn(insn); + mv.visitJumpInsn(opcode, label); } - public void visitLabel(Label arg0) { + public void visitLabel(Label label) { + mv.visitLabel(label); } - public void visitLdcInsn(Object arg0) { + public void visitLdcInsn(Object cst) { + String insn = "LDC"; + insn += ' ' + cst.toString(); + emitInsn(insn); + mv.visitLdcInsn(cst); } - public void visitLineNumber(int arg0, Label arg1) { + public void visitLineNumber(int line, Label start) { } - public void visitLocalVariable(String arg0, String arg1, String arg2, - Label arg3, Label arg4, int arg5) { + public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) { + mv.visitLocalVariable(name, desc, signature, start, end, index); } - public void visitLookupSwitchInsn(Label arg0, int[] arg1, Label[] arg2) { + public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) { + mv.visitLookupSwitchInsn(dflt, keys, labels); } - public void visitMaxs(int arg0, int arg1) { + public void visitMaxs(int maxStack, int maxLocals) { + mv.visitMaxs(maxStack, maxLocals); } - public void visitMethodInsn(int arg0, String arg1, String arg2, String arg3) { + public void visitMethodInsn(int opcode, String owner, String name, String desc) { + String insn = TraceClassVisitor.OPCODES[opcode]; + insn += ' ' + name + desc; + emitInsn(insn); + mv.visitMethodInsn(opcode, owner, name, desc); } - public void visitMultiANewArrayInsn(String arg0, int arg1) { + public void visitMultiANewArrayInsn(String desc, int dims) { + mv.visitMultiANewArrayInsn(desc, dims); } - public AnnotationVisitor visitParameterAnnotation(int arg0, String arg1, - boolean arg2) { - return null; + public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) { + return mv.visitParameterAnnotation(parameter, desc, visible); } - public void visitTableSwitchInsn(int arg0, int arg1, Label arg2, - Label[] arg3) { + public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) { + mv.visitTableSwitchInsn(min, max, dflt, labels); } - public void visitTryCatchBlock(Label arg0, Label arg1, Label arg2, - String arg3) { + public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { + mv.visitTryCatchBlock(start, end, handler, type); } - public void visitTypeInsn(int arg0, String arg1) { + public void visitTypeInsn(int opcode, String type) { + String insn = TraceClassVisitor.OPCODES[opcode]; + insn += ' ' + type; + emitInsn(insn); + mv.visitTypeInsn(opcode, type); } - public void visitVarInsn(int arg0, int arg1) { + public void visitVarInsn(int opcode, int var) { + String insn = TraceClassVisitor.OPCODES[opcode]; + insn += " " + var; + emitInsn(insn); + mv.visitVarInsn(opcode, var); } + + private void emitInsn(String insn) { + Label l = new Label(); + mv.visitLabel(l); + mv.visitLineNumber(ln.getLineNumber(), l); + pw.println("\t\tPC = " + nf.format(l.getOffset()) + " // \t\t" + insn); + ln.inc(); + } } Deleted: trunk/dashg/src/com/mebigfatguy/dashg/DashGSourceWriter.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGSourceWriter.java 2008-10-28 19:24:51 UTC (rev 30) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGSourceWriter.java 2008-10-28 19:25:16 UTC (rev 31) @@ -1,231 +0,0 @@ -/* - * dashg - A debug symbols (-g) injector - * Copyright (C) 2008 Dave Brosius - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package com.mebigfatguy.dashg; - -import java.io.PrintWriter; -import java.text.NumberFormat; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class DashGSourceWriter extends PrintWriter implements DashGLineNumberer { - - enum State {BeforeClass, InClass, InMethod}; - - private static final Pattern classPattern = Pattern.compile("(.*)class\\s*([^\\s]*)(.*)"); - private static final Pattern methodPattern = Pattern.compile("(.*)\\s+([a-zA-Z0-9<>_]+)\\(([^)]*)\\)([^\\s]+)(\\s+([_a-zA-Z0-9/]*))?"); - private static final Pattern fieldPattern = Pattern.compile("([^L]*)\\s+(L[^;]*;)?\\s+(.+)"); - private static final Pattern cruftPattern = Pattern.compile("((L[0-9]+)|(LINENUMBER)|(LOCALVARIABLE)|(MAXSTACK)|(MAXLOCALS)).*"); - - private final PrintWriter writer; - private State state = State.BeforeClass; - private String clsName = null; - private int lineNumber = 1; - private NumberFormat nf; - - public DashGSourceWriter(PrintWriter pw, String packageName) { - super(pw); - writer = pw; - - nf = NumberFormat.getIntegerInstance(); - nf.setMinimumIntegerDigits(5); - nf.setGroupingUsed(false); - - if ((packageName != null) && (packageName.length() > 0)) { - writer.println("import " + packageName + ";"); - ++lineNumber; - } - } - - public int getLineNumber() { - return lineNumber; - } - - @Override - public void print(String s) { - String[] lines = s.split("\n"); - for (String l : lines) { - processLine(l); - ++lineNumber; - } - } - - private void processLine(String s) { - State newState = state; - - s = s.trim(); - if (!s.startsWith("//")) { - switch (state) { - case BeforeClass: - if (s.contains(" class ")) { - Matcher m = classPattern.matcher(s); - if (m.matches()) { - String atts = m.group(1); - clsName = m.group(2); - String ext = m.group(3); - - int slashPos = clsName.lastIndexOf('/'); - if (slashPos >= 0) - clsName = clsName.substring(slashPos+1); - - s = atts + "class " + clsName + ext.replace('/', '.'); - newState = State.InClass; - } - } - break; - - case InClass: - Matcher m = methodPattern.matcher(s); - if (m.matches()) { - m = methodPattern.matcher(s); - if (m.matches()) { - String atts = m.group(1); - String name = m.group(2); - String parms = m.group(3); - String ret = m.group(4); - String thr = m.group(6); - - if ("<init>".equals(name)) { - name = clsName; - } - - StringBuilder realParms = new StringBuilder(); - String comma = ""; - int parmNum = atts.contains("static") ? 0 : 1; - while (parms.length() > 0) { - realParms.append(comma); - comma = ", "; - String type = convertType(parms); - realParms.append(type); - realParms.append(' '); - realParms.append(parmName(type, parmNum)); - parmNum += typeSize(type); - parms = skipType(parms); - } - parms = realParms.toString(); - - if (thr == null) - thr = ""; - else - thr = thr.replace('/', '.'); - s = atts + ' ' + convertType(ret) + ' ' + name + '(' + parms + ')' + thr; - } - newState = State.InMethod; - } else { - m = fieldPattern.matcher(s); - if (m.matches()) { - String type = m.group(2); - if (type != null) { - type = convertType(type); - s = m.group(1) + ' ' + type + ' ' + m.group(3); - } - - s += ";"; - } - } - break; - - case InMethod: - if (s.length() == 0) { - newState = State.InClass; - } - if (s.startsWith("//")) - return; - - m = cruftPattern.matcher(s); - if (m.matches()) { - return; - } - - s = "\tPC = " + nf.format(0) + ";\t// " + s; - break; - } - } - - if ((newState == State.InClass) && (state == State.InMethod)) { - super.print("}\n"); - ++lineNumber; - } - - super.print(s + "\n"); - - if ((state == State.InClass) && (newState == State.InMethod)) { - super.print("{\n"); - ++lineNumber; - super.print("\tint PC;\n"); - ++lineNumber; - super.print("\n"); - ++lineNumber; - } - - state = newState; - } - - private String convertType(String type) { - char c = type.charAt(0); - switch (c) { - case 'L': - return type.substring(1, type.indexOf(';')).replace('/', '.'); - case '[': - return convertType(type.substring(1)) + "[]"; - case 'C': - return "char"; - case 'B': - return "byte"; - case 'S': - return "short"; - case 'I': - return "int"; - case 'J': - return "long"; - case 'F': - return "float"; - case 'D': - return "double"; - case 'Z': - return "boolean"; - case 'V': - return "void"; - } - throw new RuntimeException("Type not processed: " + type); - } - - private int typeSize(String typeName) { - return ("long".equals(typeName) || "double".equals(typeName)) ? 2 : 1; - } - - private String parmName(String type, int parmNum) { - int dotPos = type.lastIndexOf('.'); - if (dotPos >= 0) - type = type.substring(dotPos+1); - return type.toLowerCase() + parmNum; - } - - private String skipType(String type) { - if (type.length() == 0) - return type; - - if (type.charAt(0) == '[') - return skipType(type.substring(1)); - - if (type.charAt(0) == 'L') - return type.substring(type.indexOf(';') + 1); - - return type.substring(1); - } -} Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-10-28 19:24:51 UTC (rev 30) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-10-28 19:25:16 UTC (rev 31) @@ -115,8 +115,8 @@ ClassReader cr = new ClassReader(bis); ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS); - DashGSourceWriter sw = new DashGSourceWriter(pw, packageName); - ClassAdapter ca = new DashGClassAdapter(new TraceClassVisitor(cw, sw), sw, baseName); + DashGClassSourcePrintingVisitor spv = new DashGClassSourcePrintingVisitor(cw, pw); + ClassAdapter ca = new DashGClassAdapter(spv, spv, baseName); cr.accept(ca, 0); byte[] classData = cw.toByteArray(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 19:24:54
|
Revision: 30 http://dashg.svn.sourceforge.net/dashg/?rev=30&view=rev Author: dbrosius Date: 2008-10-28 19:24:51 +0000 (Tue, 28 Oct 2008) Log Message: ----------- some signature parsing utils Added Paths: ----------- trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java Added: trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java (rev 0) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2008-10-28 19:24:51 UTC (rev 30) @@ -0,0 +1,114 @@ +/* + * dashg - A debug symbols (-g) injector + * Copyright (C) 2008 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.mebigfatguy.dashg; + +import java.util.ArrayList; +import java.util.List; + +import org.objectweb.asm.Opcodes; + +public final class DashGUtils { + private DashGUtils() { + } + + public static String getAttribute(int access) { + StringBuilder sb = new StringBuilder(); + if ((access & Opcodes.ACC_PUBLIC) != 0) { + sb.append("public "); + } else if ((access & Opcodes.ACC_PRIVATE) != 0) { + sb.append("private "); + } else if ((access & Opcodes.ACC_PROTECTED) != 0) { + sb.append("protected "); + } + + if ((access & Opcodes.ACC_STATIC) != 0) { + sb.append("static "); + } else if ((access & Opcodes.ACC_ABSTRACT) != 0) { + sb.append("abstract "); + } + + if ((access & Opcodes.ACC_FINAL) != 0) { + sb.append("final "); + } + + return sb.toString(); + } + + public static String convertType(String type) { + char c = type.charAt(0); + switch (c) { + case 'L': + return type.substring(1, type.indexOf(';')).replace('/', '.'); + case '[': + return convertType(type.substring(1)) + "[]"; + case 'C': + return "char"; + case 'B': + return "byte"; + case 'S': + return "short"; + case 'I': + return "int"; + case 'J': + return "long"; + case 'F': + return "float"; + case 'D': + return "double"; + case 'Z': + return "boolean"; + case 'V': + return "void"; + } + throw new RuntimeException("Type not processed: " + type); + } + + public static String getReturn(String desc) { + int rParenPos = desc.lastIndexOf(')'); + String type = desc.substring(rParenPos+1); + return convertType(type); + } + + public static List<String> getArguments(String desc) { + int lParenPos = desc.indexOf('('); + int rParenPos = desc.lastIndexOf(')'); + String argString = desc.substring(lParenPos+1, rParenPos); + + List<String> args = new ArrayList<String>(); + while (argString.length() > 0) { + args.add(convertType(argString)); + argString = skipType(argString); + } + + return args; + } + + public static String skipType(String type) { + if (type.length() == 0) + return type; + + if (type.charAt(0) == '[') + return skipType(type.substring(1)); + + if (type.charAt(0) == 'L') + return type.substring(type.indexOf(';') + 1); + + return type.substring(1); + } +} Property changes on: trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 18:12:11
|
Revision: 29 http://dashg.svn.sourceforge.net/dashg/?rev=29&view=rev Author: dbrosius Date: 2008-10-28 18:12:04 +0000 (Tue, 28 Oct 2008) Log Message: ----------- Move in another direction, TraceClassVisitor caches output, which wrecks the notion that we can use it to get line numbers Added Paths: ----------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java Added: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java (rev 0) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 18:12:04 UTC (rev 29) @@ -0,0 +1,127 @@ +/* + * dashg - A debug symbols (-g) injector + * Copyright (C) 2008 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.mebigfatguy.dashg; + +import java.io.PrintWriter; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +public class DashGClassSourcePrintingVisitor implements ClassVisitor, DashGLineNumberer { + + private ClassWriter cw; + private PrintWriter pw; + private String packageName; + private String clsName; + private int lineNumber = 1; + + public DashGClassSourcePrintingVisitor(ClassWriter classWriter, PrintWriter srcWriter) { + cw = classWriter; + pw = srcWriter; + } + + public int getLineNumber() { + return lineNumber; + } + + public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { + int dotPos = name.lastIndexOf('.'); + if (dotPos >= 0) { + packageName = name.substring(0, dotPos); + clsName = name.substring(dotPos+1); + + pw.println("package " + packageName + ";"); + pw.println(); + + lineNumber += 2; + } else { + packageName = null; + clsName = name; + } + + if ((access & Opcodes.ACC_PUBLIC) != 0) { + pw.print("public "); + } else if ((access & Opcodes.ACC_PRIVATE) != 0) { + pw.print("private "); + } else if ((access & Opcodes.ACC_PROTECTED) != 0) { + pw.print("protected "); + } + + if ((access & Opcodes.ACC_STATIC) != 0) { + pw.println("static "); + } else if ((access & Opcodes.ACC_ABSTRACT) != 0) { + pw.print("abstract "); + } + + if ((access & Opcodes.ACC_FINAL) != 0) { + pw.print("final "); + } + + pw.print(clsName + ' '); + + if (superName != null) + pw.print("extends " + superName + ' '); + + String comma = "implements "; + for (String inf : interfaces) { + pw.print(comma); + comma = ", "; + pw.print(inf); + } + + pw.println(); + + lineNumber+=1; + + cw.visit(version, access, name, signature, superName, interfaces); + } + + public AnnotationVisitor visitAnnotation(String desc, boolean visible) { + return null; + } + + public void visitAttribute(Attribute attr) { + } + + public void visitEnd() { + } + + public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { + return null; + } + + public void visitInnerClass(String name, String outerName, String innerName, int access) { + } + + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + return new DashGMethodSourcePrintingVisitor(cw, pw); + } + + public void visitOuterClass(String owner, String name, String desc) { + } + + public void visitSource(String source, String debug) { + } + +} Property changes on: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java (rev 0) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java 2008-10-28 18:12:04 UTC (rev 29) @@ -0,0 +1,119 @@ +/* + * dashg - A debug symbols (-g) injector + * Copyright (C) 2008 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.mebigfatguy.dashg; + +import java.io.PrintWriter; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +public class DashGMethodSourcePrintingVisitor implements MethodVisitor { + + private ClassWriter cw; + private PrintWriter pw; + + public DashGMethodSourcePrintingVisitor(ClassWriter cWriter, PrintWriter pWriter) { + cw = cWriter; + pw = pWriter; + } + + public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) { + return null; + } + + public AnnotationVisitor visitAnnotationDefault() { + return null; + } + + public void visitAttribute(Attribute arg0) { + } + + public void visitCode() { + } + + public void visitEnd() { + } + + public void visitFieldInsn(int arg0, String arg1, String arg2, String arg3) { + + } + + public void visitFrame(int arg0, int arg1, Object[] arg2, int arg3, + Object[] arg4) { + } + + public void visitIincInsn(int arg0, int arg1) { + } + + public void visitInsn(int arg0) { + } + + public void visitIntInsn(int arg0, int arg1) { + } + + public void visitJumpInsn(int arg0, Label arg1) { + } + + public void visitLabel(Label arg0) { + } + + public void visitLdcInsn(Object arg0) { + } + + public void visitLineNumber(int arg0, Label arg1) { + } + + public void visitLocalVariable(String arg0, String arg1, String arg2, + Label arg3, Label arg4, int arg5) { + } + + public void visitLookupSwitchInsn(Label arg0, int[] arg1, Label[] arg2) { + } + + public void visitMaxs(int arg0, int arg1) { + } + + public void visitMethodInsn(int arg0, String arg1, String arg2, String arg3) { + } + + public void visitMultiANewArrayInsn(String arg0, int arg1) { + } + + public AnnotationVisitor visitParameterAnnotation(int arg0, String arg1, + boolean arg2) { + return null; + } + + public void visitTableSwitchInsn(int arg0, int arg1, Label arg2, + Label[] arg3) { + } + + public void visitTryCatchBlock(Label arg0, Label arg1, Label arg2, + String arg3) { + } + + public void visitTypeInsn(int arg0, String arg1) { + } + + public void visitVarInsn(int arg0, int arg1) { + } +} Property changes on: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodSourcePrintingVisitor.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 17:40:25
|
Revision: 28 http://dashg.svn.sourceforge.net/dashg/?rev=28&view=rev Author: dbrosius Date: 2008-10-28 17:40:18 +0000 (Tue, 28 Oct 2008) Log Message: ----------- strip the offsets stuff, in lieu of moving to asm Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java 2008-10-28 17:29:39 UTC (rev 27) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassAdapter.java 2008-10-28 17:40:18 UTC (rev 28) @@ -25,9 +25,12 @@ public class DashGClassAdapter extends ClassAdapter { - public DashGClassAdapter(ClassVisitor visitor, String fileName) { + private DashGLineNumberer lineNumberer; + + public DashGClassAdapter(ClassVisitor visitor, DashGLineNumberer ln, String fileName) { super(visitor); super.visitSource(fileName, null); + lineNumberer = ln; } @Override @@ -40,6 +43,6 @@ return super.visitMethod(access, name, desc, signature, exceptions); MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - return new DashGMethodAdapter(mv, name+desc); + return new DashGMethodAdapter(mv, lineNumberer, name+desc); } } Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java 2008-10-28 17:29:39 UTC (rev 27) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java 2008-10-28 17:40:18 UTC (rev 28) @@ -24,10 +24,12 @@ public class DashGMethodAdapter extends MethodAdapter { + DashGLineNumberer lineNumberer; String methodName; - public DashGMethodAdapter(MethodVisitor mv, String name) { + public DashGMethodAdapter(MethodVisitor mv, DashGLineNumberer ln, String name) { super(mv); + lineNumberer = ln; methodName = name; } @@ -110,8 +112,6 @@ private void addLine() { Label l = new Label(); super.visitLabel(l); - Integer srcLine = Integer.valueOf(0); - if (srcLine != null) - super.visitLineNumber(srcLine.intValue(), l); + super.visitLineNumber(lineNumberer.getLineNumber(), l); } } Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-10-28 17:29:39 UTC (rev 27) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-10-28 17:40:18 UTC (rev 28) @@ -115,7 +115,8 @@ ClassReader cr = new ClassReader(bis); ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS); - ClassAdapter ca = new DashGClassAdapter(new TraceClassVisitor(cw, new DashGSourceWriter(pw, packageName)), baseName); + DashGSourceWriter sw = new DashGSourceWriter(pw, packageName); + ClassAdapter ca = new DashGClassAdapter(new TraceClassVisitor(cw, sw), sw, baseName); cr.accept(ca, 0); byte[] classData = cw.toByteArray(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 17:29:48
|
Revision: 27 http://dashg.svn.sourceforge.net/dashg/?rev=27&view=rev Author: dbrosius Date: 2008-10-28 17:29:39 +0000 (Tue, 28 Oct 2008) Log Message: ----------- implement the interface Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGSourceWriter.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGSourceWriter.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGSourceWriter.java 2008-10-28 17:28:47 UTC (rev 26) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGSourceWriter.java 2008-10-28 17:29:39 UTC (rev 27) @@ -23,7 +23,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -public class DashGSourceWriter extends PrintWriter { +public class DashGSourceWriter extends PrintWriter implements DashGLineNumberer { enum State {BeforeClass, InClass, InMethod}; @@ -52,6 +52,10 @@ } } + public int getLineNumber() { + return lineNumber; + } + @Override public void print(String s) { String[] lines = s.split("\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-10-28 17:28:57
|
Revision: 26 http://dashg.svn.sourceforge.net/dashg/?rev=26&view=rev Author: dbrosius Date: 2008-10-28 17:28:47 +0000 (Tue, 28 Oct 2008) Log Message: ----------- interface for getting line numbers for the SourceWriter Added Paths: ----------- trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java Added: trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java (rev 0) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java 2008-10-28 17:28:47 UTC (rev 26) @@ -0,0 +1,23 @@ +/* + * dashg - A debug symbols (-g) injector + * Copyright (C) 2008 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.mebigfatguy.dashg; + +public interface DashGLineNumberer { + int getLineNumber(); +} Property changes on: trunk/dashg/src/com/mebigfatguy/dashg/DashGLineNumberer.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |