]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/tools/lldb-mi/MICmdCmd.cpp
MFC r355940:
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / tools / lldb-mi / MICmdCmd.cpp
1 //===-- MICmdCmd.cpp --------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // Overview:    CMICmdCmdEnablePrettyPrinting   implementation.
10 //              CMICmdCmdSource                 implementation.
11 //
12
13 // In-house headers:
14 #include "MICmdCmd.h"
15
16 //++
17 // Details: CMICmdCmdEnablePrettyPrinting constructor.
18 // Type:    Method.
19 // Args:    None.
20 // Return:  None.
21 // Throws:  None.
22 //--
23 CMICmdCmdEnablePrettyPrinting::CMICmdCmdEnablePrettyPrinting() {
24   // Command factory matches this name with that received from the stdin stream
25   m_strMiCmd = "enable-pretty-printing";
26
27   // Required by the CMICmdFactory when registering *this command
28   m_pSelfCreatorFn = &CMICmdCmdEnablePrettyPrinting::CreateSelf;
29 }
30
31 //++
32 // Details: CMICmdCmdEnablePrettyPrinting destructor.
33 // Type:    Overrideable.
34 // Args:    None.
35 // Return:  None.
36 // Throws:  None.
37 //--
38 CMICmdCmdEnablePrettyPrinting::~CMICmdCmdEnablePrettyPrinting() {}
39
40 //++
41 // Details: The invoker requires this function. The command does work in this
42 // function.
43 //          The command is likely to communicate with the LLDB SBDebugger in
44 //          here.
45 // Type:    Overridden.
46 // Args:    None.
47 // Return:  MIstatus::success - Functional succeeded.
48 //          MIstatus::failure - Functional failed.
49 // Throws:  None.
50 //--
51 bool CMICmdCmdEnablePrettyPrinting::Execute() {
52   // Do nothing
53   return MIstatus::success;
54 }
55
56 //++
57 // Details: The invoker requires this function. The command prepares a MI Record
58 // Result
59 //          for the work carried out in the Execute().
60 // Type:    Overridden.
61 // Args:    None.
62 // Return:  MIstatus::success - Functional succeeded.
63 //          MIstatus::failure - Functional failed.
64 // Throws:  None.
65 //--
66 bool CMICmdCmdEnablePrettyPrinting::Acknowledge() {
67   const CMICmnMIValueConst miValueConst("0");
68   const CMICmnMIValueResult miValueResult("supported", miValueConst);
69   const CMICmnMIResultRecord miRecordResult(
70       m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
71       miValueResult);
72   m_miResultRecord = miRecordResult;
73
74   return MIstatus::success;
75 }
76
77 //++
78 // Details: Required by the CMICmdFactory when registering *this command. The
79 // factory
80 //          calls this function to create an instance of *this command.
81 // Type:    Static method.
82 // Args:    None.
83 // Return:  CMICmdBase * - Pointer to a new command.
84 // Throws:  None.
85 //--
86 CMICmdBase *CMICmdCmdEnablePrettyPrinting::CreateSelf() {
87   return new CMICmdCmdEnablePrettyPrinting();
88 }
89
90
91 //++
92 // Details: CMICmdCmdSource constructor.
93 // Type:    Method.
94 // Args:    None.
95 // Return:  None.
96 // Throws:  None.
97 //--
98 CMICmdCmdSource::CMICmdCmdSource() {
99   // Command factory matches this name with that received from the stdin stream
100   m_strMiCmd = "source";
101
102   // Required by the CMICmdFactory when registering *this command
103   m_pSelfCreatorFn = &CMICmdCmdSource::CreateSelf;
104 }
105
106 //++
107 // Details: CMICmdCmdSource destructor.
108 // Type:    Overrideable.
109 // Args:    None.
110 // Return:  None.
111 // Throws:  None.
112 //--
113 CMICmdCmdSource::~CMICmdCmdSource() {}
114
115 //++
116 // Details: The invoker requires this function. The command does work in this
117 // function.
118 //          The command is likely to communicate with the LLDB SBDebugger in
119 //          here.
120 // Type:    Overridden.
121 // Args:    None.
122 // Return:  MIstatus::success - Functional succeeded.
123 //          MIstatus::failure - Functional failed.
124 // Throws:  None.
125 //--
126 bool CMICmdCmdSource::Execute() {
127   // Do nothing
128   return MIstatus::success;
129 }
130
131 //++
132 // Details: The invoker requires this function. The command prepares a MI Record
133 // Result
134 //          for the work carried out in the Execute().
135 // Type:    Overridden.
136 // Args:    None.
137 // Return:  MIstatus::success - Functional succeeded.
138 //          MIstatus::failure - Functional failed.
139 // Throws:  None.
140 //--
141 bool CMICmdCmdSource::Acknowledge() {
142   const CMICmnMIResultRecord miRecordResult(
143       m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
144   m_miResultRecord = miRecordResult;
145
146   return MIstatus::success;
147 }
148
149 //++
150 // Details: Required by the CMICmdFactory when registering *this command. The
151 // factory
152 //          calls this function to create an instance of *this command.
153 // Type:    Static method.
154 // Args:    None.
155 // Return:  CMICmdBase * - Pointer to a new command.
156 // Throws:  None.
157 //--
158 CMICmdBase *CMICmdCmdSource::CreateSelf() { return new CMICmdCmdSource(); }