Lines 159-189
Link Here
|
159 |
} |
159 |
} |
160 |
|
160 |
|
161 |
public void terminate() throws MIException { |
161 |
public void terminate() throws MIException { |
162 |
// An inferior will be destroy():interrupt and kill if |
162 |
// never mind why the debugger ended up in the state that it is |
163 |
// - For attach session: |
163 |
// in. just execute a "kill", ignore result, + "exit" |
164 |
// the inferior was not disconnected yet (no need to try |
164 |
// |
165 |
// to kill a disconnected program). |
165 |
// |
166 |
// - For Program session: |
166 |
try |
167 |
// if the inferior was not terminated. |
167 |
{ |
168 |
// - For PostMortem(Core): send event |
168 |
CommandFactory factory = session.getCommandFactory(); |
169 |
// else noop |
169 |
MIExecAbort abort = factory.createMIExecAbort(); |
170 |
if ((session.isAttachSession() && isConnected()) || (session.isProgramSession() && !isTerminated())) { |
170 |
session.postCommand0(abort, session.getCommandTimeout()); |
171 |
// Try to interrupt the inferior, first. |
171 |
abort.getMIInfo(); |
172 |
if (isRunning()) { |
172 |
} catch (MIException e) |
173 |
interrupt(); |
173 |
{ |
174 |
} |
174 |
// ignore error. An error is expected when terminate is |
175 |
int token = 0; |
175 |
// executed on a target that is in the disconnected state. |
176 |
if (isSuspended()) { |
176 |
} |
177 |
CommandFactory factory = session.getCommandFactory(); |
177 |
setTerminated(); |
178 |
MIExecAbort abort = factory.createMIExecAbort(); |
|
|
179 |
session.postCommand0(abort, session.getCommandTimeout()); |
180 |
abort.getMIInfo(); |
181 |
token = abort.getToken(); |
182 |
} |
183 |
setTerminated(token, true); |
184 |
} else if (session.isCoreSession() && !isTerminated()){ |
185 |
setTerminated(); |
186 |
} |
187 |
} |
178 |
} |
188 |
|
179 |
|
189 |
public void interrupt() throws MIException { |
180 |
public void interrupt() throws MIException { |