|
Lines 38-43
Link Here
|
| 38 |
import org.eclipse.dd.dsf.concurrent.IDsfStatusConstants; |
38 |
import org.eclipse.dd.dsf.concurrent.IDsfStatusConstants; |
| 39 |
import org.eclipse.dd.dsf.concurrent.RequestMonitor; |
39 |
import org.eclipse.dd.dsf.concurrent.RequestMonitor; |
| 40 |
import org.eclipse.dd.dsf.concurrent.Sequence; |
40 |
import org.eclipse.dd.dsf.concurrent.Sequence; |
|
|
41 |
import org.eclipse.dd.dsf.datamodel.AbstractDMEvent; |
| 41 |
import org.eclipse.dd.dsf.debug.service.command.ICommandControl; |
42 |
import org.eclipse.dd.dsf.debug.service.command.ICommandControl; |
| 42 |
import org.eclipse.dd.dsf.service.DsfServiceEventHandler; |
43 |
import org.eclipse.dd.dsf.service.DsfServiceEventHandler; |
| 43 |
import org.eclipse.dd.dsf.service.DsfSession; |
44 |
import org.eclipse.dd.dsf.service.DsfSession; |
|
Lines 72-77
Link Here
|
| 72 |
*/ |
73 |
*/ |
| 73 |
public class GDBControl extends AbstractMIControl { |
74 |
public class GDBControl extends AbstractMIControl { |
| 74 |
|
75 |
|
|
|
76 |
/** |
| 77 |
* Event indicating that the back end process has started. |
| 78 |
*/ |
| 79 |
public static class GDBControlInitializedDMEvent extends AbstractDMEvent<ICommandControlDMContext> |
| 80 |
implements ICommandControlInitializedDMEvent |
| 81 |
{ |
| 82 |
public GDBControlInitializedDMEvent(GDBControlDMContext context) { |
| 83 |
super(context); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Event indicating that the back end process has terminated. |
| 89 |
*/ |
| 90 |
public static class GDBControlShutdownDMEvent extends AbstractDMEvent<ICommandControlDMContext> |
| 91 |
implements ICommandControlShutdownDMEvent |
| 92 |
{ |
| 93 |
public GDBControlShutdownDMEvent(GDBControlDMContext context) { |
| 94 |
super(context); |
| 95 |
} |
| 96 |
} |
| 75 |
|
97 |
|
| 76 |
private static int fgInstanceCounter = 0; |
98 |
private static int fgInstanceCounter = 0; |
| 77 |
private final GDBControlDMContext fControlDmc; |
99 |
private final GDBControlDMContext fControlDmc; |
|
Lines 98-104
Link Here
|
| 98 |
private PTY fPty; |
120 |
private PTY fPty; |
| 99 |
|
121 |
|
| 100 |
public GDBControl(DsfSession session, ILaunchConfiguration config) { |
122 |
public GDBControl(DsfSession session, ILaunchConfiguration config) { |
| 101 |
super(session); |
123 |
super(session, "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 102 |
fSessionType = LaunchUtils.getSessionType(config); |
124 |
fSessionType = LaunchUtils.getSessionType(config); |
| 103 |
fAttach = LaunchUtils.getIsAttach(config); |
125 |
fAttach = LaunchUtils.getIsAttach(config); |
| 104 |
fGdbPath = LaunchUtils.getGDBPath(config); |
126 |
fGdbPath = LaunchUtils.getGDBPath(config); |
|
Lines 107-124
Link Here
|
| 107 |
} catch (CoreException e) { |
129 |
} catch (CoreException e) { |
| 108 |
fExecPath = new Path(""); //$NON-NLS-1$ |
130 |
fExecPath = new Path(""); //$NON-NLS-1$ |
| 109 |
} |
131 |
} |
| 110 |
fControlDmc = new GDBControlDMContext(session.getId(), "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ |
132 |
fControlDmc = new GDBControlDMContext(session.getId(), getId()); |
| 111 |
} |
133 |
} |
| 112 |
|
134 |
|
| 113 |
@Deprecated |
135 |
@Deprecated |
| 114 |
public GDBControl(DsfSession session, IPath gdbPath, IPath execPath, SessionType sessionType, boolean attach, int gdbLaunchTimeout) { |
136 |
public GDBControl(DsfSession session, IPath gdbPath, IPath execPath, SessionType sessionType, boolean attach, int gdbLaunchTimeout) { |
| 115 |
super(session); |
137 |
super(session, "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 116 |
fSessionType = sessionType; |
138 |
fSessionType = sessionType; |
| 117 |
fAttach = attach; |
139 |
fAttach = attach; |
| 118 |
fGdbPath = gdbPath; |
140 |
fGdbPath = gdbPath; |
| 119 |
fExecPath = execPath; |
141 |
fExecPath = execPath; |
| 120 |
fGDBLaunchTimeout = gdbLaunchTimeout; |
142 |
fGDBLaunchTimeout = gdbLaunchTimeout; |
| 121 |
fControlDmc = new GDBControlDMContext(session.getId(), "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ |
143 |
fControlDmc = new GDBControlDMContext(session.getId(), getId()); |
| 122 |
} |
144 |
} |
| 123 |
|
145 |
|
| 124 |
@Override |
146 |
@Override |
|
Lines 174-179
Link Here
|
| 174 |
return fControlDmc; |
196 |
return fControlDmc; |
| 175 |
} |
197 |
} |
| 176 |
|
198 |
|
|
|
199 |
public ICommandControlDMContext getContext() { |
| 200 |
return fControlDmc; |
| 201 |
} |
| 202 |
|
| 177 |
/** |
203 |
/** |
| 178 |
* More strongly typed version of {@link #getControlDMContext()}. |
204 |
* More strongly typed version of {@link #getControlDMContext()}. |
| 179 |
*/ |
205 |
*/ |
|
Lines 418-424
Link Here
|
| 418 |
} |
444 |
} |
| 419 |
|
445 |
|
| 420 |
@DsfServiceEventHandler |
446 |
@DsfServiceEventHandler |
| 421 |
public void eventDispatched(BackendExitedEvent e) { |
447 |
public void eventDispatched(ICommandControlShutdownDMEvent e) { |
| 422 |
// Handle our "GDB Exited" event and stop processing commands. |
448 |
// Handle our "GDB Exited" event and stop processing commands. |
| 423 |
stopCommandProcessing(); |
449 |
stopCommandProcessing(); |
| 424 |
} |
450 |
} |
|
Lines 445-451
Link Here
|
| 445 |
Thread.interrupted(); |
471 |
Thread.interrupted(); |
| 446 |
} finally { |
472 |
} finally { |
| 447 |
fExited = true; |
473 |
fExited = true; |
| 448 |
getSession().dispatchEvent(new BackendExitedEvent(fControlDmc) {}, getProperties()); |
474 |
getSession().dispatchEvent(new GDBControlShutdownDMEvent(fControlDmc) {}, getProperties()); |
| 449 |
} |
475 |
} |
| 450 |
} |
476 |
} |
| 451 |
} |
477 |
} |
|
Lines 717-723
Link Here
|
| 717 |
public void initialize(final RequestMonitor requestMonitor) { |
743 |
public void initialize(final RequestMonitor requestMonitor) { |
| 718 |
getSession().addServiceEventListener(GDBControl.this, null); |
744 |
getSession().addServiceEventListener(GDBControl.this, null); |
| 719 |
register(new String[]{ ICommandControl.class.getName(), AbstractMIControl.class.getName() }, new Hashtable<String,String>()); |
745 |
register(new String[]{ ICommandControl.class.getName(), AbstractMIControl.class.getName() }, new Hashtable<String,String>()); |
| 720 |
getSession().dispatchEvent(new BackendStartedEvent(getGDBDMContext()), getProperties()); |
746 |
getSession().dispatchEvent(new GDBControlInitializedDMEvent(getGDBDMContext()), getProperties()); |
| 721 |
requestMonitor.done(); |
747 |
requestMonitor.done(); |
| 722 |
} |
748 |
} |
| 723 |
|
749 |
|