Bug 578899 - NPE with breakpoint in ClassLoader.getDefinedPackage()
This change adds null checks to callers of
JDIStackFrame.getUnderlyingStackFrame(), to prevent NPEs that are not
handled by JDT. Such NPEs result in an error dialog.
JDIStackFrame.getUnderlyingStackFrame() can return null, if the
JDIStackFrame object is used after JDIThread.disposeStackFrames() is
called on the respective JDIThread.
In particular, JDIStackFrame.fStackFrame is set to null on a thread
resume. When getUnderlyingStackFrame() is called with a null in
fStackFrame, and a suspended thread (e.g. the next breakpoint was hit),
the method relies on JDIThread.computeStackFrames() to set the value of
fStackFrame. This is done in JDIStackFrame.bind(). However, after a
JDIThread.disposeStackFrames() call, JDIThread no longer has a reference
to the original JDIStackFrame object, and so will not set its
fStackFrame. So getUnderlyingStackFrame() returns a null.
JDIThread.disposeStackFrames() is called when a thread start event is
sent by the debuggee JVM, and JDT finds a JDIThread object to match the
underlying JVM thread (the stack frames of that JDIThread are then
Signed-off-by: Simeon Andreev <firstname.lastname@example.org>
Tested-by: JDT Bot <email@example.com>
Reviewed-by: Andrey Loskutov <firstname.lastname@example.org>
5 files changed