1 24 package org.aspectj.debugger.base; 25 26 import org.aspectj.tools.ide.SourceLine; 27 import com.sun.jdi.*; 28 import java.util.*; 29 import java.io.*; 30 31 import org.aspectj.util.LineNumberTableMapper; 32 33 import org.aspectj.asm.*; 34 35 public class SourceLineFinder { 36 37 private String fullSrcPath; 39 private Location loc; 40 41 static boolean debug = false; 42 static void db(Object o) { 43 if (debug) System.out.println(o); 44 } 45 46 public SourceLineFinder(String fullSrcPath) { 47 this.fullSrcPath = fullSrcPath; 49 } 51 52 public SourceLine findMethod(Location loc) { 53 try { 54 String pkgfullName = loc.declaringType().name(); 55 int pkgLoc = pkgfullName.lastIndexOf('.'); 56 String pkg = (-1 == pkgLoc) ? null : pkgfullName.substring(0, pkgLoc).replace('.', '/'); 57 String attrib = loc.sourceName(); 58 String srcPath = org.aspectj.debugger.base.AJDebugger.INSTANCE.getSourcePath(); 59 File srcRoot = new File(srcPath); 60 61 LineNumberTableMapper lntm = new LineNumberTableMapper(attrib, pkg, srcRoot); 63 System.err.println(">> lntm: " + lntm.getCorrespondingFile(loc.lineNumber()).getPath() + " : " + lntm.getCorrespondingLineNumber(loc.lineNumber())); 64 return new SourceLine(lntm.getCorrespondingFile(loc.lineNumber()).getPath(), lntm.getCorrespondingLineNumber(loc.lineNumber())); 66 67 } catch (com.sun.jdi.AbsentInformationException aie) { 69 System.err.println("> ERROR: absent information."); 70 aie.printStackTrace(); 71 return null; 72 } 73 } 74 75 public SourceLine findMethod(String className, String methodName) { 76 System.err.println(">> findMethod className: " + className + ", methodName: " + methodName); 77 return new SourceLine(className, -1); 80 } 81 82 } 225 | Popular Tags |