]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCmd.cpp
Update LLDB snapshot to upstream r225923 (git 2b588ecd)
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdCmd.cpp
1 //===-- MICmdCmd.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 //++
11 // File:        MICmdCmd.cpp
12 //
13 // Overview:    CMICmdCmdEnablePrettyPrinting   implementation.
14 //              CMICmdCmdSource                 implementation.
15 //
16 // Environment: Compilers:  Visual C++ 12.
17 //                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
18 //              Libraries:  See MIReadmetxt.
19 //
20 // Copyright:   None.
21 //--
22
23 // In-house headers:
24 #include "MICmdCmd.h"
25
26 //++ ------------------------------------------------------------------------------------
27 // Details: CMICmdCmdEnablePrettyPrinting constructor.
28 // Type:    Method.
29 // Args:    None.
30 // Return:  None.
31 // Throws:  None.
32 //--
33 CMICmdCmdEnablePrettyPrinting::CMICmdCmdEnablePrettyPrinting(void)
34 {
35     // Command factory matches this name with that received from the stdin stream
36     m_strMiCmd = "enable-pretty-printing";
37
38     // Required by the CMICmdFactory when registering *this command
39     m_pSelfCreatorFn = &CMICmdCmdEnablePrettyPrinting::CreateSelf;
40 }
41
42 //++ ------------------------------------------------------------------------------------
43 // Details: CMICmdCmdEnablePrettyPrinting destructor.
44 // Type:    Overrideable.
45 // Args:    None.
46 // Return:  None.
47 // Throws:  None.
48 //--
49 CMICmdCmdEnablePrettyPrinting::~CMICmdCmdEnablePrettyPrinting(void)
50 {
51 }
52
53 //++ ------------------------------------------------------------------------------------
54 // Details: The invoker requires this function. The command does work in this function.
55 //          The command is likely to communicate with the LLDB SBDebugger in here.
56 // Type:    Overridden.
57 // Args:    None.
58 // Return:  MIstatus::success - Functional succeeded.
59 //          MIstatus::failure - Functional failed.
60 // Throws:  None.
61 //--
62 bool
63 CMICmdCmdEnablePrettyPrinting::Execute(void)
64 {
65     // Do nothing
66     return MIstatus::success;
67 }
68
69 //++ ------------------------------------------------------------------------------------
70 // Details: The invoker requires this function. The command prepares a MI Record Result
71 //          for the work carried out in the Execute().
72 // Type:    Overridden.
73 // Args:    None.
74 // Return:  MIstatus::success - Functional succeeded.
75 //          MIstatus::failure - Functional failed.
76 // Throws:  None.
77 //--
78 bool
79 CMICmdCmdEnablePrettyPrinting::Acknowledge(void)
80 {
81     const CMICmnMIValueConst miValueConst("0");
82     const CMICmnMIValueResult miValueResult("supported", miValueConst);
83     const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done, miValueResult);
84     m_miResultRecord = miRecordResult;
85
86     return MIstatus::success;
87 }
88
89 //++ ------------------------------------------------------------------------------------
90 // Details: Required by the CMICmdFactory when registering *this command. The factory
91 //          calls this function to create an instance of *this command.
92 // Type:    Static method.
93 // Args:    None.
94 // Return:  CMICmdBase * - Pointer to a new command.
95 // Throws:  None.
96 //--
97 CMICmdBase *
98 CMICmdCmdEnablePrettyPrinting::CreateSelf(void)
99 {
100     return new CMICmdCmdEnablePrettyPrinting();
101 }
102
103 //---------------------------------------------------------------------------------------
104 //---------------------------------------------------------------------------------------
105 //---------------------------------------------------------------------------------------
106
107 //++ ------------------------------------------------------------------------------------
108 // Details: CMICmdCmdSource constructor.
109 // Type:    Method.
110 // Args:    None.
111 // Return:  None.
112 // Throws:  None.
113 //--
114 CMICmdCmdSource::CMICmdCmdSource(void)
115 {
116     // Command factory matches this name with that received from the stdin stream
117     m_strMiCmd = "source";
118
119     // Required by the CMICmdFactory when registering *this command
120     m_pSelfCreatorFn = &CMICmdCmdSource::CreateSelf;
121 }
122
123 //++ ------------------------------------------------------------------------------------
124 // Details: CMICmdCmdSource destructor.
125 // Type:    Overrideable.
126 // Args:    None.
127 // Return:  None.
128 // Throws:  None.
129 //--
130 CMICmdCmdSource::~CMICmdCmdSource(void)
131 {
132 }
133
134 //++ ------------------------------------------------------------------------------------
135 // Details: The invoker requires this function. The command does work in this function.
136 //          The command is likely to communicate with the LLDB SBDebugger in here.
137 // Type:    Overridden.
138 // Args:    None.
139 // Return:  MIstatus::success - Functional succeeded.
140 //          MIstatus::failure - Functional failed.
141 // Throws:  None.
142 //--
143 bool
144 CMICmdCmdSource::Execute(void)
145 {
146     // Do nothing
147     return MIstatus::success;
148 }
149
150 //++ ------------------------------------------------------------------------------------
151 // Details: The invoker requires this function. The command prepares a MI Record Result
152 //          for the work carried out in the Execute().
153 // Type:    Overridden.
154 // Args:    None.
155 // Return:  MIstatus::success - Functional succeeded.
156 //          MIstatus::failure - Functional failed.
157 // Throws:  None.
158 //--
159 bool
160 CMICmdCmdSource::Acknowledge(void)
161 {
162     const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
163     m_miResultRecord = miRecordResult;
164
165     return MIstatus::success;
166 }
167
168 //++ ------------------------------------------------------------------------------------
169 // Details: Required by the CMICmdFactory when registering *this command. The factory
170 //          calls this function to create an instance of *this command.
171 // Type:    Static method.
172 // Args:    None.
173 // Return:  CMICmdBase * - Pointer to a new command.
174 // Throws:  None.
175 //--
176 CMICmdBase *
177 CMICmdCmdSource::CreateSelf(void)
178 {
179     return new CMICmdCmdSource();
180 }