]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCmdExec.cpp
9539 Make zvol operations use _by_dnode routines
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdCmdExec.cpp
1 //===-- MICmdCmdExec.cpp ----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // Overview:    CMICmdCmdExecRun                implementation.
11 //              CMICmdCmdExecContinue           implementation.
12 //              CMICmdCmdExecNext               implementation.
13 //              CMICmdCmdExecStep               implementation.
14 //              CMICmdCmdExecNextInstruction    implementation.
15 //              CMICmdCmdExecStepInstruction    implementation.
16 //              CMICmdCmdExecFinish             implementation.
17 //              CMICmdCmdExecInterrupt          implementation.
18 //              CMICmdCmdExecArguments          implementation.
19 //              CMICmdCmdExecAbort              implementation.
20
21 // Third Party Headers:
22 #include "lldb/API/SBCommandInterpreter.h"
23 #include "lldb/API/SBProcess.h"
24 #include "lldb/API/SBStream.h"
25 #include "lldb/lldb-enumerations.h"
26
27 // In-house headers:
28 #include "MICmdArgValListOfN.h"
29 #include "MICmdArgValNumber.h"
30 #include "MICmdArgValOptionLong.h"
31 #include "MICmdArgValOptionShort.h"
32 #include "MICmdArgValString.h"
33 #include "MICmdArgValThreadGrp.h"
34 #include "MICmdCmdExec.h"
35 #include "MICmnLLDBDebugSessionInfo.h"
36 #include "MICmnLLDBDebugger.h"
37 #include "MICmnMIOutOfBandRecord.h"
38 #include "MICmnMIResultRecord.h"
39 #include "MICmnMIValueConst.h"
40 #include "MICmnStreamStdout.h"
41 #include "MIDriver.h"
42
43 //++
44 //------------------------------------------------------------------------------------
45 // Details: CMICmdCmdExecRun constructor.
46 // Type:    Method.
47 // Args:    None.
48 // Return:  None.
49 // Throws:  None.
50 //--
51 CMICmdCmdExecRun::CMICmdCmdExecRun() : m_constStrArgStart("start") {
52   // Command factory matches this name with that received from the stdin stream
53   m_strMiCmd = "exec-run";
54
55   // Required by the CMICmdFactory when registering *this command
56   m_pSelfCreatorFn = &CMICmdCmdExecRun::CreateSelf;
57 }
58
59 //++
60 //------------------------------------------------------------------------------------
61 // Details: CMICmdCmdExecRun destructor.
62 // Type:    Overrideable.
63 // Args:    None.
64 // Return:  None.
65 // Throws:  None.
66 //--
67 CMICmdCmdExecRun::~CMICmdCmdExecRun() {}
68
69 //++
70 //------------------------------------------------------------------------------------
71 // Details: The invoker requires this function. It parses the command line
72 // options'
73 //          arguments to extract values for each of those arguments.
74 // Type:    Overridden.
75 // Args:    None.
76 // Return:  MIstatus::success - Functional succeeded.
77 //          MIstatus::failure - Functional failed.
78 // Throws:  None.
79 //--
80 bool CMICmdCmdExecRun::ParseArgs() {
81   m_setCmdArgs.Add(new CMICmdArgValOptionLong(
82       m_constStrArgStart, false, true,
83       CMICmdArgValListBase::eArgValType_OptionLong, 0));
84   return ParseValidateCmdOptions();
85 }
86
87 //++
88 //------------------------------------------------------------------------------------
89 // Details: The invoker requires this function. The command does work in this
90 // function.
91 //          The command is likely to communicate with the LLDB SBDebugger in
92 //          here.
93 // Type:    Overridden.
94 // Args:    None.
95 // Return:  MIstatus::success - Functional succeeded.
96 //          MIstatus::failure - Functional failed.
97 // Throws:  None.
98 //--
99 bool CMICmdCmdExecRun::Execute() {
100   CMICmnLLDBDebugSessionInfo &rSessionInfo(
101       CMICmnLLDBDebugSessionInfo::Instance());
102   lldb::SBError error;
103   lldb::SBStream errMsg;
104   lldb::SBLaunchInfo launchInfo = rSessionInfo.GetTarget().GetLaunchInfo();
105   launchInfo.SetListener(rSessionInfo.GetListener());
106
107   // Run to first instruction or main() requested?
108   CMICMDBASE_GETOPTION(pArgStart, OptionLong, m_constStrArgStart);
109   if (pArgStart->GetFound()) {
110     launchInfo.SetLaunchFlags(launchInfo.GetLaunchFlags() |
111                               lldb::eLaunchFlagStopAtEntry);
112   }
113
114   lldb::SBProcess process = rSessionInfo.GetTarget().Launch(launchInfo, error);
115   if ((!process.IsValid()) || (error.Fail())) {
116     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
117                                    m_cmdData.strMiCmd.c_str(),
118                                    errMsg.GetData()));
119     return MIstatus::failure;
120   }
121
122   if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) {
123     const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription());
124     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE),
125                                    m_cmdData.strMiCmd.c_str(),
126                                    rErrMsg.c_str()));
127     return MIstatus::failure;
128   }
129   return MIstatus::success;
130 }
131
132 //++
133 //------------------------------------------------------------------------------------
134 // Details: The invoker requires this function. The command prepares a MI Record
135 // Result
136 //          for the work carried out in the Execute().
137 //          Called only if Execute() set status as successful on completion.
138 // Type:    Overridden.
139 // Args:    None.
140 // Return:  MIstatus::success - Functional succeeded.
141 //          MIstatus::failure - Functional failed.
142 // Throws:  None.
143 //--
144 bool CMICmdCmdExecRun::Acknowledge() {
145   const CMICmnMIResultRecord miRecordResult(
146       m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
147   m_miResultRecord = miRecordResult;
148
149   CMICmnLLDBDebugSessionInfo &rSessionInfo(
150       CMICmnLLDBDebugSessionInfo::Instance());
151   lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
152   // Give the client '=thread-group-started,id="i1" pid="xyz"'
153   m_bHasResultRecordExtra = true;
154   const CMICmnMIValueConst miValueConst2("i1");
155   const CMICmnMIValueResult miValueResult2("id", miValueConst2);
156   const CMIUtilString strPid(CMIUtilString::Format("%lld", pid));
157   const CMICmnMIValueConst miValueConst(strPid);
158   const CMICmnMIValueResult miValueResult("pid", miValueConst);
159   CMICmnMIOutOfBandRecord miOutOfBand(
160       CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, miValueResult2);
161   miOutOfBand.Add(miValueResult);
162   m_miResultRecordExtra = miOutOfBand.GetString();
163
164   return MIstatus::success;
165 }
166
167 //++
168 //------------------------------------------------------------------------------------
169 // Details: Required by the CMICmdFactory when registering *this command. The
170 // factory
171 //          calls this function to create an instance of *this command.
172 // Type:    Static method.
173 // Args:    None.
174 // Return:  CMICmdBase * - Pointer to a new command.
175 // Throws:  None.
176 //--
177 CMICmdBase *CMICmdCmdExecRun::CreateSelf() { return new CMICmdCmdExecRun(); }
178
179 //---------------------------------------------------------------------------------------
180 //---------------------------------------------------------------------------------------
181 //---------------------------------------------------------------------------------------
182
183 //++
184 //------------------------------------------------------------------------------------
185 // Details: CMICmdCmdExecContinue constructor.
186 // Type:    Method.
187 // Args:    None.
188 // Return:  None.
189 // Throws:  None.
190 //--
191 CMICmdCmdExecContinue::CMICmdCmdExecContinue() {
192   // Command factory matches this name with that received from the stdin stream
193   m_strMiCmd = "exec-continue";
194
195   // Required by the CMICmdFactory when registering *this command
196   m_pSelfCreatorFn = &CMICmdCmdExecContinue::CreateSelf;
197 }
198
199 //++
200 //------------------------------------------------------------------------------------
201 // Details: CMICmdCmdExecContinue destructor.
202 // Type:    Overrideable.
203 // Args:    None.
204 // Return:  None.
205 // Throws:  None.
206 //--
207 CMICmdCmdExecContinue::~CMICmdCmdExecContinue() {}
208
209 //++
210 //------------------------------------------------------------------------------------
211 // Details: The invoker requires this function. The command does work in this
212 // function.
213 //          The command is likely to communicate with the LLDB SBDebugger in
214 //          here.
215 // Type:    Overridden.
216 // Args:    None.
217 // Return:  MIstatus::success - Functional succeeded.
218 //          MIstatus::failure - Functional failed.
219 // Throws:  None.
220 //--
221 bool CMICmdCmdExecContinue::Execute() {
222   const char *pCmd = "continue";
223   CMICmnLLDBDebugSessionInfo &rSessionInfo(
224       CMICmnLLDBDebugSessionInfo::Instance());
225   const lldb::ReturnStatus rtn =
226       rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(
227           pCmd, m_lldbResult);
228   MIunused(rtn);
229
230   if (m_lldbResult.GetErrorSize() == 0) {
231     // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
232     if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) {
233       const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription());
234       SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE),
235                                      m_cmdData.strMiCmd.c_str(),
236                                      rErrMsg.c_str()));
237       return MIstatus::failure;
238     }
239   } else {
240     // ToDo: Re-evaluate if this is required when application near finished as
241     // this is parsing LLDB error message
242     // which seems a hack and is code brittle
243     const char *pLldbErr = m_lldbResult.GetError();
244     const CMIUtilString strLldbMsg(CMIUtilString(pLldbErr).StripCREndOfLine());
245     if (strLldbMsg == "error: Process must be launched.") {
246       CMIDriver::Instance().SetExitApplicationFlag(true);
247     }
248   }
249
250   return MIstatus::success;
251 }
252
253 //++
254 //------------------------------------------------------------------------------------
255 // Details: The invoker requires this function. The command prepares a MI Record
256 // Result
257 //          for the work carried out in the Execute().
258 // Type:    Overridden.
259 // Args:    None.
260 // Return:  MIstatus::success - Functional succeeded.
261 //          MIstatus::failure - Functional failed.
262 // Throws:  None.
263 //--
264 bool CMICmdCmdExecContinue::Acknowledge() {
265   if (m_lldbResult.GetErrorSize() > 0) {
266     const CMICmnMIValueConst miValueConst(m_lldbResult.GetError());
267     const CMICmnMIValueResult miValueResult("message", miValueConst);
268     const CMICmnMIResultRecord miRecordResult(
269         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
270         miValueResult);
271     m_miResultRecord = miRecordResult;
272   } else {
273     const CMICmnMIResultRecord miRecordResult(
274         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
275     m_miResultRecord = miRecordResult;
276   }
277
278   return MIstatus::success;
279 }
280
281 //++
282 //------------------------------------------------------------------------------------
283 // Details: Required by the CMICmdFactory when registering *this command. The
284 // factory
285 //          calls this function to create an instance of *this command.
286 // Type:    Static method.
287 // Args:    None.
288 // Return:  CMICmdBase * - Pointer to a new command.
289 // Throws:  None.
290 //--
291 CMICmdBase *CMICmdCmdExecContinue::CreateSelf() {
292   return new CMICmdCmdExecContinue();
293 }
294
295 //---------------------------------------------------------------------------------------
296 //---------------------------------------------------------------------------------------
297 //---------------------------------------------------------------------------------------
298
299 //++
300 //------------------------------------------------------------------------------------
301 // Details: CMICmdCmdExecNext constructor.
302 // Type:    Method.
303 // Args:    None.
304 // Return:  None.
305 // Throws:  None.
306 //--
307 CMICmdCmdExecNext::CMICmdCmdExecNext() : m_constStrArgNumber("number") {
308   // Command factory matches this name with that received from the stdin stream
309   m_strMiCmd = "exec-next";
310
311   // Required by the CMICmdFactory when registering *this command
312   m_pSelfCreatorFn = &CMICmdCmdExecNext::CreateSelf;
313 }
314
315 //++
316 //------------------------------------------------------------------------------------
317 // Details: CMICmdCmdExecNext destructor.
318 // Type:    Overrideable.
319 // Args:    None.
320 // Return:  None.
321 // Throws:  None.
322 //--
323 CMICmdCmdExecNext::~CMICmdCmdExecNext() {}
324
325 //++
326 //------------------------------------------------------------------------------------
327 // Details: The invoker requires this function. The parses the command line
328 // options
329 //          arguments to extract values for each of those arguments.
330 // Type:    Overridden.
331 // Args:    None.
332 // Return:  MIstatus::success - Functional succeeded.
333 //          MIstatus::failure - Functional failed.
334 // Throws:  None.
335 //--
336 bool CMICmdCmdExecNext::ParseArgs() {
337   m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false));
338   return ParseValidateCmdOptions();
339 }
340
341 //++
342 //------------------------------------------------------------------------------------
343 // Details: The invoker requires this function. The command does work in this
344 // function.
345 //          The command is likely to communicate with the LLDB SBDebugger in
346 //          here.
347 // Type:    Overridden.
348 // Args:    None.
349 // Return:  MIstatus::success - Functional succeeded.
350 //          MIstatus::failure - Functional failed.
351 // Throws:  None.
352 //--
353 bool CMICmdCmdExecNext::Execute() {
354   CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
355
356   // Retrieve the --thread option's thread ID (only 1)
357   MIuint64 nThreadId = UINT64_MAX;
358   if (pArgThread->GetFound() &&
359       !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
360     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
361                                    m_cmdData.strMiCmd.c_str(),
362                                    m_constStrArgThread.c_str()));
363     return MIstatus::failure;
364   }
365
366   CMICmnLLDBDebugSessionInfo &rSessionInfo(
367       CMICmnLLDBDebugSessionInfo::Instance());
368   lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
369   CMIUtilString strCmd("thread step-over");
370   if (nThreadId != UINT64_MAX)
371     strCmd += CMIUtilString::Format(" %llu", nThreadId);
372   rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult,
373                                                   false);
374
375   return MIstatus::success;
376 }
377
378 //++
379 //------------------------------------------------------------------------------------
380 // Details: The invoker requires this function. The command prepares a MI Record
381 // Result
382 //          for the work carried out in the Execute().
383 // Type:    Overridden.
384 // Args:    None.
385 // Return:  MIstatus::success - Functional succeeded.
386 //          MIstatus::failure - Functional failed.
387 // Throws:  None.
388 //--
389 bool CMICmdCmdExecNext::Acknowledge() {
390   if (m_lldbResult.GetErrorSize() > 0) {
391     const char *pLldbErr = m_lldbResult.GetError();
392     MIunused(pLldbErr);
393     const CMICmnMIValueConst miValueConst(m_lldbResult.GetError());
394     const CMICmnMIValueResult miValueResult("message", miValueConst);
395     const CMICmnMIResultRecord miRecordResult(
396         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
397         miValueResult);
398     m_miResultRecord = miRecordResult;
399   } else {
400     const CMICmnMIResultRecord miRecordResult(
401         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
402     m_miResultRecord = miRecordResult;
403   }
404
405   return MIstatus::success;
406 }
407
408 //++
409 //------------------------------------------------------------------------------------
410 // Details: Required by the CMICmdFactory when registering *this command. The
411 // factory
412 //          calls this function to create an instance of *this command.
413 // Type:    Static method.
414 // Args:    None.
415 // Return:  CMICmdBase * - Pointer to a new command.
416 // Throws:  None.
417 //--
418 CMICmdBase *CMICmdCmdExecNext::CreateSelf() { return new CMICmdCmdExecNext(); }
419
420 //---------------------------------------------------------------------------------------
421 //---------------------------------------------------------------------------------------
422 //---------------------------------------------------------------------------------------
423
424 //++
425 //------------------------------------------------------------------------------------
426 // Details: CMICmdCmdExecStep constructor.
427 // Type:    Method.
428 // Args:    None.
429 // Return:  None.
430 // Throws:  None.
431 //--
432 CMICmdCmdExecStep::CMICmdCmdExecStep() : m_constStrArgNumber("number") {
433   // Command factory matches this name with that received from the stdin stream
434   m_strMiCmd = "exec-step";
435
436   // Required by the CMICmdFactory when registering *this command
437   m_pSelfCreatorFn = &CMICmdCmdExecStep::CreateSelf;
438 }
439
440 //++
441 //------------------------------------------------------------------------------------
442 // Details: CMICmdCmdExecStep destructor.
443 // Type:    Overrideable.
444 // Args:    None.
445 // Return:  None.
446 // Throws:  None.
447 //--
448 CMICmdCmdExecStep::~CMICmdCmdExecStep() {}
449
450 //++
451 //------------------------------------------------------------------------------------
452 // Details: The invoker requires this function. The parses the command line
453 // options
454 //          arguments to extract values for each of those arguments.
455 // Type:    Overridden.
456 // Args:    None.
457 // Return:  MIstatus::success - Functional succeeded.
458 //          MIstatus::failure - Functional failed.
459 // Throws:  None.
460 //--
461 bool CMICmdCmdExecStep::ParseArgs() {
462   m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false));
463   return ParseValidateCmdOptions();
464 }
465
466 //++
467 //------------------------------------------------------------------------------------
468 // Details: The invoker requires this function. The command does work in this
469 // function.
470 //          The command is likely to communicate with the LLDB SBDebugger in
471 //          here.
472 // Type:    Overridden.
473 // Args:    None.
474 // Return:  MIstatus::success - Functional succeeded.
475 //          MIstatus::failure - Functional failed.
476 // Throws:  None.
477 //--
478 bool CMICmdCmdExecStep::Execute() {
479   CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
480
481   // Retrieve the --thread option's thread ID (only 1)
482   MIuint64 nThreadId = UINT64_MAX;
483   if (pArgThread->GetFound() &&
484       !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
485     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
486                                    m_cmdData.strMiCmd.c_str(),
487                                    m_constStrArgThread.c_str()));
488     return MIstatus::failure;
489   }
490
491   CMICmnLLDBDebugSessionInfo &rSessionInfo(
492       CMICmnLLDBDebugSessionInfo::Instance());
493   lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
494   CMIUtilString strCmd("thread step-in");
495   if (nThreadId != UINT64_MAX)
496     strCmd += CMIUtilString::Format(" %llu", nThreadId);
497   rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult,
498                                                   false);
499
500   return MIstatus::success;
501 }
502
503 //++
504 //------------------------------------------------------------------------------------
505 // Details: The invoker requires this function. The command prepares a MI Record
506 // Result
507 //          for the work carried out in the Execute().
508 // Type:    Overridden.
509 // Args:    None.
510 // Return:  MIstatus::success - Functional succeeded.
511 //          MIstatus::failure - Functional failed.
512 // Throws:  None.
513 //--
514 bool CMICmdCmdExecStep::Acknowledge() {
515   if (m_lldbResult.GetErrorSize() > 0) {
516     const char *pLldbErr = m_lldbResult.GetError();
517     MIunused(pLldbErr);
518     const CMICmnMIValueConst miValueConst(m_lldbResult.GetError());
519     const CMICmnMIValueResult miValueResult("message", miValueConst);
520     const CMICmnMIResultRecord miRecordResult(
521         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
522         miValueResult);
523     m_miResultRecord = miRecordResult;
524   } else {
525     const CMICmnMIResultRecord miRecordResult(
526         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
527     m_miResultRecord = miRecordResult;
528   }
529
530   return MIstatus::success;
531 }
532
533 //++
534 //------------------------------------------------------------------------------------
535 // Details: Required by the CMICmdFactory when registering *this command. The
536 // factory
537 //          calls this function to create an instance of *this command.
538 // Type:    Static method.
539 // Args:    None.
540 // Return:  CMICmdBase * - Pointer to a new command.
541 // Throws:  None.
542 //--
543 CMICmdBase *CMICmdCmdExecStep::CreateSelf() { return new CMICmdCmdExecStep(); }
544
545 //---------------------------------------------------------------------------------------
546 //---------------------------------------------------------------------------------------
547 //---------------------------------------------------------------------------------------
548
549 //++
550 //------------------------------------------------------------------------------------
551 // Details: CMICmdCmdExecNextInstruction constructor.
552 // Type:    Method.
553 // Args:    None.
554 // Return:  None.
555 // Throws:  None.
556 //--
557 CMICmdCmdExecNextInstruction::CMICmdCmdExecNextInstruction()
558     : m_constStrArgNumber("number") {
559   // Command factory matches this name with that received from the stdin stream
560   m_strMiCmd = "exec-next-instruction";
561
562   // Required by the CMICmdFactory when registering *this command
563   m_pSelfCreatorFn = &CMICmdCmdExecNextInstruction::CreateSelf;
564 }
565
566 //++
567 //------------------------------------------------------------------------------------
568 // Details: CMICmdCmdExecNextInstruction destructor.
569 // Type:    Overrideable.
570 // Args:    None.
571 // Return:  None.
572 // Throws:  None.
573 //--
574 CMICmdCmdExecNextInstruction::~CMICmdCmdExecNextInstruction() {}
575
576 //++
577 //------------------------------------------------------------------------------------
578 // Details: The invoker requires this function. The parses the command line
579 // options
580 //          arguments to extract values for each of those arguments.
581 // Type:    Overridden.
582 // Args:    None.
583 // Return:  MIstatus::success - Functional succeeded.
584 //          MIstatus::failure - Functional failed.
585 // Throws:  None.
586 //--
587 bool CMICmdCmdExecNextInstruction::ParseArgs() {
588   m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false));
589   return ParseValidateCmdOptions();
590 }
591
592 //++
593 //------------------------------------------------------------------------------------
594 // Details: The invoker requires this function. The command does work in this
595 // function.
596 //          The command is likely to communicate with the LLDB SBDebugger in
597 //          here.
598 // Type:    Overridden.
599 // Args:    None.
600 // Return:  MIstatus::success - Functional succeeded.
601 //          MIstatus::failure - Functional failed.
602 // Throws:  None.
603 //--
604 bool CMICmdCmdExecNextInstruction::Execute() {
605   CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
606
607   // Retrieve the --thread option's thread ID (only 1)
608   MIuint64 nThreadId = UINT64_MAX;
609   if (pArgThread->GetFound() &&
610       !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
611     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
612                                    m_cmdData.strMiCmd.c_str(),
613                                    m_constStrArgThread.c_str()));
614     return MIstatus::failure;
615   }
616
617   CMICmnLLDBDebugSessionInfo &rSessionInfo(
618       CMICmnLLDBDebugSessionInfo::Instance());
619   lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
620   CMIUtilString strCmd("thread step-inst-over");
621   if (nThreadId != UINT64_MAX)
622     strCmd += CMIUtilString::Format(" %llu", nThreadId);
623   rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult,
624                                                   false);
625
626   return MIstatus::success;
627 }
628
629 //++
630 //------------------------------------------------------------------------------------
631 // Details: The invoker requires this function. The command prepares a MI Record
632 // Result
633 //          for the work carried out in the Execute().
634 // Type:    Overridden.
635 // Args:    None.
636 // Return:  MIstatus::success - Functional succeeded.
637 //          MIstatus::failure - Functional failed.
638 // Throws:  None.
639 //--
640 bool CMICmdCmdExecNextInstruction::Acknowledge() {
641   if (m_lldbResult.GetErrorSize() > 0) {
642     const char *pLldbErr = m_lldbResult.GetError();
643     MIunused(pLldbErr);
644     const CMICmnMIValueConst miValueConst(m_lldbResult.GetError());
645     const CMICmnMIValueResult miValueResult("message", miValueConst);
646     const CMICmnMIResultRecord miRecordResult(
647         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
648         miValueResult);
649     m_miResultRecord = miRecordResult;
650   } else {
651     const CMICmnMIResultRecord miRecordResult(
652         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
653     m_miResultRecord = miRecordResult;
654   }
655
656   return MIstatus::success;
657 }
658
659 //++
660 //------------------------------------------------------------------------------------
661 // Details: Required by the CMICmdFactory when registering *this command. The
662 // factory
663 //          calls this function to create an instance of *this command.
664 // Type:    Static method.
665 // Args:    None.
666 // Return:  CMICmdBase * - Pointer to a new command.
667 // Throws:  None.
668 //--
669 CMICmdBase *CMICmdCmdExecNextInstruction::CreateSelf() {
670   return new CMICmdCmdExecNextInstruction();
671 }
672
673 //---------------------------------------------------------------------------------------
674 //---------------------------------------------------------------------------------------
675 //---------------------------------------------------------------------------------------
676
677 //++
678 //------------------------------------------------------------------------------------
679 // Details: CMICmdCmdExecStepInstruction constructor.
680 // Type:    Method.
681 // Args:    None.
682 // Return:  None.
683 // Throws:  None.
684 //--
685 CMICmdCmdExecStepInstruction::CMICmdCmdExecStepInstruction()
686     : m_constStrArgNumber("number") {
687   // Command factory matches this name with that received from the stdin stream
688   m_strMiCmd = "exec-step-instruction";
689
690   // Required by the CMICmdFactory when registering *this command
691   m_pSelfCreatorFn = &CMICmdCmdExecStepInstruction::CreateSelf;
692 }
693
694 //++
695 //------------------------------------------------------------------------------------
696 // Details: CMICmdCmdExecStepInstruction destructor.
697 // Type:    Overrideable.
698 // Args:    None.
699 // Return:  None.
700 // Throws:  None.
701 //--
702 CMICmdCmdExecStepInstruction::~CMICmdCmdExecStepInstruction() {}
703
704 //++
705 //------------------------------------------------------------------------------------
706 // Details: The invoker requires this function. The parses the command line
707 // options
708 //          arguments to extract values for each of those arguments.
709 // Type:    Overridden.
710 // Args:    None.
711 // Return:  MIstatus::success - Functional succeeded.
712 //          MIstatus::failure - Functional failed.
713 // Throws:  None.
714 //--
715 bool CMICmdCmdExecStepInstruction::ParseArgs() {
716   m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false));
717   return ParseValidateCmdOptions();
718 }
719
720 //++
721 //------------------------------------------------------------------------------------
722 // Details: The invoker requires this function. The command does work in this
723 // function.
724 //          The command is likely to communicate with the LLDB SBDebugger in
725 //          here.
726 // Type:    Overridden.
727 // Args:    None.
728 // Return:  MIstatus::success - Functional succeeded.
729 //          MIstatus::failure - Functional failed.
730 // Throws:  None.
731 //--
732 bool CMICmdCmdExecStepInstruction::Execute() {
733   CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
734
735   // Retrieve the --thread option's thread ID (only 1)
736   MIuint64 nThreadId = UINT64_MAX;
737   if (pArgThread->GetFound() &&
738       !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
739     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
740                                    m_cmdData.strMiCmd.c_str(),
741                                    m_constStrArgThread.c_str()));
742     return MIstatus::failure;
743   }
744
745   CMICmnLLDBDebugSessionInfo &rSessionInfo(
746       CMICmnLLDBDebugSessionInfo::Instance());
747   lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
748   CMIUtilString strCmd("thread step-inst");
749   if (nThreadId != UINT64_MAX)
750     strCmd += CMIUtilString::Format(" %llu", nThreadId);
751   rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult,
752                                                   false);
753
754   return MIstatus::success;
755 }
756
757 //++
758 //------------------------------------------------------------------------------------
759 // Details: The invoker requires this function. The command prepares a MI Record
760 // Result
761 //          for the work carried out in the Execute().
762 // Type:    Overridden.
763 // Args:    None.
764 // Return:  MIstatus::success - Functional succeeded.
765 //          MIstatus::failure - Functional failed.
766 // Throws:  None.
767 //--
768 bool CMICmdCmdExecStepInstruction::Acknowledge() {
769   if (m_lldbResult.GetErrorSize() > 0) {
770     const char *pLldbErr = m_lldbResult.GetError();
771     MIunused(pLldbErr);
772     const CMICmnMIValueConst miValueConst(m_lldbResult.GetError());
773     const CMICmnMIValueResult miValueResult("message", miValueConst);
774     const CMICmnMIResultRecord miRecordResult(
775         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
776         miValueResult);
777     m_miResultRecord = miRecordResult;
778   } else {
779     const CMICmnMIResultRecord miRecordResult(
780         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
781     m_miResultRecord = miRecordResult;
782   }
783
784   return MIstatus::success;
785 }
786
787 //++
788 //------------------------------------------------------------------------------------
789 // Details: Required by the CMICmdFactory when registering *this command. The
790 // factory
791 //          calls this function to create an instance of *this command.
792 // Type:    Static method.
793 // Args:    None.
794 // Return:  CMICmdBase * - Pointer to a new command.
795 // Throws:  None.
796 //--
797 CMICmdBase *CMICmdCmdExecStepInstruction::CreateSelf() {
798   return new CMICmdCmdExecStepInstruction();
799 }
800
801 //---------------------------------------------------------------------------------------
802 //---------------------------------------------------------------------------------------
803 //---------------------------------------------------------------------------------------
804
805 //++
806 //------------------------------------------------------------------------------------
807 // Details: CMICmdCmdExecFinish constructor.
808 // Type:    Method.
809 // Args:    None.
810 // Return:  None.
811 // Throws:  None.
812 //--
813 CMICmdCmdExecFinish::CMICmdCmdExecFinish() {
814   // Command factory matches this name with that received from the stdin stream
815   m_strMiCmd = "exec-finish";
816
817   // Required by the CMICmdFactory when registering *this command
818   m_pSelfCreatorFn = &CMICmdCmdExecFinish::CreateSelf;
819 }
820
821 //++
822 //------------------------------------------------------------------------------------
823 // Details: CMICmdCmdExecFinish destructor.
824 // Type:    Overrideable.
825 // Args:    None.
826 // Return:  None.
827 // Throws:  None.
828 //--
829 CMICmdCmdExecFinish::~CMICmdCmdExecFinish() {}
830
831 //++
832 //------------------------------------------------------------------------------------
833 // Details: The invoker requires this function. The parses the command line
834 // options
835 //          arguments to extract values for each of those arguments.
836 // Type:    Overridden.
837 // Args:    None.
838 // Return:  MIstatus::success - Functional succeeded.
839 //          MIstatus::failure - Functional failed.
840 // Throws:  None.
841 //--
842 bool CMICmdCmdExecFinish::ParseArgs() { return ParseValidateCmdOptions(); }
843
844 //++
845 //------------------------------------------------------------------------------------
846 // Details: The invoker requires this function. The command does work in this
847 // function.
848 //          The command is likely to communicate with the LLDB SBDebugger in
849 //          here.
850 // Type:    Overridden.
851 // Args:    None.
852 // Return:  MIstatus::success - Functional succeeded.
853 //          MIstatus::failure - Functional failed.
854 // Throws:  None.
855 //--
856 bool CMICmdCmdExecFinish::Execute() {
857   CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
858
859   // Retrieve the --thread option's thread ID (only 1)
860   MIuint64 nThreadId = UINT64_MAX;
861   if (pArgThread->GetFound() &&
862       !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
863     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
864                                    m_cmdData.strMiCmd.c_str(),
865                                    m_constStrArgThread.c_str()));
866     return MIstatus::failure;
867   }
868
869   CMICmnLLDBDebugSessionInfo &rSessionInfo(
870       CMICmnLLDBDebugSessionInfo::Instance());
871   lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
872   CMIUtilString strCmd("thread step-out");
873   if (nThreadId != UINT64_MAX)
874     strCmd += CMIUtilString::Format(" %llu", nThreadId);
875   rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult,
876                                                   false);
877
878   return MIstatus::success;
879 }
880
881 //++
882 //------------------------------------------------------------------------------------
883 // Details: The invoker requires this function. The command prepares a MI Record
884 // Result
885 //          for the work carried out in the Execute().
886 // Type:    Overridden.
887 // Args:    None.
888 // Return:  MIstatus::success - Functional succeeded.
889 //          MIstatus::failure - Functional failed.
890 // Throws:  None.
891 //--
892 bool CMICmdCmdExecFinish::Acknowledge() {
893   if (m_lldbResult.GetErrorSize() > 0) {
894     const char *pLldbErr = m_lldbResult.GetError();
895     MIunused(pLldbErr);
896     const CMICmnMIValueConst miValueConst(m_lldbResult.GetError());
897     const CMICmnMIValueResult miValueResult("message", miValueConst);
898     const CMICmnMIResultRecord miRecordResult(
899         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
900         miValueResult);
901     m_miResultRecord = miRecordResult;
902   } else {
903     const CMICmnMIResultRecord miRecordResult(
904         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
905     m_miResultRecord = miRecordResult;
906   }
907
908   return MIstatus::success;
909 }
910
911 //++
912 //------------------------------------------------------------------------------------
913 // Details: Required by the CMICmdFactory when registering *this command. The
914 // factory
915 //          calls this function to create an instance of *this command.
916 // Type:    Static method.
917 // Args:    None.
918 // Return:  CMICmdBase * - Pointer to a new command.
919 // Throws:  None.
920 //--
921 CMICmdBase *CMICmdCmdExecFinish::CreateSelf() {
922   return new CMICmdCmdExecFinish();
923 }
924
925 //---------------------------------------------------------------------------------------
926 //---------------------------------------------------------------------------------------
927 //---------------------------------------------------------------------------------------
928
929 //++
930 //------------------------------------------------------------------------------------
931 // Details: CMICmdCmdExecInterrupt constructor.
932 // Type:    Method.
933 // Args:    None.
934 // Return:  None.
935 // Throws:  None.
936 //--
937 CMICmdCmdExecInterrupt::CMICmdCmdExecInterrupt() {
938   // Command factory matches this name with that received from the stdin stream
939   m_strMiCmd = "exec-interrupt";
940
941   // Required by the CMICmdFactory when registering *this command
942   m_pSelfCreatorFn = &CMICmdCmdExecInterrupt::CreateSelf;
943 }
944
945 //++
946 //------------------------------------------------------------------------------------
947 // Details: CMICmdCmdExecInterrupt destructor.
948 // Type:    Overrideable.
949 // Args:    None.
950 // Return:  None.
951 // Throws:  None.
952 //--
953 CMICmdCmdExecInterrupt::~CMICmdCmdExecInterrupt() {}
954
955 //++
956 //------------------------------------------------------------------------------------
957 // Details: The invoker requires this function. The command does work in this
958 // function.
959 //          The command is likely to communicate with the LLDB SBDebugger in
960 //          here.
961 // Type:    Overridden.
962 // Args:    None.
963 // Return:  MIstatus::success - Functional succeeded.
964 //          MIstatus::failure - Functional failed.
965 // Throws:  None.
966 //--
967 bool CMICmdCmdExecInterrupt::Execute() {
968   CMICmnLLDBDebugSessionInfo &rSessionInfo(
969       CMICmnLLDBDebugSessionInfo::Instance());
970   lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
971   CMIUtilString strCmd("process interrupt");
972   const lldb::ReturnStatus status =
973       rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(),
974                                                       m_lldbResult, false);
975   MIunused(status);
976
977   // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
978   if (!CMIDriver::Instance().SetDriverStateRunningNotDebugging()) {
979     const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription());
980     SetErrorDescription(
981         CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE),
982                               strCmd.c_str(), rErrMsg.c_str()));
983     return MIstatus::failure;
984   }
985
986   return MIstatus::success;
987 }
988
989 //++
990 //------------------------------------------------------------------------------------
991 // Details: The invoker requires this function. The command prepares a MI Record
992 // Result
993 //          for the work carried out in the Execute().
994 // Type:    Overridden.
995 // Args:    None.
996 // Return:  MIstatus::success - Functional succeeded.
997 //          MIstatus::failure - Functional failed.
998 // Throws:  None.
999 //--
1000 bool CMICmdCmdExecInterrupt::Acknowledge() {
1001   if (m_lldbResult.GetErrorSize() > 0) {
1002     const CMICmnMIValueConst miValueConst(m_lldbResult.GetError());
1003     const CMICmnMIValueResult miValueResult("message", miValueConst);
1004     const CMICmnMIResultRecord miRecordResult(
1005         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
1006         miValueResult);
1007     m_miResultRecord = miRecordResult;
1008   } else {
1009     const CMICmnMIResultRecord miRecordResult(
1010         m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
1011     m_miResultRecord = miRecordResult;
1012   }
1013
1014   return MIstatus::success;
1015 }
1016
1017 //++
1018 //------------------------------------------------------------------------------------
1019 // Details: Required by the CMICmdFactory when registering *this command. The
1020 // factory
1021 //          calls this function to create an instance of *this command.
1022 // Type:    Static method.
1023 // Args:    None.
1024 // Return:  CMICmdBase * - Pointer to a new command.
1025 // Throws:  None.
1026 //--
1027 CMICmdBase *CMICmdCmdExecInterrupt::CreateSelf() {
1028   return new CMICmdCmdExecInterrupt();
1029 }
1030
1031 //---------------------------------------------------------------------------------------
1032 //---------------------------------------------------------------------------------------
1033 //---------------------------------------------------------------------------------------
1034
1035 //++
1036 //------------------------------------------------------------------------------------
1037 // Details: CMICmdCmdExecArguments constructor.
1038 // Type:    Method.
1039 // Args:    None.
1040 // Return:  None.
1041 // Throws:  None.
1042 //--
1043 CMICmdCmdExecArguments::CMICmdCmdExecArguments()
1044     : m_constStrArgArguments("arguments") {
1045   // Command factory matches this name with that received from the stdin stream
1046   m_strMiCmd = "exec-arguments";
1047
1048   // Required by the CMICmdFactory when registering *this command
1049   m_pSelfCreatorFn = &CMICmdCmdExecArguments::CreateSelf;
1050 }
1051
1052 //++
1053 //------------------------------------------------------------------------------------
1054 // Details: CMICmdCmdExecArguments destructor.
1055 // Type:    Overrideable.
1056 // Args:    None.
1057 // Return:  None.
1058 // Throws:  None.
1059 //--
1060 CMICmdCmdExecArguments::~CMICmdCmdExecArguments() {}
1061
1062 //++
1063 //------------------------------------------------------------------------------------
1064 // Details: The invoker requires this function. The parses the command line
1065 // options
1066 //          arguments to extract values for each of those arguments.
1067 // Type:    Overridden.
1068 // Args:    None.
1069 // Return:  MIstatus::success - Function succeeded.
1070 //          MIstatus::failure - Function failed.
1071 // Throws:  None.
1072 //--
1073 bool CMICmdCmdExecArguments::ParseArgs() {
1074   m_setCmdArgs.Add(new CMICmdArgValListOfN(
1075       m_constStrArgArguments, false, true,
1076       CMICmdArgValListBase::eArgValType_StringAnything));
1077   return ParseValidateCmdOptions();
1078 }
1079
1080 //++
1081 //------------------------------------------------------------------------------------
1082 // Details: The invoker requires this function. The command does work in this
1083 // function.
1084 //          The command is likely to communicate with the LLDB SBDebugger in
1085 //          here.
1086 // Type:    Overridden.
1087 // Args:    None.
1088 // Return:  MIstatus::success - Function succeeded.
1089 //          MIstatus::failure - Function failed.
1090 // Throws:  None.
1091 //--
1092 bool CMICmdCmdExecArguments::Execute() {
1093   CMICMDBASE_GETOPTION(pArgArguments, ListOfN, m_constStrArgArguments);
1094
1095   CMICmnLLDBDebugSessionInfo &rSessionInfo(
1096       CMICmnLLDBDebugSessionInfo::Instance());
1097   lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
1098   if (!sbTarget.IsValid()) {
1099     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT),
1100                                    m_cmdData.strMiCmd.c_str()));
1101     return MIstatus::failure;
1102   }
1103
1104   lldb::SBLaunchInfo sbLaunchInfo = sbTarget.GetLaunchInfo();
1105   sbLaunchInfo.SetArguments(NULL, false);
1106
1107   CMIUtilString strArg;
1108   size_t nArgIndex = 0;
1109   while (pArgArguments->GetExpectedOption<CMICmdArgValString, CMIUtilString>(
1110       strArg, nArgIndex)) {
1111     const char *argv[2] = {strArg.c_str(), NULL};
1112     sbLaunchInfo.SetArguments(argv, true);
1113     ++nArgIndex;
1114   }
1115
1116   sbTarget.SetLaunchInfo(sbLaunchInfo);
1117
1118   return MIstatus::success;
1119 }
1120
1121 //++
1122 //------------------------------------------------------------------------------------
1123 // Details: The invoker requires this function. The command prepares a MI Record
1124 // Result
1125 //          for the work carried out in the Execute().
1126 // Type:    Overridden.
1127 // Args:    None.
1128 // Return:  MIstatus::success - Function succeeded.
1129 //          MIstatus::failure - Function failed.
1130 // Throws:  None.
1131 //--
1132 bool CMICmdCmdExecArguments::Acknowledge() {
1133   const CMICmnMIResultRecord miRecordResult(
1134       m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
1135   m_miResultRecord = miRecordResult;
1136
1137   return MIstatus::success;
1138 }
1139
1140 //++
1141 //------------------------------------------------------------------------------------
1142 // Details: Required by the CMICmdFactory when registering *this command. The
1143 // factory
1144 //          calls this function to create an instance of *this command.
1145 // Type:    Static method.
1146 // Args:    None.
1147 // Return:  CMICmdBase * - Pointer to a new command.
1148 // Throws:  None.
1149 //--
1150 CMICmdBase *CMICmdCmdExecArguments::CreateSelf() {
1151   return new CMICmdCmdExecArguments();
1152 }
1153
1154 //---------------------------------------------------------------------------------------
1155 //---------------------------------------------------------------------------------------
1156 //---------------------------------------------------------------------------------------
1157
1158 //++
1159 //------------------------------------------------------------------------------------
1160 // Details: CMICmdCmdExecAbort constructor.
1161 // Type:    Method.
1162 // Args:    None.
1163 // Return:  None.
1164 // Throws:  None.
1165 //--
1166 CMICmdCmdExecAbort::CMICmdCmdExecAbort() {
1167   // Command factory matches this name with that received from the stdin stream
1168   m_strMiCmd = "exec-abort";
1169
1170   // Required by the CMICmdFactory when registering *this command
1171   m_pSelfCreatorFn = &CMICmdCmdExecAbort::CreateSelf;
1172 }
1173
1174 //++
1175 //------------------------------------------------------------------------------------
1176 // Details: CMICmdCmdExecAbort destructor.
1177 // Type:    Overrideable.
1178 // Args:    None.
1179 // Return:  None.
1180 // Throws:  None.
1181 //--
1182 CMICmdCmdExecAbort::~CMICmdCmdExecAbort() {}
1183
1184 //++
1185 //------------------------------------------------------------------------------------
1186 // Details: The invoker requires this function. The command does work in this
1187 // function.
1188 //          The command is likely to communicate with the LLDB SBDebugger in
1189 //          here.
1190 // Type:    Overridden.
1191 // Args:    None.
1192 // Return:  MIstatus::success - Function succeeded.
1193 //          MIstatus::failure - Function failed.
1194 // Throws:  None.
1195 //--
1196 bool CMICmdCmdExecAbort::Execute() {
1197   CMICmnLLDBDebugSessionInfo &rSessionInfo(
1198       CMICmnLLDBDebugSessionInfo::Instance());
1199   lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
1200   if (!sbProcess.IsValid()) {
1201     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
1202                                    m_cmdData.strMiCmd.c_str()));
1203     return MIstatus::failure;
1204   }
1205
1206   lldb::SBError sbError = sbProcess.Destroy();
1207   if (sbError.Fail()) {
1208     SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_LLDBPROCESS_DESTROY),
1209                                    m_cmdData.strMiCmd.c_str(),
1210                                    sbError.GetCString()));
1211     return MIstatus::failure;
1212   }
1213
1214   return MIstatus::success;
1215 }
1216
1217 //++
1218 //------------------------------------------------------------------------------------
1219 // Details: The invoker requires this function. The command prepares a MI Record
1220 // Result
1221 //          for the work carried out in the Execute().
1222 // Type:    Overridden.
1223 // Args:    None.
1224 // Return:  MIstatus::success - Function succeeded.
1225 //          MIstatus::failure - Function failed.
1226 // Throws:  None.
1227 //--
1228 bool CMICmdCmdExecAbort::Acknowledge() {
1229   const CMICmnMIResultRecord miRecordResult(
1230       m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
1231   m_miResultRecord = miRecordResult;
1232   return MIstatus::success;
1233 }
1234
1235 //++
1236 //------------------------------------------------------------------------------------
1237 // Details: Required by the CMICmdFactory when registering *this command. The
1238 // factory
1239 //          calls this function to create an instance of *this command.
1240 // Type:    Static method.
1241 // Args:    None.
1242 // Return:  CMICmdBase * - Pointer to a new command.
1243 // Throws:  None.
1244 //--
1245 CMICmdBase *CMICmdCmdExecAbort::CreateSelf() {
1246   return new CMICmdCmdExecAbort();
1247 }