]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCmd.cpp
Merge ^/head r275478 through r275622.
[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 CMICmdCmdEnablePrettyPrinting::Execute( void )
63 {
64         // Do nothing
65         return MIstatus::success;
66 }
67
68 //++ ------------------------------------------------------------------------------------
69 // Details:     The invoker requires this function. The command prepares a MI Record Result
70 //                      for the work carried out in the Execute().
71 // Type:        Overridden.
72 // Args:        None.
73 // Return:      MIstatus::success - Functional succeeded.
74 //                      MIstatus::failure - Functional failed.
75 // Throws:      None.
76 //--
77 bool CMICmdCmdEnablePrettyPrinting::Acknowledge( void )
78 {
79         const CMICmnMIValueConst miValueConst( "0" );
80         const CMICmnMIValueResult miValueResult( "supported", miValueConst );
81         const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done, miValueResult );
82         m_miResultRecord = miRecordResult;
83         
84         return MIstatus::success;
85 }
86
87 //++ ------------------------------------------------------------------------------------
88 // Details:     Required by the CMICmdFactory when registering *this command. The factory
89 //                      calls this function to create an instance of *this command.
90 // Type:        Static method.
91 // Args:        None.
92 // Return:      CMICmdBase * - Pointer to a new command.
93 // Throws:      None.
94 //--
95 CMICmdBase * CMICmdCmdEnablePrettyPrinting::CreateSelf( void )
96 {
97         return new CMICmdCmdEnablePrettyPrinting();
98 }
99
100 //---------------------------------------------------------------------------------------
101 //---------------------------------------------------------------------------------------
102 //---------------------------------------------------------------------------------------
103
104 //++ ------------------------------------------------------------------------------------
105 // Details:     CMICmdCmdSource constructor.
106 // Type:        Method.
107 // Args:        None.
108 // Return:      None.
109 // Throws:      None.
110 //--
111 CMICmdCmdSource::CMICmdCmdSource( void )
112 {
113         // Command factory matches this name with that received from the stdin stream
114         m_strMiCmd = "source";
115         
116         // Required by the CMICmdFactory when registering *this command
117         m_pSelfCreatorFn = &CMICmdCmdSource::CreateSelf;
118 }
119
120 //++ ------------------------------------------------------------------------------------
121 // Details:     CMICmdCmdSource destructor.
122 // Type:        Overrideable.
123 // Args:        None.
124 // Return:      None.
125 // Throws:      None.
126 //--
127 CMICmdCmdSource::~CMICmdCmdSource( void )
128 {
129 }
130
131 //++ ------------------------------------------------------------------------------------
132 // Details:     The invoker requires this function. The command does work in this function.
133 //                      The command is likely to communicate with the LLDB SBDebugger in here.
134 // Type:        Overridden.
135 // Args:        None.
136 // Return:      MIstatus::success - Functional succeeded.
137 //                      MIstatus::failure - Functional failed.
138 // Throws:      None.
139 //--
140 bool CMICmdCmdSource::Execute( void )
141 {
142         // Do nothing
143         return MIstatus::success;
144 }
145
146 //++ ------------------------------------------------------------------------------------
147 // Details:     The invoker requires this function. The command prepares a MI Record Result
148 //                      for the work carried out in the Execute().
149 // Type:        Overridden.
150 // Args:        None.
151 // Return:      MIstatus::success - Functional succeeded.
152 //                      MIstatus::failure - Functional failed.
153 // Throws:      None.
154 //--
155 bool CMICmdCmdSource::Acknowledge( void )
156 {
157         const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done );
158         m_miResultRecord = miRecordResult;
159         
160         return MIstatus::success;
161 }
162
163 //++ ------------------------------------------------------------------------------------
164 // Details:     Required by the CMICmdFactory when registering *this command. The factory
165 //                      calls this function to create an instance of *this command.
166 // Type:        Static method.
167 // Args:        None.
168 // Return:      CMICmdBase * - Pointer to a new command.
169 // Throws:      None.
170 //--
171 CMICmdBase * CMICmdCmdSource::CreateSelf( void )
172 {
173         return new CMICmdCmdSource();
174 }