Bug 170912 - Local var 'size' not shown when stepping through Composite.computeSize
Summary: Local var 'size' not shown when stepping through Composite.computeSize
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: readme
Depends on:
Blocks:
 
Reported: 2007-01-18 09:51 EST by Nick Edgar CLA
Modified: 2007-06-24 18:41 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2007-01-18 09:51:59 EST
 
Comment 1 Nick Edgar CLA 2007-01-18 09:55:40 EST
3.3 M3
VM: IBM 1.5.0 SR3

- stepping through some layout code, I stepped into Composite.computeSize(int,int,boolean) (the receiver was actually a ui.forms LayoutComposite)
- stepped past where size was declared (as: Point size;)
- stepped past the if block (it went through the else block which has: 		size = minimumSize (wHint, hHint, changed);)
- size did not show up in the Variables view
- stepped past where trim was declared and assigned
- trim showed up OK, but still no size
Comment 2 Darin Wright CLA 2007-01-18 10:10:00 EST
Appears to be an issue with the IBM 1.5 VMs. Does not happen with Sun VMs or IBM 1.4.x VMs.
Comment 3 Nick Edgar CLA 2007-01-18 10:23:24 EST
Do you know under which conditions it does this?
Is it just for vars declared before they're assigned?
Comment 4 Darin Wright CLA 2007-01-18 10:42:57 EST
Can reproduce with a simple case:

import java.awt.Point;
import java.awt.Rectangle;


public class Locals {
	
	public static void main(String[] args) {
		Locals locals = new Locals();
		locals.simple(true);
	}	
	
	public void simple(boolean bool) {
		Object o;
		if (bool) {
			o = new Point(1,2);
		} else {
			o = new Point(3,4);
		}
		System.err.println(o);
	}
}


javap shows the variable table as:

public void simple(boolean);
  LocalVariableTable:
   Start  Length  Slot  Name   Signature
   0      35      0    this       LLocals;
   0      35      1    bool       Z
   14      3      2    o       Ljava/lang/Object;
   27      8      2    o       Ljava/lang/Object;


When debugging with IBM 1.4.x VM, the variable 'o' (second occurrence) appears with the correct start index, but a length of 40. When debugging with IBM 1.5.x VM, the variable appears with correct start index, but a length of 0 (and thus, does not appear visible, as according to the JDWP spec). In both cases, the length attributes are incorrect from the IBM VM.
Comment 5 Darin Wright CLA 2007-01-18 10:54:40 EST
I'm not sure what all the cases are - but it definitely appears to be a bug somewhere on the VM side, we're just doing a readInt() from a DataInputStream and getting '40' back. 

Marking as Won't fix. Will file a bug with VM team.
Comment 6 Darin Wright CLA 2007-01-18 10:55:22 EST
Should be a readme
Comment 7 Darin Wright CLA 2007-01-18 10:58:04 EST
CC'ing VM team member so they are aware of the issue.
Comment 8 Nick Edgar CLA 2007-01-18 11:02:56 EST
Thanks for the info. Graham, if there's a later VM, I'd be happy to check this case.
Comment 9 Graham Chapman CLA 2007-01-18 14:27:50 EST
I'll check into it.  In the 2.3 VM (Java5 for most customers), we introduced some code to verify and shorten local variable ranges, because the Sun JDK compilers often produce completely invalid local variable tables, which were causing the VM to crash.  It's possible there's an error in this code.
Comment 10 Graham Chapman CLA 2007-01-18 16:08:06 EST
The problem is indeed the local variable shortening.  Without going into too much detail, the issue is that there is a branch from outside the visible range of the second "o" variable to within it's range.  As a result, we shorten the end of the visible range to the branch target, which in this case results in the visible range being empty.
Comment 11 Graham Chapman CLA 2007-01-18 16:17:44 EST
FYI, I've opened:

https://bugs.ottawa.ibm.com/show_bug.cgi?id=123732

to track this from our side.
Comment 12 Graham Chapman CLA 2007-06-24 18:41:22 EDT
Now covered by CMVC 121765.  Will be addressed for 150 SR6.