Bug 287795 - No option to 'set next statement� as in VC++ during debug.
Summary: No option to 'set next statement� as in VC++ during debug.
Status: REOPENED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows Vista
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-27 04:24 EDT by Ravi CLA
Modified: 2011-05-09 15:33 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ravi CLA 2009-08-27 04:24:05 EDT
I've used Eclipse COM NEON, EUROPA, GANYMEDE & now am using GALILEO but during Debug, there's no option to 'set next statement’ as in VC++ where we can skip statements at debug time.

Kindly request you to provide this feature ASAP as it's highly convenient for the developers.
Comment 1 Remy Suen CLA 2009-08-27 07:49:26 EDT
It's not clear to me whether this is a Debug problem or a CDT problem so I'll let the Debug guys decide.

Ravi, if you want to skip statements, I suggest you go to the next line you want to suspend at, and use Ctrl+R which will cause the debugger to run up to that line and then suspend. This should work in the Java debugging case anyway and I suspect CDT should support this.
Comment 2 Nobody - feel free to take it CLA 2009-08-27 10:31:36 EDT
CDT/CDI debugger has a feature "Resume At Line" which allows users to resume the execution from the line selected in the editor. Is this what you are requesting?
Comment 3 Ravi CLA 2009-08-27 22:35:48 EDT
Thanks for the immediate response.

I'm working in Android Platform using Eclipse Galileo.

The 'set next statement' functionality in VC++ works as described below:

void method(){

if(false) //Line 1
System.out.println("Just right click in debug mode & set next statement to this line 2 & this statement will be printed");

}

Description: As Line 1 would always be evaluated to false hence, line 2 should never execute normally but through 'Set Next Statement' feature, we can skip the execution of line 1 during debug mode & hence, execute Line 2 without checking Line 1.

This 'Set Next Statement' can also be used to Jump to other methods in other classes as well.

CTRL + R executes the statements & then, suspends which is similar to 'Run to Cursor' feature in VC++.

As Android is based on Java, AFAIK CDT doesn't figure here.

Thanks,
Ravi.
Comment 4 Nobody - feel free to take it CLA 2009-08-28 08:45:35 EDT
Reassigning to JDT Debug.
Comment 5 Darin Wright CLA 2009-08-31 09:56:30 EDT
Currently, this is not possible with the Java debugger as the native debug interface does not provide the ability to move/set the program counter arbitrarily.
Comment 6 Ravi CLA 2009-09-01 00:04:28 EDT
Yes, accepted that there is no provision to set the program counter but Set Next Statement is a very much valuable feature for debugging & is an essential feature, leading to preference for particular IDE's.

Kindly requesting you to consider this as an enhancement & provide this feature in future versions of Eclipse.
Comment 7 Darin Wright CLA 2009-09-01 09:39:30 EDT
The java debugger cannot support this feature unless the underlying native debug interface supports it... JDI/JPDA does not support setting the next statement.

http://java.sun.com/javase/6/docs/technotes/guides/jpda/index.html
Comment 8 Marc Khouzam CLA 2009-09-09 21:27:47 EDT
For what it's worth, this could be done in CDT as GDB does support this.  But that won't help with Android if I understand correctly.
Comment 9 Ravi CLA 2009-09-11 00:02:19 EDT
Yes, Please provide it in CDT. Meanwhile, I've requested Sun for the native interface to support changing the program counter.
Comment 10 Ravi CLA 2010-03-11 21:52:24 EST
Not available in CDT till now.
I've requested SUN(Oracle) to provide this useful feature but I've received no response so, not available in JDT also.

Could you be of help to all the Java Developers?
Comment 11 Remy Suen CLA 2010-03-11 22:03:29 EST
(In reply to comment #10)
> Not available in CDT till now.
> I've requested SUN(Oracle) to provide this useful feature but I've received no
> response so, not available in JDT also.
> 
> Could you be of help to all the Java Developers?

I'm not sure what you wish the Eclipse developers to do here. As Darin noted, the JPDA needs to spec this feature first. You need to engage and follow up with the Java community if you want this to happen.

You may also wish to speak with the Android and Android tooling team. It may be possible for them to implement this feature on their side in the Dalvik VM.
Comment 12 homedev CLA 2011-01-13 12:36:49 EST
(In reply to comment #7)
> The java debugger cannot support this feature unless the underlying native
> debug interface supports it... JDI/JPDA does not support setting the next
> statement.
> 
> http://java.sun.com/javase/6/docs/technotes/guides/jpda/index.html

While not possible to set next statement anywhere, sometimes the most useful thing
about this feature is to skip execution of a single method call.

Maybe I'm way off here, but in JVM 6 there is an option to "Force Early Return" from a method:
http://download.oracle.com/javase/6/docs/platform/jvmti/jvmti.html#ForceEarlyReturn

So as a workaround, one could theoretically implement this with:
* step into method
* force early return immediately

Optionally, you can do this several times to emulate "set next statment" as long
as there is no "atomic" line of execution.

Just an idea, not sure it would actually work.