Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen does the JVM omit line info in a stack trace and how can I prevent it?
    primarykey
    data
    text
    <p>I have a very confusing situation:</p> <p>I have a class that is compiled with line info on (verified using <code>javap -l</code>). This class gets loaded and instrumented with ASM. I verified that the correct class is loaded (i.e. not a stale class file from somewhere else). And I also made sure that the ASM flag <code>ClassReader.SKIP_DEBUG</code> is not set. Now if I call <code>Thread.currentThread().getStackTrace()</code>, I get <code>StackTraceElement</code>s concerning this class that miss the line info. When debugging in Eclipse, the line info shows in the stack trace. I also made sure that the JVM is started with <code>-Xint</code> just to make sure the info is not erased as a optimization when the code is JIT compiled.</p> <p>And most confusing: although all classes are loaded and instrumented the same, this is only true for some classes, not for all. This is the main reason, why I think this has got something to do with the JVM.</p> <p>So my question is: does the JVM omit line info in the stack trace, if so when and how can I prevent this?</p> <p><strong>Edit:</strong> Just to make things clear: This is the class file of the source file I have in front of me, not of a 3rd party library. And as should be clear from above I tried hard to make sure the info is in the bytecode.</p> <p><strong>Edit:</strong> Now I even found an example where one <code>StackTraceElement</code> has line number info and another one hasn't and they are concerned with different methods <strong><em>from the same class</em></strong>!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload