Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324144 - A MarkerUpdater is required for JSDT debug
Summary: A MarkerUpdater is required for JSDT debug
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: Debug (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Michael Rennie CLA
QA Contact: Simon Kaegi CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 327019
  Show dependency tree
 
Reported: 2010-08-31 17:56 EDT by jdance CLA
Modified: 2010-11-23 01:35 EST (History)
2 users (show)

See Also:


Attachments
fix (11.19 KB, patch)
2010-11-23 01:34 EST, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jdance CLA 2010-08-31 17:56:41 EDT
This is related to bug #313013.  That is a much higher priority bug.

Version: Helios Release
Build id: 20100617-1415
WTP: Version: 3.2.0.v201005290030-377A78s73533D5L355B

The main issue is that JSDT tries to restrict where breakpoints can be set.  This currently causes bug #313013, where breakpoints cannot be set at valid lines, but also causes the following issues:

1. Start with the following JavaScript.
---------------------
var state = 'hello';

function toggle()
{
	var helloElem = document.getElementById("hello");
	var hello_againElem = document.getElementById("hello_again");
	
	if(state == 'hello')
	{
		helloElem.style.display = 'none';
		hello_againElem.style.display = 'block';
		state='hello_again';
	}
	else
	{
		helloElem.style.display = 'block';
		hello_againElem.style.display = 'none';
		state='hello';
	}
}

2. Set a breakpoint anywhere in function
3. Change toggle to a function literal as shown below:
----------------------
var state = 'hello';

toggle = function()
{
	var helloElem = document.getElementById("hello");
	var hello_againElem = document.getElementById("hello_again");
	
	if(state == 'hello')
	{
		helloElem.style.display = 'none';
		hello_againElem.style.display = 'block';
		state='hello_again';
	}
	else
	{
		helloElem.style.display = 'block';
		hello_againElem.style.display = 'none';
		state='hello';
	}
};

4. The breakpoint can no longer be removed.

This scenario also happens when lines are shifted through editing the file, and the breakpoint ends up on an invalid line.
1. Switch code back to first version of function toggle().  
2. Set a breakpoint in function toggle() at line 8 (the if statement)
3. Go to the start of line 8, and add a newline
4. The breakpoint, now on blank line, cannot be removed.
Comment 1 Michael Rennie CLA 2010-09-02 15:08:09 EDT
(In reply to comment #0)

> 
> The main issue is that JSDT tries to restrict where breakpoints can be set. 

No, you just found a bug in our location verifier...

> This scenario also happens when lines are shifted through editing the file, and
> the breakpoint ends up on an invalid line.

This is another bug: for the fact that we do not a have a marker updater.

Changing the bug to reflect the need for a marker updater.
Comment 2 Michael Rennie CLA 2010-11-23 01:34:01 EST
Created attachment 183631 [details]
fix

The patch provides a marker updater for all markers that subclass the wst.jsdt.debug.marker type.

Also has a couple of performance fixes to leverage the shared AST from JSDT core instead of creating a new one to find breakpoint locations.
Comment 3 Michael Rennie CLA 2010-11-23 01:35:08 EST
applied to HEAD