JDK-4992932 : REGRESSION: "Unexpected JDWP Error: 35" with access to "this" in a constructor.
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-02-11
  • Updated: 2004-02-12
  • Resolved: 2004-02-12
Related Reports
Duplicate :  
Description

Name: rmT116609			Date: 02/11/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When trying to access "this" within a constructor in any way from JDB or
other JDI-based debuggers, the result is "Unexpected JDWP Error: 35".

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile code and debug with JDB, set breakpoint at line 1,
run, step, print this.

BTW, The program has to be compiled in debug mode (-g) to show the problem. It does work if it is not compiled in debug mode.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect to see value of "this".
ACTUAL -
com.sun.jdi.InternalException: Unexpected JDWP Error: 35
 this = null

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Here is output from a jdb run:

C:\tmp>jdb A
Initializing jdb ...
> stop at A:3
Deferring breakpoint A:3.
It will be set after the class is loaded.
> run
run A
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Set deferred breakpoint A:3

Breakpoint hit: "thread=main", A.main(), line=3 bci=0
3             A a = new A();

main[1] step
>
Step completed: "thread=main", A.<init>(), line=5 bci=0
5           public A() {

main[1] print this
com.sun.jdi.InternalException: Unexpected JDWP Error: 35
 this = null
main[1]


Here is a trace from our jdi-based debugger:

com.sun.jdi.InternalException: Unexpected JDWP Error: 35
	at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:43)
	at com.sun.tools.jdi.StackFrameImpl.thisObject(StackFrameImpl.java:125)
	at grasp.debugger.JPDADebug.setLocalsData_(JPDADebug.java:1746)



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
------------------------------------------------------------------
    public class A {
       public static void main(String[] args) {
         A a = new A();
      }
       public A() {
         int i = 0;
         i++;
      }
   }
----------------------------------------------------------------
---------- END SOURCE ----------

Release Regression From : 1.4.2
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Incident Review ID: 237884) 
======================================================================

Comments
PUBLIC COMMENTS .
10-06-2004

EVALUATION Closing as a dup of: 4918173 JVMTI GetLocalVariableTable returns two 'this' variables for ctor ###@###.### 2004-02-12
12-02-2004