]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCmdSupportList.cpp
MFV r348537: 8601 memory leak in get_special_prop()
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdCmdSupportList.cpp
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
10 // Overview:    CMICmdCmdSupportListFeatures            implementation.
11
12 // In-house headers:
13 #include "MICmdCmdSupportList.h"
14 #include "MICmnMIResultRecord.h"
15 #include "MICmnMIValueConst.h"
16 #include "MICmnMIValueList.h"
17
18 //++
19 //------------------------------------------------------------------------------------
20 // Details: CMICmdCmdSupportListFeatures constructor.
21 // Type:    Method.
22 // Args:    None.
23 // Return:  None.
24 // Throws:  None.
25 //--
26 CMICmdCmdSupportListFeatures::CMICmdCmdSupportListFeatures() {
27   // Command factory matches this name with that received from the stdin stream
28   m_strMiCmd = "list-features";
29
30   // Required by the CMICmdFactory when registering *this command
31   m_pSelfCreatorFn = &CMICmdCmdSupportListFeatures::CreateSelf;
32 }
33
34 //++
35 //------------------------------------------------------------------------------------
36 // Details: CMICmdCmdSupportListFeatures destructor.
37 // Type:    Overrideable.
38 // Args:    None.
39 // Return:  None.
40 // Throws:  None.
41 //--
42 CMICmdCmdSupportListFeatures::~CMICmdCmdSupportListFeatures() {}
43
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.
50 // Type:    Overridden.
51 // Args:    None.
52 // Return:  MIstatus::success - Functional succeeded.
53 //          MIstatus::failure - Functional failed.
54 // Throws:  None.
55 //--
56 bool CMICmdCmdSupportListFeatures::Execute() {
57   // Do nothing
58
59   return MIstatus::success;
60 }
61
62 //++
63 //------------------------------------------------------------------------------------
64 // Details: The invoker requires this function. The command prepares a MI Record
65 // Result
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.
72 //--
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;
86
87   return MIstatus::success;
88 }
89
90 //++
91 //------------------------------------------------------------------------------------
92 // Details: Required by the CMICmdFactory when registering *this command. The
93 // factory
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.
99 //--
100 CMICmdBase *CMICmdCmdSupportListFeatures::CreateSelf() {
101   return new CMICmdCmdSupportListFeatures();
102 }