Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 1 | //===-- MICmdCmdSupportList.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 | |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 10 | // Overview: CMICmdCmdSupportListFeatures implementation. |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 11 | |
| 12 | // In-house headers: |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 13 | #include "MICmdCmdSupportList.h" |
| 14 | #include "MICmnMIResultRecord.h" |
| 15 | #include "MICmnMIValueConst.h" |
| 16 | #include "MICmnMIValueList.h" |
| 17 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 18 | //++ |
| 19 | //------------------------------------------------------------------------------------ |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 20 | // Details: CMICmdCmdSupportListFeatures constructor. |
| 21 | // Type: Method. |
| 22 | // Args: None. |
| 23 | // Return: None. |
| 24 | // Throws: None. |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 25 | //-- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 26 | CMICmdCmdSupportListFeatures::CMICmdCmdSupportListFeatures() { |
| 27 | // Command factory matches this name with that received from the stdin stream |
| 28 | m_strMiCmd = "list-features"; |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 29 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 30 | // Required by the CMICmdFactory when registering *this command |
| 31 | m_pSelfCreatorFn = &CMICmdCmdSupportListFeatures::CreateSelf; |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 32 | } |
| 33 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 34 | //++ |
| 35 | //------------------------------------------------------------------------------------ |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 36 | // Details: CMICmdCmdSupportListFeatures destructor. |
| 37 | // Type: Overrideable. |
| 38 | // Args: None. |
| 39 | // Return: None. |
| 40 | // Throws: None. |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 41 | //-- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 42 | CMICmdCmdSupportListFeatures::~CMICmdCmdSupportListFeatures() {} |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 43 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 44 | //++ |
| 45 | //------------------------------------------------------------------------------------ |
| 46 | // Details: The invoker requires this function. The command does work in this |
| 47 | // function. |
| 48 | // The command is likely to communicate with the LLDB SBDebugger in |
| 49 | // here. |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 50 | // Type: Overridden. |
| 51 | // Args: None. |
| 52 | // Return: MIstatus::success - Functional succeeded. |
| 53 | // MIstatus::failure - Functional failed. |
| 54 | // Throws: None. |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 55 | //-- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 56 | bool CMICmdCmdSupportListFeatures::Execute() { |
| 57 | // Do nothing |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 58 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 59 | return MIstatus::success; |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 60 | } |
| 61 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 62 | //++ |
| 63 | //------------------------------------------------------------------------------------ |
| 64 | // Details: The invoker requires this function. The command prepares a MI Record |
| 65 | // Result |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 66 | // for the work carried out in the Execute(). |
| 67 | // Type: Overridden. |
| 68 | // Args: None. |
| 69 | // Return: MIstatus::success - Functional succeeded. |
| 70 | // MIstatus::failure - Functional failed. |
| 71 | // Throws: None. |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 72 | //-- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 73 | bool CMICmdCmdSupportListFeatures::Acknowledge() { |
| 74 | // Declare supported features here |
| 75 | const CMICmnMIValueConst miValueConst1("data-read-memory-bytes"); |
| 76 | const CMICmnMIValueConst miValueConst2("exec-run-start-option"); |
| 77 | // Some features may depend on host and/or target, decide what to add below |
| 78 | CMICmnMIValueList miValueList(true); |
| 79 | miValueList.Add(miValueConst1); |
| 80 | miValueList.Add(miValueConst2); |
| 81 | const CMICmnMIValueResult miValueResult("features", miValueList); |
| 82 | const CMICmnMIResultRecord miRecordResult( |
| 83 | m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done, |
| 84 | miValueResult); |
| 85 | m_miResultRecord = miRecordResult; |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 86 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 87 | return MIstatus::success; |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 88 | } |
| 89 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 90 | //++ |
| 91 | //------------------------------------------------------------------------------------ |
| 92 | // Details: Required by the CMICmdFactory when registering *this command. The |
| 93 | // factory |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 94 | // calls this function to create an instance of *this command. |
| 95 | // Type: Static method. |
| 96 | // Args: None. |
| 97 | // Return: CMICmdBase * - Pointer to a new command. |
| 98 | // Throws: None. |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 99 | //-- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 100 | CMICmdBase *CMICmdCmdSupportListFeatures::CreateSelf() { |
| 101 | return new CMICmdCmdSupportListFeatures(); |
Deepak Panickal | 877569c | 2014-06-24 16:35:50 +0000 | [diff] [blame] | 102 | } |