Matching line numbers from debug-compiled code to original source
Laran Evans <[email protected]> Fri, 24 Jul 2009 12:04:19 -0400
| Newsgroups | gmane.comp.jakarta.bcel.user |
|---|---|
| Message-ID | <[email protected]> |
I've been reading through the documentation (mostly the BCEL JavaDocs) to find out how to do this. I'm compiling code with debugging info enabled. So, the line number info is in there. What I need to do is take the compiled .class file, and do something like this: for each method in myClass: - Code code = method.getCode(); - String instructions = Utility.codeToString(code.getCode(), code.getConstantPool(), 0, -1, false) - Figure out the line number in the source code for each (or at least some) instruction. How would I do this? I've been looking at LineNumberTable but haven't figured out how to put the pieces together. So, how would I do this? Thanks.