Bug 1522 - Feature: use #toString to display variable values (1G1Y25J)
Summary: Feature: use #toString to display variable values (1G1Y25J)
Status: RESOLVED DUPLICATE of bug 1663
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 2.0   Edit
Hardware: All Windows NT
: P2 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:14 EDT by Darin Wright CLA
Modified: 2001-10-17 10:17 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2001-10-10 22:14:45 EDT
DW (9/27/00 11:12:31 AM)
	Currently, the "type" of an object is shown in the variables view for 
its value.
	Only Strings and primitive types show concrete values. We should display
	the "toString()" of each object as its value. 

DW (10/23/00 11:22:02 AM)
	Comments from CM:

	First I need to define "thread" <g> because there are 2 of them:
1) when I say "thread", I mean a Java Thread, i.e. an object of type 
java.lang.Thread
2) when I say "vm thread", I mean the debugger's represenation of a thread in 
the VM,
	i.e. an object of type com.oti.defrogger.model.DbgThread

So, when asked for an object's toString, the debugger creates a new thread
to do the following:

- lock the vm thread so that no other thread can invoke toString on that vm 
thread

- set a flag on the vm thread: fIsInvokingToString = true

- use INVOKE_SINGLE_THREADED to send toString() to the object in the vm thread

- set fIsInvokingToString = false

- unlock the vm thread


The fIsInvokingToString flag is checked on a breakpoint, watchpoint, or 
exception,
so that we don't stop on "debugger-invoked" toStrings.

The debugger will stop if the USER runs through a toString method in the 
ordinary
manner (if a breakpoint, watchpoint, or exception is encountered).

DS (10/23/2000 4:14:16 PM)
	3 days

EG (11/8/00 4:54:47 PM)
	I've worked with toString enabled for some time in VAME. It introduces 
both
	performance and run-time behaviour problems. I had to switch it off 
	eventually.

DW (12/7/00 5:14:30 PM)
	Created simple implementation that is not robust. Needs to account for
	breakpoints, exceptions , and timeouts.

DW (12/7/00 7:18:38 PM)
	Added breakpoint support, but did not release implementation into 
plugin file.

	Issue:
		If an infinite loop is hit, how can we stop it? It is a client 
thread - we cannot
		kill it.

	A "evaluation server thread" would be cool, but I don't see how we can 
create
	one without adding code to the target - which cannot always do.

DW (12/8/00 9:26:18 AM)
	Found that LeapFrog debugger does not handle infinite loops. For 
example:

public class Junky {
	
	public static void main(String[] args) {
		Junky j = new Junky();
		j.doit();
		
	}
	
	public void doit() {
		System.out.println(this.toString());
	}
	
	public String toString() {
		int i = 0;
		boolean yes = true;
		while (yes) {
			i++;
		}
		return "never";
	}
}

DW (12/8/00 9:40:38 AM)
	Locking not handled either:

public class Lock {
	
	public synchronized void lock() {
		System.out.println("While in this method, 'this' is locked");
		int i = 0;
		boolean yes = true;
		while (yes) {
			i++;
		}
	}
	
	public synchronized String toString() {
		return "un-locked";
	}
}

public class Locking {
	
	public static void main(String[] args) {
		(new Locking()).doit();
	}
	
	public void doit() {
		final Lock lock = new Lock();
		Runnable r1 = new Runnable() {
			public void run() {
				lock.lock();
			}	
		};
		
		Thread t = new Thread(r1);
		t.start();
		
		lock.hashCode();
		
		System.out.println(lock.toString());
	}
}

DW (12/8/00 12:13:39 PM)
	Moved to inactive, as there is no safe way to do evaluation.

DW (10/2/01 1:16:46 PM)
	Use pop-up text widget to display toString()
Comment 1 Darin Wright CLA 2001-10-12 14:24:07 EDT
Need proposal for different display options.
Comment 2 Darin Wright CLA 2001-10-17 10:17:47 EDT
*** This bug has been marked as a duplicate of 1663 ***