1 //===-- MICmdCmd.cpp --------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // Overview: CMICmdCmdEnablePrettyPrinting implementation.
10 // CMICmdCmdSource implementation.
17 // Details: CMICmdCmdEnablePrettyPrinting constructor.
23 CMICmdCmdEnablePrettyPrinting::CMICmdCmdEnablePrettyPrinting() {
24 // Command factory matches this name with that received from the stdin stream
25 m_strMiCmd = "enable-pretty-printing";
27 // Required by the CMICmdFactory when registering *this command
28 m_pSelfCreatorFn = &CMICmdCmdEnablePrettyPrinting::CreateSelf;
32 // Details: CMICmdCmdEnablePrettyPrinting destructor.
33 // Type: Overrideable.
38 CMICmdCmdEnablePrettyPrinting::~CMICmdCmdEnablePrettyPrinting() {}
41 // Details: The invoker requires this function. The command does work in this
43 // The command is likely to communicate with the LLDB SBDebugger in
47 // Return: MIstatus::success - Functional succeeded.
48 // MIstatus::failure - Functional failed.
51 bool CMICmdCmdEnablePrettyPrinting::Execute() {
53 return MIstatus::success;
57 // Details: The invoker requires this function. The command prepares a MI Record
59 // for the work carried out in the Execute().
62 // Return: MIstatus::success - Functional succeeded.
63 // MIstatus::failure - Functional failed.
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,
72 m_miResultRecord = miRecordResult;
74 return MIstatus::success;
78 // Details: Required by the CMICmdFactory when registering *this command. The
80 // calls this function to create an instance of *this command.
81 // Type: Static method.
83 // Return: CMICmdBase * - Pointer to a new command.
86 CMICmdBase *CMICmdCmdEnablePrettyPrinting::CreateSelf() {
87 return new CMICmdCmdEnablePrettyPrinting();
92 // Details: CMICmdCmdSource constructor.
98 CMICmdCmdSource::CMICmdCmdSource() {
99 // Command factory matches this name with that received from the stdin stream
100 m_strMiCmd = "source";
102 // Required by the CMICmdFactory when registering *this command
103 m_pSelfCreatorFn = &CMICmdCmdSource::CreateSelf;
107 // Details: CMICmdCmdSource destructor.
108 // Type: Overrideable.
113 CMICmdCmdSource::~CMICmdCmdSource() {}
116 // Details: The invoker requires this function. The command does work in this
118 // The command is likely to communicate with the LLDB SBDebugger in
122 // Return: MIstatus::success - Functional succeeded.
123 // MIstatus::failure - Functional failed.
126 bool CMICmdCmdSource::Execute() {
128 return MIstatus::success;
132 // Details: The invoker requires this function. The command prepares a MI Record
134 // for the work carried out in the Execute().
137 // Return: MIstatus::success - Functional succeeded.
138 // MIstatus::failure - Functional failed.
141 bool CMICmdCmdSource::Acknowledge() {
142 const CMICmnMIResultRecord miRecordResult(
143 m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
144 m_miResultRecord = miRecordResult;
146 return MIstatus::success;
150 // Details: Required by the CMICmdFactory when registering *this command. The
152 // calls this function to create an instance of *this command.
153 // Type: Static method.
155 // Return: CMICmdBase * - Pointer to a new command.
158 CMICmdBase *CMICmdCmdSource::CreateSelf() { return new CMICmdCmdSource(); }