Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332292

Summary: [cdt] Enable special run control actions run-to-line, move-to-line and resume-at-line
Product: [Tools] TCF Reporter: Anton Leherbauer <aleherb+eclipse>
Component: DebugAssignee: Project Inbox <tcf.debug-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: eugene
Version: unspecified   
Target Milestone: 0.4.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Implements special run control support
none
Implements special run control support (2)
none
Implements special run control support (3) eugene: iplog+

Description Anton Leherbauer CLA 2010-12-10 06:11:00 EST
CDT provides generic actions for Run to Line, Move to Line and Resume at Line.
The TCF debugger should provide support for those both in the editor and in the disassembly view.
Comment 1 Anton Leherbauer CLA 2010-12-10 06:50:35 EST
Created attachment 184942 [details]
Implements special run control support

Known limitations:
- The preference "Skip breakpoints during a 'Run to Line' operation" is ignored
- After move-to-line, the current stack frame and IP annotation only update if
  an execution context is selected, but not when the top stack frame is selected.
Comment 2 Anton Leherbauer CLA 2010-12-10 07:39:18 EST
Created attachment 184949 [details]
Implements special run control support (2)

Fixed a little bug in previous patch.
Comment 3 Eugene Tarassov CLA 2010-12-13 14:36:42 EST
I'm having a problem with the patch.
The patch adds this call at the plugin startup:
EvaluationContextManager.startup();

It causes Eclipse to crash:

!ENTRY org.eclipse.osgi 4 0 2010-12-13 11:22:57.125
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.widgets.Display.error(Display.java:1249)
	at org.eclipse.swt.widgets.Display.checkDevice(Display.java:755)
	at org.eclipse.swt.widgets.Display.addListener(Display.java:617)
	at org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.<init>(IDEWorkbenchAdvisor.java:170)
	at org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.<init>(IDEWorkbenchAdvisor.java:178)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:116)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)

The root cause appears to be Display object that is created too early and on a wrong thread by calling Display.getDefault() from EvaluationContextManager.startup(). As result, Start Level Event Dispatcher thread becomes the display thread, instead of Main.
Comment 4 Anton Leherbauer CLA 2010-12-14 03:02:38 EST
Interesting.  I did not run into this problem, but I see that it's possible.  I'll fix that.
Comment 5 Anton Leherbauer CLA 2010-12-14 06:00:15 EST
Created attachment 185120 [details]
Implements special run control support (3)

I still cannot reproduce, but using a WorkbenchJob to initialize the EvaluationContextManager should fix the problem.
Comment 6 Eugene Tarassov CLA 2010-12-14 16:26:01 EST
It works now.
I have committed the patch, with few changes:
1. I changed the code to use cached registers info.
2. I added TCFModel.setDebugViewSelection() call to update current stack frame and IP annotation after move-to-line.

Thanks!
Comment 7 Anton Leherbauer CLA 2010-12-15 02:09:38 EST
(In reply to comment #6)
> 1. I changed the code to use cached registers info.
> 2. I added TCFModel.setDebugViewSelection() call to update current stack frame
> and IP annotation after move-to-line.

Great, thanks.  I didn't notice there is API for that.
Comment 8 Martin Oberhuber CLA 2013-06-05 06:26:58 EDT
Bulk change: Marking all bugs from the TM era (until June 2011) target 0.3