aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lldb-mi
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lldb-mi')
-rw-r--r--tools/lldb-mi/MICmdArgContext.cpp221
-rw-r--r--tools/lldb-mi/MICmdArgContext.h43
-rw-r--r--tools/lldb-mi/MICmdArgSet.cpp386
-rw-r--r--tools/lldb-mi/MICmdArgSet.h107
-rw-r--r--tools/lldb-mi/MICmdArgValBase.cpp129
-rw-r--r--tools/lldb-mi/MICmdArgValBase.h115
-rw-r--r--tools/lldb-mi/MICmdArgValConsume.cpp88
-rw-r--r--tools/lldb-mi/MICmdArgValConsume.h53
-rw-r--r--tools/lldb-mi/MICmdArgValFile.cpp178
-rw-r--r--tools/lldb-mi/MICmdArgValFile.h47
-rw-r--r--tools/lldb-mi/MICmdArgValListBase.cpp209
-rw-r--r--tools/lldb-mi/MICmdArgValListBase.h101
-rw-r--r--tools/lldb-mi/MICmdArgValListOfN.cpp167
-rw-r--r--tools/lldb-mi/MICmdArgValListOfN.h92
-rw-r--r--tools/lldb-mi/MICmdArgValNumber.cpp156
-rw-r--r--tools/lldb-mi/MICmdArgValNumber.h69
-rw-r--r--tools/lldb-mi/MICmdArgValOptionLong.cpp291
-rw-r--r--tools/lldb-mi/MICmdArgValOptionLong.h104
-rw-r--r--tools/lldb-mi/MICmdArgValOptionShort.cpp121
-rw-r--r--tools/lldb-mi/MICmdArgValOptionShort.h59
-rw-r--r--tools/lldb-mi/MICmdArgValPrintValues.cpp125
-rw-r--r--tools/lldb-mi/MICmdArgValPrintValues.h56
-rw-r--r--tools/lldb-mi/MICmdArgValString.cpp380
-rw-r--r--tools/lldb-mi/MICmdArgValString.h82
-rw-r--r--tools/lldb-mi/MICmdArgValThreadGrp.cpp141
-rw-r--r--tools/lldb-mi/MICmdArgValThreadGrp.h53
-rw-r--r--tools/lldb-mi/MICmdBase.cpp329
-rw-r--r--tools/lldb-mi/MICmdBase.h193
-rw-r--r--tools/lldb-mi/MICmdCmd.cpp158
-rw-r--r--tools/lldb-mi/MICmdCmd.h90
-rw-r--r--tools/lldb-mi/MICmdCmdBreak.cpp1024
-rw-r--r--tools/lldb-mi/MICmdCmdBreak.h262
-rw-r--r--tools/lldb-mi/MICmdCmdData.cpp1673
-rw-r--r--tools/lldb-mi/MICmdCmdData.h381
-rw-r--r--tools/lldb-mi/MICmdCmdEnviro.cpp145
-rw-r--r--tools/lldb-mi/MICmdCmdEnviro.h57
-rw-r--r--tools/lldb-mi/MICmdCmdExec.cpp1115
-rw-r--r--tools/lldb-mi/MICmdCmdExec.h316
-rw-r--r--tools/lldb-mi/MICmdCmdFile.cpp206
-rw-r--r--tools/lldb-mi/MICmdCmdFile.h66
-rw-r--r--tools/lldb-mi/MICmdCmdGdbInfo.cpp225
-rw-r--r--tools/lldb-mi/MICmdCmdGdbInfo.h87
-rw-r--r--tools/lldb-mi/MICmdCmdGdbSet.cpp491
-rw-r--r--tools/lldb-mi/MICmdCmdGdbSet.h101
-rw-r--r--tools/lldb-mi/MICmdCmdGdbShow.cpp395
-rw-r--r--tools/lldb-mi/MICmdCmdGdbShow.h101
-rw-r--r--tools/lldb-mi/MICmdCmdGdbThread.cpp89
-rw-r--r--tools/lldb-mi/MICmdCmdGdbThread.h50
-rw-r--r--tools/lldb-mi/MICmdCmdMiscellanous.cpp586
-rw-r--r--tools/lldb-mi/MICmdCmdMiscellanous.h156
-rw-r--r--tools/lldb-mi/MICmdCmdStack.cpp1053
-rw-r--r--tools/lldb-mi/MICmdCmdStack.h256
-rw-r--r--tools/lldb-mi/MICmdCmdSupportInfo.cpp117
-rw-r--r--tools/lldb-mi/MICmdCmdSupportInfo.h58
-rw-r--r--tools/lldb-mi/MICmdCmdSupportList.cpp96
-rw-r--r--tools/lldb-mi/MICmdCmdSupportList.h51
-rw-r--r--tools/lldb-mi/MICmdCmdSymbol.cpp177
-rw-r--r--tools/lldb-mi/MICmdCmdSymbol.h59
-rw-r--r--tools/lldb-mi/MICmdCmdTarget.cpp447
-rw-r--r--tools/lldb-mi/MICmdCmdTarget.h117
-rw-r--r--tools/lldb-mi/MICmdCmdThread.cpp211
-rw-r--r--tools/lldb-mi/MICmdCmdThread.h69
-rw-r--r--tools/lldb-mi/MICmdCmdTrace.cpp88
-rw-r--r--tools/lldb-mi/MICmdCmdTrace.h50
-rw-r--r--tools/lldb-mi/MICmdCmdVar.cpp1460
-rw-r--r--tools/lldb-mi/MICmdCmdVar.h348
-rw-r--r--tools/lldb-mi/MICmdCommands.cpp134
-rw-r--r--tools/lldb-mi/MICmdCommands.h19
-rw-r--r--tools/lldb-mi/MICmdData.cpp10
-rw-r--r--tools/lldb-mi/MICmdData.h58
-rw-r--r--tools/lldb-mi/MICmdFactory.cpp206
-rw-r--r--tools/lldb-mi/MICmdFactory.h84
-rw-r--r--tools/lldb-mi/MICmdInterpreter.cpp290
-rw-r--r--tools/lldb-mi/MICmdInterpreter.h62
-rw-r--r--tools/lldb-mi/MICmdInvoker.cpp321
-rw-r--r--tools/lldb-mi/MICmdInvoker.h103
-rw-r--r--tools/lldb-mi/MICmdMgr.cpp248
-rw-r--r--tools/lldb-mi/MICmdMgr.h69
-rw-r--r--tools/lldb-mi/MICmdMgrSetCmdDeleteCallback.cpp87
-rw-r--r--tools/lldb-mi/MICmdMgrSetCmdDeleteCallback.h72
-rw-r--r--tools/lldb-mi/MICmnBase.cpp123
-rw-r--r--tools/lldb-mi/MICmnBase.h46
-rw-r--r--tools/lldb-mi/MICmnConfig.h19
-rw-r--r--tools/lldb-mi/MICmnLLDBBroadcaster.cpp68
-rw-r--r--tools/lldb-mi/MICmnLLDBBroadcaster.h44
-rw-r--r--tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp863
-rw-r--r--tools/lldb-mi/MICmnLLDBDebugSessionInfo.h292
-rw-r--r--tools/lldb-mi/MICmnLLDBDebugSessionInfoVarObj.cpp573
-rw-r--r--tools/lldb-mi/MICmnLLDBDebugSessionInfoVarObj.h139
-rw-r--r--tools/lldb-mi/MICmnLLDBDebugger.cpp905
-rw-r--r--tools/lldb-mi/MICmnLLDBDebugger.h134
-rw-r--r--tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp1883
-rw-r--r--tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.h99
-rw-r--r--tools/lldb-mi/MICmnLLDBProxySBValue.cpp134
-rw-r--r--tools/lldb-mi/MICmnLLDBProxySBValue.h34
-rw-r--r--tools/lldb-mi/MICmnLLDBUtilSBValue.cpp497
-rw-r--r--tools/lldb-mi/MICmnLLDBUtilSBValue.h77
-rw-r--r--tools/lldb-mi/MICmnLog.cpp330
-rw-r--r--tools/lldb-mi/MICmnLog.h138
-rw-r--r--tools/lldb-mi/MICmnLogMediumFile.cpp385
-rw-r--r--tools/lldb-mi/MICmnLogMediumFile.h84
-rw-r--r--tools/lldb-mi/MICmnMIOutOfBandRecord.cpp202
-rw-r--r--tools/lldb-mi/MICmnMIOutOfBandRecord.h93
-rw-r--r--tools/lldb-mi/MICmnMIResultRecord.cpp133
-rw-r--r--tools/lldb-mi/MICmnMIResultRecord.h79
-rw-r--r--tools/lldb-mi/MICmnMIValue.cpp43
-rw-r--r--tools/lldb-mi/MICmnMIValue.h50
-rw-r--r--tools/lldb-mi/MICmnMIValueConst.cpp77
-rw-r--r--tools/lldb-mi/MICmnMIValueConst.h59
-rw-r--r--tools/lldb-mi/MICmnMIValueList.cpp177
-rw-r--r--tools/lldb-mi/MICmnMIValueList.h55
-rw-r--r--tools/lldb-mi/MICmnMIValueResult.cpp116
-rw-r--r--tools/lldb-mi/MICmnMIValueResult.h66
-rw-r--r--tools/lldb-mi/MICmnMIValueTuple.cpp194
-rw-r--r--tools/lldb-mi/MICmnMIValueTuple.h63
-rw-r--r--tools/lldb-mi/MICmnResources.cpp619
-rw-r--r--tools/lldb-mi/MICmnResources.h339
-rw-r--r--tools/lldb-mi/MICmnStreamStderr.cpp249
-rw-r--r--tools/lldb-mi/MICmnStreamStderr.h61
-rw-r--r--tools/lldb-mi/MICmnStreamStdin.cpp218
-rw-r--r--tools/lldb-mi/MICmnStreamStdin.h60
-rw-r--r--tools/lldb-mi/MICmnStreamStdout.cpp230
-rw-r--r--tools/lldb-mi/MICmnStreamStdout.h62
-rw-r--r--tools/lldb-mi/MICmnThreadMgrStd.cpp145
-rw-r--r--tools/lldb-mi/MICmnThreadMgrStd.h123
-rw-r--r--tools/lldb-mi/MIDataTypes.h60
-rw-r--r--tools/lldb-mi/MIDriver.cpp1318
-rw-r--r--tools/lldb-mi/MIDriver.h180
-rw-r--r--tools/lldb-mi/MIDriverBase.cpp179
-rw-r--r--tools/lldb-mi/MIDriverBase.h67
-rw-r--r--tools/lldb-mi/MIDriverMain.cpp194
-rw-r--r--tools/lldb-mi/MIDriverMgr.cpp727
-rw-r--r--tools/lldb-mi/MIDriverMgr.h128
-rw-r--r--tools/lldb-mi/MIExtensions.txt104
-rw-r--r--tools/lldb-mi/MIReadMe.txt37
-rw-r--r--tools/lldb-mi/MIUtilDateTimeStd.cpp84
-rw-r--r--tools/lldb-mi/MIUtilDateTimeStd.h40
-rw-r--r--tools/lldb-mi/MIUtilDebug.cpp91
-rw-r--r--tools/lldb-mi/MIUtilDebug.h79
-rw-r--r--tools/lldb-mi/MIUtilFileStd.cpp282
-rw-r--r--tools/lldb-mi/MIUtilFileStd.h48
-rw-r--r--tools/lldb-mi/MIUtilMapIdToVariant.cpp99
-rw-r--r--tools/lldb-mi/MIUtilMapIdToVariant.h129
-rw-r--r--tools/lldb-mi/MIUtilSingletonBase.h52
-rw-r--r--tools/lldb-mi/MIUtilSingletonHelper.h81
-rw-r--r--tools/lldb-mi/MIUtilString.cpp915
-rw-r--r--tools/lldb-mi/MIUtilString.h95
-rw-r--r--tools/lldb-mi/MIUtilThreadBaseStd.cpp302
-rw-r--r--tools/lldb-mi/MIUtilThreadBaseStd.h140
-rw-r--r--tools/lldb-mi/MIUtilVariant.cpp344
-rw-r--r--tools/lldb-mi/MIUtilVariant.h247
-rw-r--r--tools/lldb-mi/Platform.h87
-rw-r--r--tools/lldb-mi/module.modulemap79
153 files changed, 0 insertions, 34857 deletions
diff --git a/tools/lldb-mi/MICmdArgContext.cpp b/tools/lldb-mi/MICmdArgContext.cpp
deleted file mode 100644
index 18da5b5d67a3..000000000000
--- a/tools/lldb-mi/MICmdArgContext.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-//===-- MICmdArgContext.cpp -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgContext constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgContext::CMICmdArgContext() {}
-
-//++
-// Details: CMICmdArgContext constructor.
-// Type: Method.
-// Args: vrCmdLineArgsRaw - (R) The text description of the arguments
-// options.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgContext::CMICmdArgContext(const CMIUtilString &vrCmdLineArgsRaw)
- : m_strCmdArgsAndOptions(vrCmdLineArgsRaw) {}
-
-//++
-// Details: CMICmdArgContext destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgContext::~CMICmdArgContext() {}
-
-//++
-// Details: Retrieve the remainder of the command's argument options left to
-// parse.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString & - Argument options text.
-// Throws: None.
-//--
-const CMIUtilString &CMICmdArgContext::GetArgsLeftToParse() const {
- return m_strCmdArgsAndOptions;
-}
-
-//++
-// Details: Ask if this arguments string has any arguments.
-// Type: Method.
-// Args: None.
-// Return: bool - True = Has one or more arguments present, false = no
-// arguments.
-// Throws: None.
-//--
-bool CMICmdArgContext::IsEmpty() const {
- return m_strCmdArgsAndOptions.empty();
-}
-
-//++
-// Details: Remove the argument from the options text and any space after the
-// argument
-// if applicable.
-// Type: Method.
-// Args: vArg - (R) The name of the argument.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgContext::RemoveArg(const CMIUtilString &vArg) {
- if (vArg.empty())
- return MIstatus::success;
-
- const size_t nLen = vArg.length();
- const size_t nLenCntxt = m_strCmdArgsAndOptions.length();
- if (nLen > nLenCntxt)
- return MIstatus::failure;
-
- size_t nExtraSpace = 0;
- size_t nPos = m_strCmdArgsAndOptions.find(vArg);
- while (1) {
- if (nPos == std::string::npos)
- return MIstatus::success;
-
- bool bPass1 = false;
- if (nPos != 0) {
- if (m_strCmdArgsAndOptions[nPos - 1] == ' ')
- bPass1 = true;
- } else
- bPass1 = true;
-
- const size_t nEnd = nPos + nLen;
-
- if (bPass1) {
- bool bPass2 = false;
- if (nEnd < nLenCntxt) {
- if (m_strCmdArgsAndOptions[nEnd] == ' ') {
- bPass2 = true;
- nExtraSpace = 1;
- }
- } else
- bPass2 = true;
-
- if (bPass2)
- break;
- }
-
- nPos = m_strCmdArgsAndOptions.find(vArg, nEnd);
- }
-
- const size_t nPosEnd = nLen + nExtraSpace;
- m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.replace(nPos, nPosEnd, "");
- m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.Trim();
-
- return MIstatus::success;
-}
-
-//++
-// Details: Remove the argument at the Nth word position along in the context
-// string.
-// Any space after the argument is removed if applicable. A search is
-// not
-// performed as there may be more than one vArg with the same 'name' in
-// the
-// context string.
-// Type: Method.
-// Args: vArg - (R) The name of the argument.
-// nArgIndex - (R) The word count position to which to remove the
-// vArg word.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgContext::RemoveArgAtPos(const CMIUtilString &vArg,
- size_t nArgIndex) {
- size_t nWordIndex = 0;
- CMIUtilString strBuildContextUp;
- const CMIUtilString::VecString_t vecWords(GetArgs());
- const bool bSpaceRequired(GetNumberArgsPresent() > 2);
-
- CMIUtilString::VecString_t::const_iterator it = vecWords.begin();
- const CMIUtilString::VecString_t::const_iterator itEnd = vecWords.end();
- while (it != itEnd) {
- const CMIUtilString &rWord(*it);
- if (nWordIndex++ != nArgIndex) {
- // Single words
- strBuildContextUp += rWord;
- if (bSpaceRequired)
- strBuildContextUp += " ";
- } else {
- // If quoted loose quoted text
- if (++it != itEnd) {
- CMIUtilString words = rWord;
- while (vArg != words) {
- if (bSpaceRequired)
- words += " ";
- words += *it;
- if (++it == itEnd)
- break;
- }
- if (it != itEnd)
- --it;
- }
- }
-
- // Next
- if (it != itEnd)
- ++it;
- }
-
- m_strCmdArgsAndOptions = strBuildContextUp;
- m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.Trim();
-
- return MIstatus::success;
-}
-
-//++
-// Details: Retrieve number of arguments or options present in the command's
-// option text.
-// Type: Method.
-// Args: None.
-// Return: size_t - 0 to n arguments present.
-// Throws: None.
-//--
-size_t CMICmdArgContext::GetNumberArgsPresent() const {
- CMIUtilString::VecString_t vecOptions;
- return m_strCmdArgsAndOptions.SplitConsiderQuotes(" ", vecOptions);
-}
-
-//++
-// Details: Retrieve all the arguments or options remaining in *this context.
-// Type: Method.
-// Args: None.
-// Return: MIUtilString::VecString_t - List of args remaining.
-// Throws: None.
-//--
-CMIUtilString::VecString_t CMICmdArgContext::GetArgs() const {
- CMIUtilString::VecString_t vecOptions;
- m_strCmdArgsAndOptions.SplitConsiderQuotes(" ", vecOptions);
- return vecOptions;
-}
-
-//++
-// Details: Copy assignment operator.
-// Type: Method.
-// Args: vOther - (R) The variable to copy from.
-// Return: CMIUtilString & - this object.
-// Throws: None.
-//--
-CMICmdArgContext &CMICmdArgContext::operator=(const CMICmdArgContext &vOther) {
- if (this != &vOther) {
- m_strCmdArgsAndOptions = vOther.m_strCmdArgsAndOptions;
- }
-
- return *this;
-}
diff --git a/tools/lldb-mi/MICmdArgContext.h b/tools/lldb-mi/MICmdArgContext.h
deleted file mode 100644
index 801d2d90cdc5..000000000000
--- a/tools/lldb-mi/MICmdArgContext.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//===-- MICmdArgContext.h ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MIUtilString.h"
-
-//++
-//============================================================================
-// Details: MI common code class. Command arguments and options string. Holds
-// the context string.
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgContext {
- // Methods:
-public:
- /* ctor */ CMICmdArgContext();
- /* ctor */ CMICmdArgContext(const CMIUtilString &vrCmdLineArgsRaw);
- //
- const CMIUtilString &GetArgsLeftToParse() const;
- size_t GetNumberArgsPresent() const;
- CMIUtilString::VecString_t GetArgs() const;
- bool IsEmpty() const;
- bool RemoveArg(const CMIUtilString &vArg);
- bool RemoveArgAtPos(const CMIUtilString &vArg, size_t nArgIndex);
- //
- CMICmdArgContext &operator=(const CMICmdArgContext &vOther);
-
- // Overridden:
-public:
- // From CMIUtilString
- /* dtor */ virtual ~CMICmdArgContext();
-
- // Attributes:
-private:
- CMIUtilString m_strCmdArgsAndOptions;
-};
diff --git a/tools/lldb-mi/MICmdArgSet.cpp b/tools/lldb-mi/MICmdArgSet.cpp
deleted file mode 100644
index 0d67c03bfeae..000000000000
--- a/tools/lldb-mi/MICmdArgSet.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-//===-- MICmdArgSet.cpp -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgSet.h"
-#include "MICmdArgValBase.h"
-#include "MICmnLog.h"
-#include "MICmnResources.h"
-
-//++
-// Details: CMICmdArgSet constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgSet::CMICmdArgSet()
- : m_bIsArgsPresentButNotHandledByCmd(false), m_constStrCommaSpc(", ") {}
-
-//++
-// Details: CMICmdArgSet destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgSet::~CMICmdArgSet() {
- // Tidy up
- Destroy();
-}
-
-//++
-// Details: Release resources used by *this container object.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMICmdArgSet::Destroy() {
- // Delete command argument objects
- if (!m_setCmdArgs.empty()) {
- SetCmdArgs_t::iterator it = m_setCmdArgs.begin();
- while (it != m_setCmdArgs.end()) {
- CMICmdArgValBase *pArg(*it);
- delete pArg;
-
- // Next
- ++it;
- }
- m_setCmdArgs.clear();
- }
-
- m_setCmdArgsThatNotValid.clear();
- m_setCmdArgsThatAreMissing.clear();
- m_setCmdArgsNotHandledByCmd.clear();
- m_setCmdArgsMissingInfo.clear();
- m_bIsArgsPresentButNotHandledByCmd = false;
-}
-
-//++
-// Details: Retrieve the state flag indicating that the command set up ready to
-// parse
-// command arguments or options found that one or more arguments was
-// indeed
-// present but not handled. This is given as a warning in the MI log
-// file.
-// Type: Method.
-// Args: None.
-// Return: bool - True = one or more args not handled, false = all args handled
-// Throws: None.
-//--
-bool CMICmdArgSet::IsArgsPresentButNotHandledByCmd() const {
- return m_bIsArgsPresentButNotHandledByCmd;
-}
-
-//++
-// Details: Add the list of command's arguments to parse and validate another
-// one.
-// Type: Method.
-// Args: vArg - (R) A command argument object.
-// Return: None.
-// Throws: None.
-//--
-void CMICmdArgSet::Add(CMICmdArgValBase *vArg) { m_setCmdArgs.push_back(vArg); }
-
-//++
-// Details: After validating an options line of text (the context) and there is
-// a failure,
-// it is likely a mandatory command argument that is required is
-// missing. This
-// function returns the argument that should be present.
-// Type: Method.
-// Args: None.
-// Return: SetCmdArgs_t & - Set of argument objects.
-// Throws: None.
-//--
-const CMICmdArgSet::SetCmdArgs_t &CMICmdArgSet::GetArgsThatAreMissing() const {
- return m_setCmdArgsThatAreMissing;
-}
-
-//++
-// Details: After validating an options line of text (the context) and there is
-// a failure,
-// it may be because one or more arguments were unable to extract a
-// value. This
-// function returns the argument that were found to be invalid.
-// Type: Method.
-// Args: None.
-// Return: SetCmdArgs_t & - Set of argument objects.
-// Throws: None.
-//--
-const CMICmdArgSet::SetCmdArgs_t &CMICmdArgSet::GetArgsThatInvalid() const {
- return m_setCmdArgsThatNotValid;
-}
-
-//++
-// Details: The list of argument or option (objects) that were specified by the
-// command
-// and so recognised when parsed but were not handled. Ideally the
-// command
-// should handle all arguments and options presented to it. The command
-// sends
-// warning to the MI log file to say that these options were not
-// handled.
-// Used as one way to determine option that maybe should really be
-// implemented
-// and not just ignored.
-// Type: Method.
-// Args: None.
-// Return: SetCmdArgs_t & - Set of argument objects.
-// Throws: None.
-//--
-const CMICmdArgSet::SetCmdArgs_t &CMICmdArgSet::GetArgsNotHandledByCmd() const {
- return m_setCmdArgsNotHandledByCmd;
-}
-
-//++
-// Details: Given a set of command argument objects parse the context option
-// string to
-// find those argument and retrieve their value. If the function fails
-// call
-// GetArgsThatAreMissing() to see which commands that were mandatory
-// were
-// missing or failed to parse.
-// Type: Method.
-// Args: vStrMiCmd - (R) Command's name.
-// vCmdArgsText - (RW) A command's options or argument.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgSet::Validate(const CMIUtilString &vStrMiCmd,
- CMICmdArgContext &vwCmdArgsText) {
- m_cmdArgContext = vwCmdArgsText;
-
- // Iterate all the arguments or options required by a command
- SetCmdArgs_t::const_iterator it = m_setCmdArgs.begin();
- while (it != m_setCmdArgs.end()) {
- CMICmdArgValBase *pArg = *it;
-
- if (!pArg->Validate(vwCmdArgsText)) {
- if (pArg->GetFound()) {
- if (pArg->GetIsMissingOptions())
- m_setCmdArgsMissingInfo.push_back(pArg);
- else if (!pArg->GetValid())
- m_setCmdArgsThatNotValid.push_back(pArg);
- } else if (pArg->GetIsMandatory())
- m_setCmdArgsThatAreMissing.push_back(pArg);
- }
-
- if (pArg->GetFound() && !pArg->GetIsHandledByCmd()) {
- m_bIsArgsPresentButNotHandledByCmd = true;
- m_setCmdArgsNotHandledByCmd.push_back(pArg);
- }
-
- // Next
- ++it;
- }
-
- // report any issues with arguments/options
- if (IsArgsPresentButNotHandledByCmd())
- WarningArgsNotHandledbyCmdLogFile(vStrMiCmd);
-
- return ValidationFormErrorMessages(vwCmdArgsText);
-}
-
-//++
-// Details: Having validated the command's options text and failed for some
-// reason form
-// the error message made up with the faults found.
-// Type: Method.
-// vCmdArgsText - (RW) A command's options or argument.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgSet::ValidationFormErrorMessages(
- const CMICmdArgContext &vwCmdArgsText) {
- CMIUtilString strListMissing;
- CMIUtilString strListInvalid;
- CMIUtilString strListMissingInfo;
- const bool bArgsMissing = (m_setCmdArgsThatAreMissing.size() > 0);
- const bool bArgsInvalid = (m_setCmdArgsThatNotValid.size() > 0);
- const bool bArgsMissingInfo = (m_setCmdArgsMissingInfo.size() > 0);
- if (!(bArgsMissing || bArgsInvalid || bArgsMissingInfo))
- return MIstatus::success;
- if (bArgsMissing) {
- MIuint i = 0;
- SetCmdArgs_t::const_iterator it = m_setCmdArgsThatAreMissing.begin();
- while (it != m_setCmdArgsThatAreMissing.end()) {
- if (i++ > 0)
- strListMissing += m_constStrCommaSpc;
-
- const CMICmdArgValBase *pArg(*it);
- strListMissing += pArg->GetName();
-
- // Next
- ++it;
- }
- }
- if (bArgsInvalid) {
- MIuint i = 0;
- SetCmdArgs_t::const_iterator it = m_setCmdArgsThatNotValid.begin();
- while (it != m_setCmdArgsThatNotValid.end()) {
- if (i++ > 0)
- strListMissing += m_constStrCommaSpc;
-
- const CMICmdArgValBase *pArg(*it);
- strListInvalid += pArg->GetName();
-
- // Next
- ++it;
- }
- }
- if (bArgsMissingInfo) {
- MIuint i = 0;
- SetCmdArgs_t::const_iterator it = m_setCmdArgsMissingInfo.begin();
- while (it != m_setCmdArgsMissingInfo.end()) {
- if (i++ > 0)
- strListMissingInfo += m_constStrCommaSpc;
-
- const CMICmdArgValBase *pArg(*it);
- strListMissingInfo += pArg->GetName();
-
- // Next
- ++it;
- }
- }
-
- bool bHaveOneError = false;
- CMIUtilString strError = MIRSRC(IDS_CMD_ARGS_ERR_PREFIX_MSG);
- if (bArgsMissing && bArgsInvalid) {
- bHaveOneError = true;
- strError +=
- CMIUtilString::Format(MIRSRC(IDS_CMD_ARGS_ERR_VALIDATION_MAN_INVALID),
- strListMissing.c_str(), strListInvalid.c_str());
- }
- if (bArgsMissing) {
- if (bHaveOneError)
- strError += ". ";
- bHaveOneError = true;
- strError += CMIUtilString::Format(
- MIRSRC(IDS_CMD_ARGS_ERR_VALIDATION_MANDATORY), strListMissing.c_str());
- }
- if (bArgsMissingInfo) {
- if (bHaveOneError)
- strError += ". ";
- bHaveOneError = true;
- strError +=
- CMIUtilString::Format(MIRSRC(IDS_CMD_ARGS_ERR_VALIDATION_MISSING_INF),
- strListMissingInfo.c_str());
- }
- if (bArgsInvalid) {
- if (bHaveOneError)
- strError += ". ";
- bHaveOneError = true;
- strError += CMIUtilString::Format(
- MIRSRC(IDS_CMD_ARGS_ERR_VALIDATION_INVALID), strListInvalid.c_str());
- }
- if (!vwCmdArgsText.IsEmpty()) {
- if (bHaveOneError)
- strError += ". ";
- bHaveOneError = true;
- strError +=
- CMIUtilString::Format(MIRSRC(IDS_CMD_ARGS_ERR_CONTEXT_NOT_ALL_EATTEN),
- vwCmdArgsText.GetArgsLeftToParse().c_str());
- }
-
- if (bHaveOneError) {
- SetErrorDescription(strError);
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Ask if the command's argument options text had any arguments.
-// Type: Method.
-// Args: None.
-// Return: bool - True = Has one or more arguments present, false = no
-// arguments.
-// Throws: None.
-//--
-bool CMICmdArgSet::IsArgContextEmpty() const {
- return m_cmdArgContext.IsEmpty();
-}
-
-//++
-// Details: Retrieve the number of arguments that are being used for the
-// command.
-// Type: Method.
-// Args: None.
-// Return: size_t - Argument count.
-// Throws: None.
-//--
-size_t CMICmdArgSet::GetCount() const { return m_setCmdArgs.size(); }
-
-//++
-// Details: Given a set of command argument objects retrieve the argument with
-// the
-// specified name.
-// Type: Method.
-// Args: vpArg - (W) A pointer to a command's argument object.
-// Return: True - Argument found.
-// False - Argument not found.
-// Throws: None.
-//--
-bool CMICmdArgSet::GetArg(const CMIUtilString &vArgName,
- CMICmdArgValBase *&vpArg) const {
- bool bFound = false;
- SetCmdArgs_t::const_iterator it = m_setCmdArgs.begin();
- while (it != m_setCmdArgs.end()) {
- CMICmdArgValBase *pArg(*it);
- if (pArg->GetName() == vArgName) {
- bFound = true;
- vpArg = pArg;
- break;
- }
-
- // Next
- ++it;
- }
-
- return bFound;
-}
-
-//++
-// Details: Write a warning message to the MI Log file about the command's
-// arguments or
-// options that were found present but not handled.
-// Type: Method.
-// Args: vrCmdName - (R) The command's name.
-// Return: None.
-// Throws: None.
-//--
-void CMICmdArgSet::WarningArgsNotHandledbyCmdLogFile(
- const CMIUtilString &vrCmdName) {
-#if MICONFIG_GIVE_WARNING_CMD_ARGS_NOT_HANDLED
-
- CMIUtilString strArgsNotHandled;
- const CMICmdArgSet::SetCmdArgs_t &rSetArgs = GetArgsNotHandledByCmd();
- MIuint nCnt = 0;
- CMICmdArgSet::SetCmdArgs_t::const_iterator it = rSetArgs.begin();
- while (it != rSetArgs.end()) {
- if (nCnt++ > 0)
- strArgsNotHandled += m_constStrCommaSpc;
- const CMICmdArgValBase *pArg = *it;
- strArgsNotHandled += pArg->GetName();
-
- // Next
- ++it;
- }
-
- const CMIUtilString strWarningMsg(
- CMIUtilString::Format(MIRSRC(IDS_CMD_WRN_ARGS_NOT_HANDLED),
- vrCmdName.c_str(), strArgsNotHandled.c_str()));
- m_pLog->WriteLog(strWarningMsg);
-
-#endif // MICONFIG_GIVE_WARNING_CMD_ARGS_NOT_HANDLED
-}
diff --git a/tools/lldb-mi/MICmdArgSet.h b/tools/lldb-mi/MICmdArgSet.h
deleted file mode 100644
index 4df5aaf51567..000000000000
--- a/tools/lldb-mi/MICmdArgSet.h
+++ /dev/null
@@ -1,107 +0,0 @@
-//===-- MICmdArgSet.h -------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-#include <vector>
-
-#include "MICmdArgContext.h"
-#include "MICmnBase.h"
-
-// Declarations:
-class CMICmdArgValBase;
-
-//++
-//============================================================================
-// Details: MI common code class. Command arguments container class.
-// A command may have one or more arguments of which some may be
-// optional.
-// *this class contains a list of the command's arguments which are
-// validates against the commands argument options string (context
-// string).
-// Each argument tries to extract the value it is looking for.
-// Argument objects added to *this container are owned by this
-// container
-// and are deleted when this container goes out of scope. Allocate
-// argument
-// objects on the heap.
-// It is assumed the arguments to be parsed are read from left to right
-// in
-// order. The order added to *this container is the order they will
-// parsed.
-//--
-class CMICmdArgSet : public CMICmnBase {
- // Classes:
-public:
- //++
- // Description: ArgSet's interface for command arguments to implement.
- //--
- class IArg {
- public:
- virtual bool GetFound() const = 0;
- virtual bool GetIsHandledByCmd() const = 0;
- virtual bool GetIsMandatory() const = 0;
- virtual bool GetIsMissingOptions() const = 0;
- virtual const CMIUtilString &GetName() const = 0;
- virtual bool GetValid() const = 0;
- virtual bool Validate(CMICmdArgContext &vwArgContext) = 0;
-
- virtual ~IArg() = default;
- };
-
- // Typedefs:
- typedef std::vector<CMICmdArgValBase *> SetCmdArgs_t;
-
- // Methods:
- CMICmdArgSet();
-
- void Add(CMICmdArgValBase *vArg);
- bool GetArg(const CMIUtilString &vArgName, CMICmdArgValBase *&vpArg) const;
- const SetCmdArgs_t &GetArgsThatAreMissing() const;
- const SetCmdArgs_t &GetArgsThatInvalid() const;
- size_t GetCount() const;
- bool IsArgContextEmpty() const;
- bool IsArgsPresentButNotHandledByCmd() const;
- void WarningArgsNotHandledbyCmdLogFile(const CMIUtilString &vrCmdName);
- bool Validate(const CMIUtilString &vStrMiCmd,
- CMICmdArgContext &vwCmdArgsText);
-
- // Overrideable:
- ~CMICmdArgSet() override;
-
- // Methods:
-private:
- const SetCmdArgs_t &GetArgsNotHandledByCmd() const;
- void Destroy(); // Release resources used by *this object
- bool ValidationFormErrorMessages(const CMICmdArgContext &vwCmdArgsText);
-
- // Attributes:
- bool m_bIsArgsPresentButNotHandledByCmd; // True = The driver's client
- // presented the command with options
- // recognised but not handled by
- // a command, false = all args handled
- SetCmdArgs_t m_setCmdArgs; // The set of arguments that are that the command
- // is expecting to find in the options string
- SetCmdArgs_t m_setCmdArgsThatAreMissing; // The set of arguments that are
- // required by the command but are
- // missing
- SetCmdArgs_t m_setCmdArgsThatNotValid; // The set of arguments found in the
- // text but for some reason unable to
- // extract a value
- SetCmdArgs_t m_setCmdArgsNotHandledByCmd; // The set of arguments specified by
- // the command which were present to
- // the command but not handled
- SetCmdArgs_t m_setCmdArgsMissingInfo; // The set of arguments that were
- // present but were found to be missing
- // additional information i.e.
- // --thread 3 but 3 is missing
- CMICmdArgContext m_cmdArgContext; // Copy of the command's argument options
- // text before validate takes place (empties
- // it of content)
- const CMIUtilString m_constStrCommaSpc;
-};
diff --git a/tools/lldb-mi/MICmdArgValBase.cpp b/tools/lldb-mi/MICmdArgValBase.cpp
deleted file mode 100644
index dc9c7e0257e7..000000000000
--- a/tools/lldb-mi/MICmdArgValBase.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-//===-- MICmdArgValBase.cpp -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "MICmdArgValBase.h"
-#include "MICmdArgContext.h"
-#include "MIUtilString.h"
-
-//++
-// Details: CMICmdArgValBase constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValBase::CMICmdArgValBase()
- : m_bFound(false), m_bValid(false), m_bMandatory(false), m_bHandled(false),
- m_bIsMissingOptions(false) {}
-
-//++
-// Details: CMICmdArgValBase constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValBase::CMICmdArgValBase(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd)
- : m_bFound(false), m_bValid(false), m_bMandatory(vbMandatory),
- m_strArgName(vrArgName), m_bHandled(vbHandleByCmd),
- m_bIsMissingOptions(false) {}
-
-//++
-// Details: Retrieve the state flag of whether the argument is handled by the
-// command or
-// not.
-// Type: Method.
-// Args: None.
-// Return: True - Command needs more information.
-// False - All information is present as expected.
-// Throws: None.
-//--
-bool CMICmdArgValBase::GetIsMissingOptions() const {
- return m_bIsMissingOptions;
-}
-
-//++
-// Details: Retrieve the state flag of whether the argument is handled by the
-// command or
-// not.
-// Type: Method.
-// Args: None.
-// Return: True - Command handles *this argument or option.
-// False - Not handled (argument specified but ignored).
-// Throws: None.
-//--
-bool CMICmdArgValBase::GetIsHandledByCmd() const { return m_bHandled; }
-
-//++
-// Details: Retrieve the name of *this argument.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString & - Return the text name.
-// Throws: None.
-//--
-const CMIUtilString &CMICmdArgValBase::GetName() const { return m_strArgName; }
-
-//++
-// Details: Retrieve the state flag of whether the argument was found in the
-// command's
-// argument / options string.
-// Type: Method.
-// Args: None.
-// Return: True - Argument found.
-// False - Argument not found.
-// Throws: None.
-//--
-bool CMICmdArgValBase::GetFound() const { return m_bFound; }
-
-//++
-// Details: Retrieve the state flag indicating whether the value was obtained
-// from the
-// text arguments string and is valid.
-// Type: Method.
-// Args: None.
-// Return: True - Argument valid.
-// False - Argument not valid.
-// Throws: None.
-//--
-bool CMICmdArgValBase::GetValid() const { return m_bValid; }
-
-//++
-// Details: Retrieve the state flag indicating whether *this argument is a
-// mandatory
-// argument for the command or is optional to be present.
-// Type: Method.
-// Args: None.
-// Return: True - Mandatory.
-// False - Optional.
-// Throws: None.
-//--
-bool CMICmdArgValBase::GetIsMandatory() const { return m_bMandatory; }
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// value *this
-// argument is looking for.
-// Type: Overrideable.
-// Args: vArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValBase::Validate(CMICmdArgContext &vwArgContext) {
- MIunused(vwArgContext);
-
- // Override to implement
-
- return MIstatus::failure;
-}
diff --git a/tools/lldb-mi/MICmdArgValBase.h b/tools/lldb-mi/MICmdArgValBase.h
deleted file mode 100644
index feb7fe4f04d3..000000000000
--- a/tools/lldb-mi/MICmdArgValBase.h
+++ /dev/null
@@ -1,115 +0,0 @@
-//===-- MICmdArgValBase.h ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-#include "MICmdArgSet.h"
-#include "MIUtilString.h"
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument base class. Arguments objects
-// needing specialization derived from *this class. An argument knows
-// what type of argument it is and how it is to interpret the options
-// (context) string to find and validate a matching argument and so
-// extract a value from it.
-// Argument objects are added to the CMICmdArgSet container object.
-// Once added the container they belong to that contain and will be
-// deleted when the container goes out of scope. Allocate argument
-// objects on the heap and pass in to the Add().
-// Note the code is written such that a command will produce an error
-// should it be presented with arguments or options it does not
-// understand.
-// A command can recognise an option or argument then ignore if it
-// wishes (a warning is sent to the MI's Log file). This is so it is
-// hardwired to fail and catch arguments or options that presented by
-// different driver clients.
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValBase : public CMICmdArgSet::IArg {
- // Methods:
-public:
- CMICmdArgValBase();
- CMICmdArgValBase(const CMIUtilString &vrArgName, const bool vbMandatory,
- const bool vbHandleByCmd);
-
- // Overrideable:
- ~CMICmdArgValBase() override = default;
-
- // Overridden:
- // From CMICmdArgSet::IArg
- bool GetFound() const override;
- bool GetIsHandledByCmd() const override;
- bool GetIsMandatory() const override;
- bool GetIsMissingOptions() const override;
- const CMIUtilString &GetName() const override;
- bool GetValid() const override;
- bool Validate(CMICmdArgContext &vwArgContext) override;
-
- // Attributes:
-protected:
- bool
- m_bFound; // True = yes found in arguments options text, false = not found
- bool m_bValid; // True = yes argument parsed and valid, false = not valid
- bool
- m_bMandatory; // True = yes arg must be present, false = optional argument
- CMIUtilString m_strArgName;
- bool m_bHandled; // True = Command processes *this option, false = not handled
- bool m_bIsMissingOptions; // True = Command needs more information, false = ok
-};
-
-//++
-//============================================================================
-// Details: MI common code class. Templated command argument base class.
-//--
-template <class T> class CMICmdArgValBaseTemplate : public CMICmdArgValBase {
- // Methods:
-public:
- CMICmdArgValBaseTemplate() = default;
- CMICmdArgValBaseTemplate(const CMIUtilString &vrArgName,
- const bool vbMandatory, const bool vbHandleByCmd);
- //
- const T &GetValue() const;
-
- // Overrideable:
- ~CMICmdArgValBaseTemplate() override = default;
-
- // Attributes:
-protected:
- T m_argValue;
-};
-
-//++
-// Details: CMICmdArgValBaseTemplate constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// Return: None.
-// Throws: None.
-//--
-template <class T>
-CMICmdArgValBaseTemplate<T>::CMICmdArgValBaseTemplate(
- const CMIUtilString &vrArgName, const bool vbMandatory,
- const bool vbHandleByCmd)
- : CMICmdArgValBase(vrArgName, vbMandatory, vbHandleByCmd) {}
-
-//++
-// Details: Retrieve the value the argument parsed from the command's argument /
-// options
-// text string.
-// Type: Method.
-// Args: None.
-// Return: Template type & - The arg value of *this object.
-// Throws: None.
-//--
-template <class T> const T &CMICmdArgValBaseTemplate<T>::GetValue() const {
- return m_argValue;
-}
diff --git a/tools/lldb-mi/MICmdArgValConsume.cpp b/tools/lldb-mi/MICmdArgValConsume.cpp
deleted file mode 100644
index 01d001366596..000000000000
--- a/tools/lldb-mi/MICmdArgValConsume.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-//===-- MICmdArgValConsume.cpp ----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValConsume.h"
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgValConsume constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValConsume::CMICmdArgValConsume() {}
-
-//++
-// Details: CMICmdArgValConsume constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValConsume::CMICmdArgValConsume(const CMIUtilString &vrArgName,
- const bool vbMandatory)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, true) {}
-
-//++
-// Details: CMICmdArgValConsume destructor.
-// Type: Overidden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValConsume::~CMICmdArgValConsume() {}
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// value *this
-// argument is looking for.
-// Type: Overridden.
-// Args: vwArgContext - (R) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValConsume::Validate(CMICmdArgContext &vwArgContext) {
- if (vwArgContext.IsEmpty())
- return m_bMandatory ? MIstatus::failure : MIstatus::success;
-
- // Consume the optional file, line, linenum arguments till the mode '--'
- // argument
- const CMIUtilString::VecString_t vecOptions(vwArgContext.GetArgs());
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- const CMIUtilString &rTxt(*it);
-
- if (rTxt == "--") {
- m_bFound = true;
- m_bValid = true;
- if (!vwArgContext.RemoveArg(rTxt))
- return MIstatus::failure;
- return MIstatus::success;
- }
- // Next
- ++it;
- }
-
- return MIstatus::failure;
-}
-
-//++
-// Details: Nothing to examine as we just want to consume the argument or option
-// (ignore
-// it).
-// Type: Method.
-// Args: None.
-// Return: bool - True = yes ok, false = not ok.
-// Throws: None.
-//--
-bool CMICmdArgValConsume::IsOk() const { return true; }
diff --git a/tools/lldb-mi/MICmdArgValConsume.h b/tools/lldb-mi/MICmdArgValConsume.h
deleted file mode 100644
index 62207f04b679..000000000000
--- a/tools/lldb-mi/MICmdArgValConsume.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//===-- MICmdArgValConsume.h ------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmdArgValBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValBase class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument. This type having recognised its argument name just
-// consumes
-// that argument or option (ignores it). This is the so the validation
-// process can then ask if all arguments or options have been
-// recognised
-// other an error will occurred "argument not recognised". For example
-// this can be used to consume the "--" text which is not an argument
-// in
-// itself. Normally the GetValue() function (in base class) would
-// return
-// a value for the argument but is not the case for *this argument type
-// object.
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValConsume : public CMICmdArgValBaseTemplate<CMIUtilString> {
- // Methods:
-public:
- /* ctor */ CMICmdArgValConsume();
- /* ctor */ CMICmdArgValConsume(const CMIUtilString &vrArgName,
- const bool vbMandatory);
- //
- bool IsOk() const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValConsume() override;
- // From CMICmdArgSet::IArg
- bool Validate(CMICmdArgContext &vwArgContext) override;
-};
diff --git a/tools/lldb-mi/MICmdArgValFile.cpp b/tools/lldb-mi/MICmdArgValFile.cpp
deleted file mode 100644
index 7171b0fa8f18..000000000000
--- a/tools/lldb-mi/MICmdArgValFile.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-//===-- MICmdArgValFile.cpp -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValFile.h"
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgValFile constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValFile::CMICmdArgValFile() {}
-
-//++
-// Details: CMICmdArgValFile constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValFile::CMICmdArgValFile(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd) {}
-
-//++
-// Details: CMICmdArgValFile destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValFile::~CMICmdArgValFile() {}
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// value *this
-// argument is looking for.
-// Type: Overridden.
-// Args: vwArgContext - (R) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValFile::Validate(CMICmdArgContext &vwArgContext) {
- if (vwArgContext.IsEmpty())
- return m_bMandatory ? MIstatus::failure : MIstatus::success;
-
- // The GDB/MI spec suggests there is only parameter
-
- if (vwArgContext.GetNumberArgsPresent() == 1) {
- const CMIUtilString &rFile(vwArgContext.GetArgsLeftToParse());
- if (IsFilePath(rFile)) {
- m_bFound = true;
- m_bValid = true;
- m_argValue = rFile.Trim('"');
- vwArgContext.RemoveArg(rFile);
- return MIstatus::success;
- } else
- return MIstatus::failure;
- }
-
- // In reality there are more than one option, if so the file option
- // is the last one (don't handle that here - find the best looking one)
- const CMIUtilString::VecString_t vecOptions(vwArgContext.GetArgs());
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- const CMIUtilString &rTxt(*it);
- if (IsFilePath(rTxt)) {
- m_bFound = true;
-
- if (vwArgContext.RemoveArg(rTxt)) {
- m_bValid = true;
- m_argValue = rTxt.Trim('"');
- return MIstatus::success;
- } else
- return MIstatus::success;
- }
-
- // Next
- ++it;
- }
-
- return MIstatus::failure;
-}
-
-//++
-// Details: Given some text extract the file name path from it. If a space is
-// found in
-// path done return the path surrounded in quotes.
-// Type: Method.
-// Args: vrTxt - (R) The text to extract the file name path from.
-// Return: CMIUtilString - File name and or path.
-// Throws: None.
-//--
-CMIUtilString
-CMICmdArgValFile::GetFileNamePath(const CMIUtilString &vrTxt) const {
- CMIUtilString fileNamePath(vrTxt);
-
- // Look for a space in the path
- const char cSpace = ' ';
- const size_t nPos = fileNamePath.find(cSpace);
- if (nPos != std::string::npos)
- fileNamePath = CMIUtilString::Format("\"%s\"", fileNamePath.c_str());
-
- return fileNamePath;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid file name path.
-// Type: Method.
-// Args: vrFileNamePath - (R) File's name and directory path.
-// Return: bool - True = yes valid file path, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValFile::IsFilePath(const CMIUtilString &vrFileNamePath) const {
- if (vrFileNamePath.empty())
- return false;
-
- const bool bHavePosSlash = (vrFileNamePath.find('/') != std::string::npos);
- const bool bHaveBckSlash = (vrFileNamePath.find('\\') != std::string::npos);
-
- // Look for --someLongOption
- size_t nPos = vrFileNamePath.find("--");
- const bool bLong = (nPos == 0);
- if (bLong)
- return false;
-
- // Look for -f type short parameters
- nPos = vrFileNamePath.find('-');
- const bool bShort = (nPos == 0);
- if (bShort)
- return false;
-
- // Look for i1 i2 i3....
- nPos = vrFileNamePath.find('i');
- const bool bFoundI1 = ((nPos == 0) && (::isdigit(vrFileNamePath[1])));
- if (bFoundI1)
- return false;
-
- const bool bValidChars = IsValidChars(vrFileNamePath);
- return bValidChars || bHavePosSlash || bHaveBckSlash;
-}
-
-//++
-// Details: Determine if the path contains valid characters for a file path.
-// Letters can be
-// either upper or lower case.
-// Type: Method.
-// Args: vrText - (R) The text data to examine.
-// Return: bool - True = yes valid, false = one or more chars is valid.
-// Throws: None.
-//--
-bool CMICmdArgValFile::IsValidChars(const CMIUtilString &vrText) const {
- static CMIUtilString s_strSpecialCharacters(".'\"`@#$%^&*()_+-={}[]| ");
- const char *pPtr = vrText.c_str();
- for (MIuint i = 0; i < vrText.length(); i++, pPtr++) {
- const char c = *pPtr;
- if (::isalnum((int)c) == 0) {
- if (s_strSpecialCharacters.find(c) == CMIUtilString::npos)
- return false;
- }
- }
-
- return true;
-}
diff --git a/tools/lldb-mi/MICmdArgValFile.h b/tools/lldb-mi/MICmdArgValFile.h
deleted file mode 100644
index 8030cb783aab..000000000000
--- a/tools/lldb-mi/MICmdArgValFile.h
+++ /dev/null
@@ -1,47 +0,0 @@
-//===-- MICmdArgValFile.h ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmdArgValBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValBase class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument and so extract a value from it .
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValFile : public CMICmdArgValBaseTemplate<CMIUtilString> {
- // Methods:
-public:
- /* ctor */ CMICmdArgValFile();
- /* ctor */ CMICmdArgValFile(const CMIUtilString &vrArgName,
- const bool vbMandatory, const bool vbHandleByCmd);
- //
- bool IsFilePath(const CMIUtilString &vrFileNamePath) const;
- CMIUtilString GetFileNamePath(const CMIUtilString &vrTxt) const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValFile() override;
- // From CMICmdArgSet::IArg
- bool Validate(CMICmdArgContext &vwArgContext) override;
-
- // Methods:
-private:
- bool IsValidChars(const CMIUtilString &vrText) const;
-};
diff --git a/tools/lldb-mi/MICmdArgValListBase.cpp b/tools/lldb-mi/MICmdArgValListBase.cpp
deleted file mode 100644
index bd175f3afe64..000000000000
--- a/tools/lldb-mi/MICmdArgValListBase.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-//===-- MICmdArgValListBase.cpp ---------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValListBase.h"
-#include "MICmdArgContext.h"
-#include "MICmdArgValConsume.h"
-#include "MICmdArgValFile.h"
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValString.h"
-#include "MICmdArgValThreadGrp.h"
-
-//++
-// Details: CMICmdArgValListBase constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValListBase::CMICmdArgValListBase()
- : m_eArgType(eArgValType_invalid) {}
-
-//++
-// Details: CMICmdArgValListBase constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValListBase::CMICmdArgValListBase(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd),
- m_eArgType(eArgValType_invalid) {}
-
-//++
-// Details: CMICmdArgValListBase constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// veType - (R) The type of argument to look for and create
-// argument object of a certain type.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValListBase::CMICmdArgValListBase(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const ArgValType_e veType)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd),
- m_eArgType(veType) {}
-
-//++
-// Details: CMICmdArgValListBase destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValListBase::~CMICmdArgValListBase() {
- // Tidy up
- Destroy();
-}
-
-//++
-// Details: Tear down resources used by *this object.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMICmdArgValListBase::Destroy() {
- // Tidy up
- VecArgObjPtr_t::const_iterator it = m_argValue.begin();
- while (it != m_argValue.end()) {
- CMICmdArgValBase *pArgObj = *it;
- delete pArgObj;
-
- // Next
- ++it;
- }
- m_argValue.clear();
-}
-
-//++
-// Details: Create an CMICmdArgValBase derived object matching the type
-// specified
-// and put the option or argument's value inside it.
-// Type: Method.
-// Args: vrTxt - (R) Text version the option or argument.
-// veType - (R) The type of argument or option object to create.
-// Return: CMICmdArgValBase * - Option object holding the value.
-// - NULL = Functional failed.
-// Throws: None.
-//--
-CMICmdArgValBase *
-CMICmdArgValListBase::CreationObj(const CMIUtilString &vrTxt,
- const ArgValType_e veType) const {
- CMICmdArgValBase *pOptionObj = nullptr;
- switch (veType) {
- case eArgValType_File:
- pOptionObj = new CMICmdArgValFile();
- break;
- case eArgValType_Consume:
- pOptionObj = new CMICmdArgValConsume();
- break;
- case eArgValType_Number:
- pOptionObj = new CMICmdArgValNumber();
- break;
- case eArgValType_OptionLong:
- pOptionObj = new CMICmdArgValOptionLong();
- break;
- case eArgValType_OptionShort:
- pOptionObj = new CMICmdArgValOptionShort();
- break;
- case eArgValType_String:
- pOptionObj = new CMICmdArgValString();
- break;
- case eArgValType_StringQuoted:
- pOptionObj = new CMICmdArgValString(true, false, false);
- break;
- case eArgValType_StringQuotedNumber:
- pOptionObj = new CMICmdArgValString(true, true, false);
- break;
- case eArgValType_StringQuotedNumberPath:
- pOptionObj = new CMICmdArgValString(true, true, true);
- break;
- case eArgValType_StringAnything:
- pOptionObj = new CMICmdArgValString(true);
- break;
- case eArgValType_ThreadGrp:
- pOptionObj = new CMICmdArgValThreadGrp();
- break;
- default:
- return nullptr;
- }
-
- CMICmdArgContext argCntxt(vrTxt);
- if (!pOptionObj->Validate(argCntxt))
- return nullptr;
-
- return pOptionObj;
-}
-
-//++
-// Details: Validate the option or argument is the correct type.
-// Type: Method.
-// Args: vrTxt - (R) Text version the option or argument.
-// veType - (R) The type of value to expect.
-// Return: bool - True = Yes expected type present, False = no.
-// Throws: None.
-//--
-bool CMICmdArgValListBase::IsExpectedCorrectType(
- const CMIUtilString &vrTxt, const ArgValType_e veType) const {
- bool bValid = false;
- switch (veType) {
- case eArgValType_File:
- bValid = CMICmdArgValFile().IsFilePath(vrTxt);
- break;
- case eArgValType_Consume:
- bValid = CMICmdArgValConsume().IsOk();
- break;
- case eArgValType_Number:
- bValid = CMICmdArgValNumber().IsArgNumber(vrTxt);
- break;
- case eArgValType_OptionLong:
- bValid = CMICmdArgValOptionLong().IsArgLongOption(vrTxt);
- break;
- case eArgValType_OptionShort:
- bValid = CMICmdArgValOptionShort().IsArgShortOption(vrTxt);
- break;
- case eArgValType_String:
- bValid = CMICmdArgValString().IsStringArg(vrTxt);
- break;
- case eArgValType_StringQuoted:
- bValid = CMICmdArgValString(true, false, false).IsStringArg(vrTxt);
- break;
- case eArgValType_StringQuotedNumber:
- bValid = CMICmdArgValString(true, true, false).IsStringArg(vrTxt);
- break;
- case eArgValType_StringQuotedNumberPath:
- bValid = CMICmdArgValString(true, true, true).IsStringArg(vrTxt);
- break;
- case eArgValType_StringAnything:
- bValid = CMICmdArgValString(true).IsStringArg(vrTxt);
- break;
- case eArgValType_ThreadGrp:
- bValid = CMICmdArgValThreadGrp().IsArgThreadGrp(vrTxt);
- break;
- default:
- return false;
- }
-
- return bValid;
-}
diff --git a/tools/lldb-mi/MICmdArgValListBase.h b/tools/lldb-mi/MICmdArgValListBase.h
deleted file mode 100644
index 4437ae19a87c..000000000000
--- a/tools/lldb-mi/MICmdArgValListBase.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//===-- MICmdArgValListBase.h -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers:
-#include <vector>
-
-// In-house headers:
-#include "MICmdArgValBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument with addition options class.
-// For example --recurse 1 2 4 [group ...]. Arguments object that
-// require a list of options associated with them derive from the
-// CMICmdArgValListBase class. Additional options are also extracted
-// from
-// the command arguments text string.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// options and so extract a values from it .
-// The CMICmdArgValBase objects are added to the derived argument
-// class's
-// container. The option arguments belong to that derived class and
-// will
-// be deleted that object goes out of scope.
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValListBase
- : public CMICmdArgValBaseTemplate<std::vector<CMICmdArgValBase *>> {
- // Typedef:
-public:
- typedef std::vector<CMICmdArgValBase *> VecArgObjPtr_t;
-
- // Enums:
-public:
- //++
- // Details: CMICmdArgValListBase needs to know what type of argument to look
- // for in
- // the command options text. It also needs to create argument objects
- // of
- // a specific type.
- //--
- enum ArgValType_e {
- eArgValType_File = 0,
- eArgValType_Consume,
- eArgValType_Number,
- eArgValType_OptionLong,
- eArgValType_OptionShort,
- eArgValType_String,
- eArgValType_StringQuoted,
- eArgValType_StringQuotedNumber,
- eArgValType_StringQuotedNumberPath,
- eArgValType_StringAnything, // Accept any words for a string 'type' even if
- // they look like --longOptions for example
- eArgValType_ThreadGrp,
- eArgValType_count, // Always the last one
- eArgValType_invalid
- };
-
- // Methods:
-public:
- /* ctor */ CMICmdArgValListBase();
- /* ctor */ CMICmdArgValListBase(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd);
- /* ctor */ CMICmdArgValListBase(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const ArgValType_e veType);
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValListBase() override;
-
- // Methods:
-protected:
- bool IsExpectedCorrectType(const CMIUtilString &vrTxt,
- const ArgValType_e veType) const;
- CMICmdArgValBase *CreationObj(const CMIUtilString &vrTxt,
- const ArgValType_e veType) const;
-
- // Attributes:
-protected:
- ArgValType_e m_eArgType;
-
- // Methods:
-private:
- void Destroy();
-};
diff --git a/tools/lldb-mi/MICmdArgValListOfN.cpp b/tools/lldb-mi/MICmdArgValListOfN.cpp
deleted file mode 100644
index b53424543b2b..000000000000
--- a/tools/lldb-mi/MICmdArgValListOfN.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-//===-- MICmdArgValListOfN.cpp ----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgContext.h"
-#include "MICmdArgValFile.h"
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValString.h"
-#include "MICmdArgValThreadGrp.h"
-
-//++
-// Details: CMICmdArgValListOfN constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValListOfN::CMICmdArgValListOfN() {}
-
-//++
-// Details: CMICmdArgValListOfN constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// veType - (R) The type of argument to look for and create
-// argument object of a certain type.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValListOfN::CMICmdArgValListOfN(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const ArgValType_e veType)
- : CMICmdArgValListBase(vrArgName, vbMandatory, vbHandleByCmd, veType) {}
-
-//++
-// Details: CMICmdArgValListOfN destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValListOfN::~CMICmdArgValListOfN() {}
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// list of
-// arguments based on the argument object type to look for.
-// Type: Overridden.
-// Args: vwArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValListOfN::Validate(CMICmdArgContext &vwArgContext) {
- if (m_eArgType >= eArgValType_count) {
- m_eArgType = eArgValType_invalid;
- return MIstatus::failure;
- }
-
- if (vwArgContext.IsEmpty())
- return m_bMandatory ? MIstatus::failure : MIstatus::success;
-
- const CMIUtilString &rArg(vwArgContext.GetArgsLeftToParse());
- if (IsListOfN(rArg) && CreateList(rArg)) {
- m_bFound = true;
- m_bValid = true;
- vwArgContext.RemoveArg(rArg);
- return MIstatus::success;
- } else
- return MIstatus::failure;
-}
-
-//++
-// Details: Create list of argument objects each holding a value extract from
-// the command
-// options line.
-// Type: Method.
-// Args: vrTxt - (R) Some options text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValListOfN::CreateList(const CMIUtilString &vrTxt) {
- CMIUtilString::VecString_t vecOptions;
- if ((m_eArgType == eArgValType_StringQuoted) ||
- (m_eArgType == eArgValType_StringQuotedNumber) ||
- (m_eArgType == eArgValType_StringQuotedNumberPath) ||
- (m_eArgType == eArgValType_StringAnything)) {
- if (vrTxt.SplitConsiderQuotes(" ", vecOptions) == 0)
- return MIstatus::failure;
- } else if (vrTxt.Split(" ", vecOptions) == 0)
- return MIstatus::failure;
-
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- const CMIUtilString &rOption = *it;
- CMICmdArgValBase *pOption = CreationObj(rOption, m_eArgType);
- if (pOption != nullptr)
- m_argValue.push_back(pOption);
- else
- return MIstatus::failure;
-
- // Next
- ++it;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValListOfN::IsListOfN(const CMIUtilString &vrTxt) const {
- CMIUtilString::VecString_t vecOptions;
- if ((m_eArgType == eArgValType_StringQuoted) ||
- (m_eArgType == eArgValType_StringQuotedNumber) ||
- (m_eArgType == eArgValType_StringQuotedNumberPath) ||
- (m_eArgType == eArgValType_StringAnything)) {
- if (vrTxt.SplitConsiderQuotes(" ", vecOptions) == 0)
- return false;
- } else if (vrTxt.Split(" ", vecOptions) == 0)
- return false;
-
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- const CMIUtilString &rOption = *it;
- if (!IsExpectedCorrectType(rOption, m_eArgType))
- break;
-
- // Next
- ++it;
- }
-
- return true;
-}
-
-//++
-// Details: Retrieve the list of CMICmdArgValBase derived option objects found
-// following
-// *this long option argument. For example "list-thread-groups [
-// --recurse 1 ]"
-// where 1 is the list of expected option to follow.
-// Type: Method.
-// Args: None.
-// Return: CMICmdArgValListBase::VecArgObjPtr_t & - List of options.
-// Throws: None.
-//--
-const CMICmdArgValListBase::VecArgObjPtr_t &
-CMICmdArgValListOfN::GetExpectedOptions() const {
- return m_argValue;
-}
diff --git a/tools/lldb-mi/MICmdArgValListOfN.h b/tools/lldb-mi/MICmdArgValListOfN.h
deleted file mode 100644
index 74e8c16f7d6e..000000000000
--- a/tools/lldb-mi/MICmdArgValListOfN.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//===-- MICmdArgValListOfN.h ------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// Third party headers:
-#include <vector>
-
-// In-house headers:
-#include "MICmdArgValListBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValBase class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument and so extract a value from it .
-// The CMICmdArgValBase objects added to *this ListOfN container belong
-// to this container and will be deleted when *this object goes out of
-// scope.
-// To parse arguments like 'thread-id ...' i.e. 1 10 12 13 ...
-// If vbMandatory argument is true it takes on the (...)+ specification
-// otherwise assumed to be (...)* specification.
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValListOfN : public CMICmdArgValListBase {
- // Methods:
-public:
- /* ctor */ CMICmdArgValListOfN();
- /* ctor */ CMICmdArgValListOfN(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const ArgValType_e veType);
- //
- const VecArgObjPtr_t &GetExpectedOptions() const;
- template <class T1, typename T2>
- bool GetExpectedOption(T2 &vrwValue,
- const VecArgObjPtr_t::size_type vnAt = 0) const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValListOfN() override;
- // From CMICmdArgSet::IArg
- bool Validate(CMICmdArgContext &vArgContext) override;
-
- // Methods:
-private:
- bool IsListOfN(const CMIUtilString &vrTxt) const;
- bool CreateList(const CMIUtilString &vrTxt);
-};
-
-//++
-// Details: Retrieve the first argument or option value from the list of 1 or
-// more options
-// parsed from the command's options string.
-// Type: Template method.
-// Args: vrwValue - (W) Templated type return value.
-// vnAt - (R) Value at the specific position.
-// T1 - The argument value's class type of the data hold in
-// the list of options.
-// T2 - The type pf the variable which holds the value wanted.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed. List of object was empty.
-// Throws: None.
-//--
-template <class T1, typename T2>
-bool CMICmdArgValListOfN::GetExpectedOption(
- T2 &vrwValue, const VecArgObjPtr_t::size_type vnAt) const {
- const VecArgObjPtr_t &rVecOptions(GetExpectedOptions());
- if (rVecOptions.size() <= vnAt)
- return MIstatus::failure;
-
- VecArgObjPtr_t::const_iterator it2 = rVecOptions.begin() + vnAt;
- if (it2 != rVecOptions.end()) {
- const T1 *pOption = static_cast<T1 *>(*it2);
- vrwValue = pOption->GetValue();
- return MIstatus::success;
- }
-
- return MIstatus::failure;
-}
diff --git a/tools/lldb-mi/MICmdArgValNumber.cpp b/tools/lldb-mi/MICmdArgValNumber.cpp
deleted file mode 100644
index ad2df79bf3d9..000000000000
--- a/tools/lldb-mi/MICmdArgValNumber.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-//===-- MICmdArgValNumber.cpp -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValNumber.h"
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgValNumber constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValNumber::CMICmdArgValNumber()
- : m_nNumberFormatMask(CMICmdArgValNumber::eArgValNumberFormat_Decimal),
- m_nNumber(0) {}
-
-//++
-// Details: CMICmdArgValNumber constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false =
-// optional argument.
-// vbHandleByCmd - (R) True = Command processes *this option,
-// false = not handled.
-// vnNumberFormatMask - (R) Mask of the number formats. (Dflt =
-// CMICmdArgValNumber::eArgValNumberFormat_Decimal)
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValNumber::CMICmdArgValNumber(
- const CMIUtilString &vrArgName, const bool vbMandatory,
- const bool vbHandleByCmd,
- const MIuint
- vnNumberFormatMask /* = CMICmdArgValNumber::eArgValNumberFormat_Decimal*/)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd),
- m_nNumberFormatMask(vnNumberFormatMask), m_nNumber(0) {}
-
-//++
-// Details: CMICmdArgValNumber destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValNumber::~CMICmdArgValNumber() {}
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// value *this
-// argument is looking for.
-// Type: Overridden.
-// Args: vwArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValNumber::Validate(CMICmdArgContext &vwArgContext) {
- if (vwArgContext.IsEmpty())
- return m_bMandatory ? MIstatus::failure : MIstatus::success;
-
- if (vwArgContext.GetNumberArgsPresent() == 1) {
- const CMIUtilString &rArg(vwArgContext.GetArgsLeftToParse());
- if (IsArgNumber(rArg) && ExtractNumber(rArg)) {
- m_bFound = true;
- m_bValid = true;
- m_argValue = GetNumber();
- vwArgContext.RemoveArg(rArg);
- return MIstatus::success;
- } else
- return MIstatus::failure;
- }
-
- // More than one option...
- const CMIUtilString::VecString_t vecOptions(vwArgContext.GetArgs());
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- const CMIUtilString &rArg(*it);
- if (IsArgNumber(rArg) && ExtractNumber(rArg)) {
- m_bFound = true;
-
- if (vwArgContext.RemoveArg(rArg)) {
- m_bValid = true;
- m_argValue = GetNumber();
- return MIstatus::success;
- } else
- return MIstatus::failure;
- }
-
- // Next
- ++it;
- }
-
- return MIstatus::failure;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValNumber::IsArgNumber(const CMIUtilString &vrTxt) const {
- const bool bFormatDecimal(m_nNumberFormatMask &
- CMICmdArgValNumber::eArgValNumberFormat_Decimal);
- const bool bFormatHexadecimal(
- m_nNumberFormatMask &
- CMICmdArgValNumber::eArgValNumberFormat_Hexadecimal);
-
- // Look for --someLongOption
- if (std::string::npos != vrTxt.find("--"))
- return false;
-
- if (bFormatDecimal && vrTxt.IsNumber())
- return true;
-
- if (bFormatHexadecimal && vrTxt.IsHexadecimalNumber())
- return true;
-
- return false;
-}
-
-//++
-// Details: Extract the thread group number from the thread group argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValNumber::ExtractNumber(const CMIUtilString &vrTxt) {
- MIint64 nNumber = 0;
- bool bOk = vrTxt.ExtractNumber(nNumber);
- if (bOk) {
- m_nNumber = static_cast<MIint64>(nNumber);
- }
-
- return bOk;
-}
-
-//++
-// Details: Retrieve the thread group ID found in the argument.
-// Type: Method.
-// Args: None.
-// Return: MIuint - Thread group ID.
-// Throws: None.
-//--
-MIint64 CMICmdArgValNumber::GetNumber() const { return m_nNumber; }
diff --git a/tools/lldb-mi/MICmdArgValNumber.h b/tools/lldb-mi/MICmdArgValNumber.h
deleted file mode 100644
index 23c888e5d806..000000000000
--- a/tools/lldb-mi/MICmdArgValNumber.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//===-- MICmdArgValNumber.h -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmdArgValBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValBase class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument and so extract a value from it .
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValNumber : public CMICmdArgValBaseTemplate<MIint64> {
- // Enums:
-public:
- //++
- // Details: CMICmdArgValNumber needs to know what format of argument to look
- // for in
- // the command options text.
- //--
- enum ArgValNumberFormat_e {
- eArgValNumberFormat_Decimal = (1u << 0),
- eArgValNumberFormat_Hexadecimal = (1u << 1),
- eArgValNumberFormat_Auto =
- ((eArgValNumberFormat_Hexadecimal << 1) -
- 1u) ///< Indicates to try and lookup everything up during a query.
- };
-
- // Methods:
-public:
- /* ctor */ CMICmdArgValNumber();
- /* ctor */ CMICmdArgValNumber(
- const CMIUtilString &vrArgName, const bool vbMandatory,
- const bool vbHandleByCmd,
- const MIuint vnNumberFormatMask = eArgValNumberFormat_Decimal);
- //
- bool IsArgNumber(const CMIUtilString &vrTxt) const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValNumber() override;
- // From CMICmdArgSet::IArg
- bool Validate(CMICmdArgContext &vwArgContext) override;
-
- // Methods:
-private:
- bool ExtractNumber(const CMIUtilString &vrTxt);
- MIint64 GetNumber() const;
-
- // Attributes:
-private:
- MIuint m_nNumberFormatMask;
- MIint64 m_nNumber;
-};
diff --git a/tools/lldb-mi/MICmdArgValOptionLong.cpp b/tools/lldb-mi/MICmdArgValOptionLong.cpp
deleted file mode 100644
index 3dc9d40f4b56..000000000000
--- a/tools/lldb-mi/MICmdArgValOptionLong.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-//===-- MICmdArgValOptionLong.cpp -------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgValOptionLong constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValOptionLong::CMICmdArgValOptionLong()
- : m_nExpectingNOptions(0), m_eExpectingOptionType(eArgValType_invalid) {}
-
-//++
-// Details: CMICmdArgValOptionLong constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValOptionLong::CMICmdArgValOptionLong(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd)
- : CMICmdArgValListBase(vrArgName, vbMandatory, vbHandleByCmd),
- m_nExpectingNOptions(0), m_eExpectingOptionType(eArgValType_invalid) {}
-
-//++
-// Details: CMICmdArgValOptionLong constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false =
-// optional argument.
-// vbHandleByCmd - (R) True = Command processes *this option,
-// false = not handled.
-// veType - (R) The type of argument to look for and
-// create argument object of a certain type.
-// vnExpectingNOptions - (R) The number of options expected to read
-// following *this argument.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValOptionLong::CMICmdArgValOptionLong(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const ArgValType_e veType,
- const MIuint vnExpectingNOptions)
- : CMICmdArgValListBase(vrArgName, vbMandatory, vbHandleByCmd),
- m_nExpectingNOptions(vnExpectingNOptions),
- m_eExpectingOptionType(veType) {}
-
-//++
-// Details: CMICmdArgValOptionLong destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValOptionLong::~CMICmdArgValOptionLong() {
- // Tidy up
- Destroy();
-}
-
-//++
-// Details: Tear down resources used by *this object.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMICmdArgValOptionLong::Destroy() {
- // Tidy up
- VecArgObjPtr_t::const_iterator it = m_vecArgsExpected.begin();
- while (it != m_vecArgsExpected.end()) {
- CMICmdArgValBase *pOptionObj = *it;
- delete pOptionObj;
-
- // Next
- ++it;
- }
- m_vecArgsExpected.clear();
-}
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// long
-// argument *this argument type is looking for.
-// Type: Overridden.
-// Args: vwArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValOptionLong::Validate(CMICmdArgContext &vwArgContext) {
- if (vwArgContext.IsEmpty())
- return m_bMandatory ? MIstatus::failure : MIstatus::success;
-
- if (vwArgContext.GetNumberArgsPresent() == 1) {
- const CMIUtilString &rArg(vwArgContext.GetArgsLeftToParse());
- if (IsArgLongOption(rArg) && ArgNameMatch(rArg)) {
- m_bFound = true;
-
- if (!vwArgContext.RemoveArg(rArg))
- return MIstatus::failure;
-
- if (m_nExpectingNOptions == 0) {
- m_bValid = true;
- return MIstatus::success;
- }
-
- m_bIsMissingOptions = true;
- return MIstatus::failure;
- } else
- return MIstatus::failure;
- }
-
- // More than one option...
- MIuint nArgIndex = 0;
- const CMIUtilString::VecString_t vecOptions(vwArgContext.GetArgs());
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- const CMIUtilString &rArg(*it);
- if (IsArgOptionCorrect(rArg) && ArgNameMatch(rArg)) {
- m_bFound = true;
-
- if (!vwArgContext.RemoveArg(rArg))
- return MIstatus::failure;
-
- if (m_nExpectingNOptions != 0) {
- if (ExtractExpectedOptions(vwArgContext, nArgIndex)) {
- m_bValid = true;
- return MIstatus::success;
- }
-
- m_bIsMissingOptions = true;
- return MIstatus::failure;
- } else {
- m_bValid = true;
- return MIstatus::success;
- }
- }
-
- // Next
- ++it;
- ++nArgIndex;
- }
-
- return MIstatus::failure;
-}
-
-//++
-// Details: Parse the text following *this argument and extract the options the
-// values of
-// CMICmdArgValListBase::m_eArgType forming argument objects for each
-// of those
-// options extracted.
-// Type: Method.
-// Args: vrwTxt - (RW) The command's argument options string.
-// nArgIndex - (R) The Nth arg position in argument context from
-// the left.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValOptionLong::ExtractExpectedOptions(CMICmdArgContext &vrwTxt,
- const MIuint nArgIndex) {
- CMIUtilString::VecString_t vecOptions = vrwTxt.GetArgs();
- if (vecOptions.size() == 0)
- return MIstatus::failure;
-
- MIuint nArgIndexCnt = 0;
- MIuint nTypeCnt = 0;
- MIuint nTypeCnt2 = 0;
- MIuint nFoundNOptionsCnt = 0;
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- // Move to the Nth argument position from left before do validation/checking
- if (nArgIndexCnt++ == nArgIndex) {
- nTypeCnt++;
- const CMIUtilString &rOption(*it);
- if (IsExpectedCorrectType(rOption, m_eExpectingOptionType)) {
- nTypeCnt2++;
- CMICmdArgValBase *pOptionObj =
- CreationObj(rOption, m_eExpectingOptionType);
- if ((pOptionObj != nullptr) &&
- vrwTxt.RemoveArgAtPos(rOption, nArgIndex)) {
- nFoundNOptionsCnt++;
- m_vecArgsExpected.push_back(pOptionObj);
- }
- }
-
- // Is the sequence 'options' of same type broken. Expecting the same type
- // until the
- // next argument.
- if (nTypeCnt != nTypeCnt2)
- return MIstatus::failure;
-
- if (nFoundNOptionsCnt == m_nExpectingNOptions)
- return MIstatus::success;
- }
-
- // Next
- ++it;
- }
- if (nFoundNOptionsCnt != m_nExpectingNOptions)
- return MIstatus::failure;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid long type option
-// argument.
-// Long type argument looks like --someLongOption.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValOptionLong::IsArgLongOption(const CMIUtilString &vrTxt) const {
- const bool bHavePosSlash = (vrTxt.find('/') != std::string::npos);
- const bool bHaveBckSlash = (vrTxt.find('\\') != std::string::npos);
- if (bHavePosSlash || bHaveBckSlash)
- return false;
-
- const size_t nPos = vrTxt.find("--");
- if (nPos != 0)
- return false;
-
- if (vrTxt.length() < 3)
- return false;
-
- const CMIUtilString strArg = vrTxt.substr(2);
- return !strArg.IsNumber();
-}
-
-//++
-// Details: Examine the string and determine if it is a valid long type option
-// argument.
-// Long type argument looks like --someLongOption.
-// Type: Overideable.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValOptionLong::IsArgOptionCorrect(
- const CMIUtilString &vrTxt) const {
- return IsArgLongOption(vrTxt);
-}
-
-//++
-// Details: Does the argument name of the argument being parsed ATM match the
-// name of
-// *this argument object.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes arg name matched, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValOptionLong::ArgNameMatch(const CMIUtilString &vrTxt) const {
- const CMIUtilString strArg = vrTxt.substr(2);
- return (strArg == GetName());
-}
-
-//++
-// Details: Retrieve the list of CMICmdArgValBase derived option objects found
-// following
-// *this long option argument. For example "list-thread-groups [
-// --recurse 1 ]"
-// where 1 is the list of expected option to follow.
-// Type: Method.
-// Args: None.
-// Return: CMICmdArgValListBase::VecArgObjPtr_t & - List of options.
-// Throws: None.
-//--
-const CMICmdArgValListBase::VecArgObjPtr_t &
-CMICmdArgValOptionLong::GetExpectedOptions() const {
- return m_vecArgsExpected;
-}
diff --git a/tools/lldb-mi/MICmdArgValOptionLong.h b/tools/lldb-mi/MICmdArgValOptionLong.h
deleted file mode 100644
index 240829733680..000000000000
--- a/tools/lldb-mi/MICmdArgValOptionLong.h
+++ /dev/null
@@ -1,104 +0,0 @@
-//===-- MICmdArgValOptionLong.h ---------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmdArgValListBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-class CMIUtilString;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValBase class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument and so extract a value from it.
-// If *this argument has expected options following it the option
-// objects
-// created to hold each of those option's values belong to *this
-// argument
-// object and so are deleted when *this object goes out of scope.
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValOptionLong : public CMICmdArgValListBase {
- // Methods:
-public:
- /* ctor */ CMICmdArgValOptionLong();
- /* ctor */ CMICmdArgValOptionLong(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd);
- /* ctor */ CMICmdArgValOptionLong(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const ArgValType_e veType,
- const MIuint vnExpectingNOptions);
- //
- bool IsArgLongOption(const CMIUtilString &vrTxt) const;
- const VecArgObjPtr_t &GetExpectedOptions() const;
- template <class T1, typename T2> bool GetExpectedOption(T2 &vrwValue) const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValOptionLong() override;
- // From CMICmdArgSet::IArg
- bool Validate(CMICmdArgContext &vArgContext) override;
-
- // Methods:
-protected:
- bool ExtractExpectedOptions(CMICmdArgContext &vrwTxt, const MIuint nArgIndex);
-
- // Overrideable:
-protected:
- virtual bool IsArgOptionCorrect(const CMIUtilString &vrTxt) const;
- virtual bool ArgNameMatch(const CMIUtilString &vrTxt) const;
-
- // Methods:
-private:
- void Destroy();
-
- // Attributes:
-private:
- MIuint m_nExpectingNOptions; // The number of options expected to read
- // following *this argument
- VecArgObjPtr_t m_vecArgsExpected; // The option objects holding the value
- // extracted following *this argument
- ArgValType_e m_eExpectingOptionType; // The type of options expected to read
- // following *this argument
-};
-
-//++
-// Details: Retrieve the first argument or option value from the list of 1 or
-// more options
-// parsed from the command's options string.
-// Type: Template method.
-// Args: vrwValue - (W) Templated type return value.
-// T1 - The argument value's class type of the data hold in
-// the list of options.
-// T2 - The type pf the variable which holds the value wanted.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed. List of object was empty.
-// Throws: None.
-//--
-template <class T1, typename T2>
-bool CMICmdArgValOptionLong::GetExpectedOption(T2 &vrwValue) const {
- const VecArgObjPtr_t &rVecOptions(GetExpectedOptions());
- VecArgObjPtr_t::const_iterator it2 = rVecOptions.begin();
- if (it2 != rVecOptions.end()) {
- const T1 *pOption = static_cast<T1 *>(*it2);
- vrwValue = pOption->GetValue();
- return MIstatus::success;
- }
-
- return MIstatus::failure;
-}
diff --git a/tools/lldb-mi/MICmdArgValOptionShort.cpp b/tools/lldb-mi/MICmdArgValOptionShort.cpp
deleted file mode 100644
index 7b7116cd5f18..000000000000
--- a/tools/lldb-mi/MICmdArgValOptionShort.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-//===-- MICmdArgValOptionShort.cpp ------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgValOptionShort constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValOptionShort::CMICmdArgValOptionShort() {}
-
-//++
-// Details: CMICmdArgValOptionShort constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValOptionShort::CMICmdArgValOptionShort(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd)
- : CMICmdArgValOptionLong(vrArgName, vbMandatory, vbHandleByCmd) {}
-
-//++
-// Details: CMICmdArgValOptionLong constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false =
-// optional argument.
-// vbHandleByCmd - (R) True = Command processes *this option,
-// false = not handled.
-// veType - (R) The type of argument to look for and
-// create argument object of a certain type.
-// vnExpectingNOptions - (R) The number of options expected to read
-// following *this argument.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValOptionShort::CMICmdArgValOptionShort(
- const CMIUtilString &vrArgName, const bool vbMandatory,
- const bool vbHandleByCmd, const ArgValType_e veType,
- const MIuint vnExpectingNOptions)
- : CMICmdArgValOptionLong(vrArgName, vbMandatory, vbHandleByCmd, veType,
- vnExpectingNOptions) {}
-
-//++
-// Details: CMICmdArgValOptionShort destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValOptionShort::~CMICmdArgValOptionShort() {}
-
-//++
-// Details: Examine the string and determine if it is a valid short type option
-// argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValOptionShort::IsArgShortOption(
- const CMIUtilString &vrTxt) const {
- // Look for --someLongOption
- MIint nPos = vrTxt.find("--");
- if (nPos == 0)
- return false;
-
- // Look for -f short option
- nPos = vrTxt.find('-');
- if (nPos != 0)
- return false;
-
- if (vrTxt.length() > 2)
- return false;
-
- return true;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid short type option
-// argument.
-// Long type argument looks like -f some short option.
-// Type: Overridden.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValOptionShort::IsArgOptionCorrect(
- const CMIUtilString &vrTxt) const {
- return IsArgShortOption(vrTxt);
-}
-
-//++
-// Details: Does the argument name of the argument being parsed ATM match the
-// name of
-// *this argument object.
-// Type: Overridden.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes arg name matched, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValOptionShort::ArgNameMatch(const CMIUtilString &vrTxt) const {
- const CMIUtilString strArg = vrTxt.substr(1);
- return (strArg == GetName());
-}
diff --git a/tools/lldb-mi/MICmdArgValOptionShort.h b/tools/lldb-mi/MICmdArgValOptionShort.h
deleted file mode 100644
index fd39c9e73a57..000000000000
--- a/tools/lldb-mi/MICmdArgValOptionShort.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//===-- MICmdArgValOptionShort.h --------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmdArgValOptionLong.h"
-
-// Declarations:
-class CMICmdArgContext;
-class CMIUtilString;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValOptionLong
-// class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument and so extract a value from it.
-// If *this argument has expected options following it the option
-// objects
-// created to hold each of those option's values belong to *this
-// argument
-// object and so are deleted when *this object goes out of scope.
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValOptionShort : public CMICmdArgValOptionLong {
- // Methods:
-public:
- /* ctor */ CMICmdArgValOptionShort();
- /* ctor */ CMICmdArgValOptionShort(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd);
- /* ctor */ CMICmdArgValOptionShort(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const ArgValType_e veType,
- const MIuint vnExpectingNOptions);
- //
- bool IsArgShortOption(const CMIUtilString &vrTxt) const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValOptionShort() override;
-
- // Overridden:
-private:
- // From CMICmdArgValOptionLong
- bool IsArgOptionCorrect(const CMIUtilString &vrTxt) const override;
- bool ArgNameMatch(const CMIUtilString &vrTxt) const override;
-};
diff --git a/tools/lldb-mi/MICmdArgValPrintValues.cpp b/tools/lldb-mi/MICmdArgValPrintValues.cpp
deleted file mode 100644
index a2ce45247375..000000000000
--- a/tools/lldb-mi/MICmdArgValPrintValues.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-//===-- MICmdArgValPrintValues.cpp ------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValPrintValues.h"
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgValPrintValues constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValPrintValues::CMICmdArgValPrintValues() : m_nPrintValues(0) {}
-
-//++
-// Details: CMICmdArgValPrintValues constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValPrintValues::CMICmdArgValPrintValues(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd),
- m_nPrintValues(0) {}
-
-//++
-// Details: CMICmdArgValPrintValues destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValPrintValues::~CMICmdArgValPrintValues() {}
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// value *this
-// argument is looking for.
-// Type: Overridden.
-// Args: vwArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValPrintValues::Validate(CMICmdArgContext &vwArgContext) {
- if (vwArgContext.IsEmpty())
- return m_bMandatory ? MIstatus::failure : MIstatus::success;
-
- const CMIUtilString strArg(vwArgContext.GetArgs()[0]);
- if (IsArgPrintValues(strArg) && ExtractPrintValues(strArg)) {
- m_bFound = true;
- m_bValid = true;
- m_argValue = GetPrintValues();
- vwArgContext.RemoveArg(strArg);
- return MIstatus::success;
- }
-
- return MIstatus::failure;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValPrintValues::IsArgPrintValues(
- const CMIUtilString &vrTxt) const {
- return (CMIUtilString::Compare(vrTxt, "0") ||
- CMIUtilString::Compare(vrTxt, "--no-values") ||
- CMIUtilString::Compare(vrTxt, "1") ||
- CMIUtilString::Compare(vrTxt, "--all-values") ||
- CMIUtilString::Compare(vrTxt, "2") ||
- CMIUtilString::Compare(vrTxt, "--simple-values"));
-}
-
-//++
-// Details: Extract the print-values from the print-values argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValPrintValues::ExtractPrintValues(const CMIUtilString &vrTxt) {
- if (CMIUtilString::Compare(vrTxt, "0") ||
- CMIUtilString::Compare(vrTxt, "--no-values"))
- m_nPrintValues = 0;
- else if (CMIUtilString::Compare(vrTxt, "1") ||
- CMIUtilString::Compare(vrTxt, "--all-values"))
- m_nPrintValues = 1;
- else if (CMIUtilString::Compare(vrTxt, "2") ||
- CMIUtilString::Compare(vrTxt, "--simple-values"))
- m_nPrintValues = 2;
- else
- return MIstatus::failure;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Retrieve the print-values found in the argument.
-// Type: Method.
-// Args: None.
-// Return: MIuint - The print-values.
-// Throws: None.
-//--
-MIuint CMICmdArgValPrintValues::GetPrintValues() const {
- return m_nPrintValues;
-}
diff --git a/tools/lldb-mi/MICmdArgValPrintValues.h b/tools/lldb-mi/MICmdArgValPrintValues.h
deleted file mode 100644
index 3fa8142c1ae5..000000000000
--- a/tools/lldb-mi/MICmdArgValPrintValues.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//===-- MICmdArgValPrintValues.h --------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmdArgValBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValBase class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument and so extract a value from it. The print-values looks
-// like:
-// 0 or --no-values
-// 1 or --all-values
-// 2 or --simple-values
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValPrintValues : public CMICmdArgValBaseTemplate<MIuint> {
- // Methods:
-public:
- /* ctor */ CMICmdArgValPrintValues();
- /* ctor */ CMICmdArgValPrintValues(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd);
- //
- bool IsArgPrintValues(const CMIUtilString &vrTxt) const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValPrintValues() override;
- // From CMICmdArgSet::IArg
- bool Validate(CMICmdArgContext &vArgContext) override;
-
- // Methods:
-private:
- bool ExtractPrintValues(const CMIUtilString &vrTxt);
- MIuint GetPrintValues() const;
-
- // Attributes:
-private:
- MIuint m_nPrintValues;
-};
diff --git a/tools/lldb-mi/MICmdArgValString.cpp b/tools/lldb-mi/MICmdArgValString.cpp
deleted file mode 100644
index bd105bc289b3..000000000000
--- a/tools/lldb-mi/MICmdArgValString.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-//===-- MICmdArgValString.cpp -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValString.h"
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgValString constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValString::CMICmdArgValString()
- : m_bHandleQuotedString(false), m_bAcceptNumbers(false),
- m_bHandleDirPaths(false), m_bHandleAnything(false) {}
-
-//++
-// Details: CMICmdArgValString constructor.
-// Type: Method.
-// Args: vbAnything - (R) True = Parse a string and accept anything, false =
-// do not accept anything.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValString::CMICmdArgValString(const bool vbAnything)
- : m_bHandleQuotedString(vbAnything), m_bAcceptNumbers(false),
- m_bHandleDirPaths(false), m_bHandleAnything(vbAnything) {}
-
-//++
-// Details: CMICmdArgValString constructor.
-// Type: Method.
-// Args: vbHandleQuotes - (R) True = Parse a string surrounded by quotes
-// spaces are not delimiters, false = only text up to
-// next delimiting space character.
-// vbAcceptNumbers - (R) True = Parse a string and accept as a
-// number if number, false = numbers not recognised
-// as string types.
-// vbHandleDirPaths - (R) True = Parse a string and accept as a file
-// path if a path, false = file paths are not
-// recognised as string types.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValString::CMICmdArgValString(const bool vbHandleQuotes,
- const bool vbAcceptNumbers,
- const bool vbHandleDirPaths)
- : m_bHandleQuotedString(vbHandleQuotes), m_bAcceptNumbers(vbAcceptNumbers),
- m_bHandleDirPaths(vbHandleDirPaths), m_bHandleAnything(false) {}
-
-//++
-// Details: CMICmdArgValString constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// vbHandleQuotes - (R) True = Parse a string surrounded by quotes
-// spaces are not delimiters, false = only text up to
-// next delimiting space character. (Dflt = false)
-// vbAcceptNumbers - (R) True = Parse a string and accept as a number
-// if number, false = numbers not recognised as
-// string types. (Dflt = false)
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValString::CMICmdArgValString(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const bool vbHandleQuotes /* = false */,
- const bool vbAcceptNumbers /* = false */)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd),
- m_bHandleQuotedString(vbHandleQuotes), m_bAcceptNumbers(vbAcceptNumbers),
- m_bHandleDirPaths(false), m_bHandleAnything(false) {}
-
-//++
-// Details: CMICmdArgValString constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// vbHandleQuotes - (R) True = Parse a string surrounded by quotes
-// spaces are not delimiters, false = only text up to
-// next delimiting space character.
-// vbAcceptNumbers - (R) True = Parse a string and accept as a number
-// if number, false = numbers not recognised as
-// vbHandleDirPaths - (R) True = Parse a string and accept as a file
-// path if a path, false = file paths are not
-// string types.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValString::CMICmdArgValString(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const bool vbHandleQuotes,
- const bool vbAcceptNumbers,
- const bool vbHandleDirPaths)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd),
- m_bHandleQuotedString(vbHandleQuotes), m_bAcceptNumbers(vbAcceptNumbers),
- m_bHandleDirPaths(vbHandleDirPaths), m_bHandleAnything(false) {}
-
-//++
-// Details: CMICmdArgValString destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValString::~CMICmdArgValString() {}
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// value *this
-// argument is looking for.
-// Type: Overridden.
-// Args: vrwArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValString::Validate(CMICmdArgContext &vrwArgContext) {
- if (vrwArgContext.IsEmpty())
- return m_bMandatory ? MIstatus::failure : MIstatus::success;
-
- if (m_bHandleQuotedString)
- return ValidateQuotedText(vrwArgContext);
-
- return ValidateSingleText(vrwArgContext);
-}
-
-//++
-// Details: Parse the command's argument options string and try to extract only
-// the next
-// word delimited by the next space.
-// Type: Method.
-// Args: vrwArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValString::ValidateSingleText(CMICmdArgContext &vrwArgContext) {
- const CMIUtilString::VecString_t vecOptions(vrwArgContext.GetArgs());
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- const CMIUtilString &rArg(*it);
- if (IsStringArg(rArg)) {
- m_bFound = true;
-
- if (vrwArgContext.RemoveArg(rArg)) {
- m_bValid = true;
- m_argValue = rArg.StripSlashes();
- return MIstatus::success;
- } else
- return MIstatus::failure;
- }
-
- // Next
- ++it;
- }
-
- return MIstatus::failure;
-}
-
-//++
-// Details: Parse the command's argument options string and try to extract all
-// the words
-// between quotes then delimited by the next space.
-// Type: Method.
-// Args: vrwArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValString::ValidateQuotedText(CMICmdArgContext &vrwArgContext) {
- const CMIUtilString::VecString_t vecOptions(vrwArgContext.GetArgs());
- if (vecOptions.size() == 0)
- return MIstatus::failure;
-
- const CMIUtilString &rArg(vecOptions[0]);
- if (!IsStringArg(rArg))
- return MIstatus::failure;
-
- m_bFound = true;
-
- if (vrwArgContext.RemoveArg(rArg)) {
- m_bValid = true;
- const char cQuote = '"';
- m_argValue = rArg.Trim(cQuote).StripSlashes();
- return MIstatus::success;
- }
-
- return MIstatus::failure;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValString::IsStringArg(const CMIUtilString &vrTxt) const {
- if (m_bHandleQuotedString)
- return (IsStringArgQuotedText(vrTxt) ||
- IsStringArgQuotedTextEmbedded(vrTxt) ||
- IsStringArgQuotedQuotedTextEmbedded(vrTxt) ||
- IsStringArgSingleText(
- vrTxt)); // Still test for this as could just be one word still
-
- return IsStringArgSingleText(vrTxt);
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument or
-// option value. If the string looks like a long option, short option,
-// a thread
-// group ID or just a number it is rejected as a string type value.
-// There is an
-// option to allow the string to accept a number as a string type.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid argument value, false = something else.
-// Throws: None.
-//--
-bool CMICmdArgValString::IsStringArgSingleText(
- const CMIUtilString &vrTxt) const {
- if (!m_bHandleDirPaths) {
- // Look for directory file paths, if found reject
- const bool bHavePosSlash = (vrTxt.find('/') != std::string::npos);
- const bool bHaveBckSlash = (vrTxt.find('\\') != std::string::npos);
- if (bHavePosSlash || bHaveBckSlash)
- return false;
- }
-
- // Look for --someLongOption, if found reject
- if (0 == vrTxt.find("--"))
- return false;
-
- // Look for -f type short options, if found reject
- if ((0 == vrTxt.find('-')) && (vrTxt.length() == 2))
- return false;
-
- // Look for thread group i1 i2 i3...., if found reject
- if ((vrTxt.find('i') == 0) && ::isdigit(vrTxt[1]))
- return false;
-
- // Look for numbers, if found reject
- if (!m_bAcceptNumbers && vrTxt.IsNumber())
- return false;
-
- return true;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument.
-// Take into account quotes surrounding the text. Note this function
-// falls
-// through to IsStringArgSingleText() should the criteria match fail.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValString::IsStringArgQuotedText(
- const CMIUtilString &vrTxt) const {
- // Accept anything as string word
- if (m_bHandleAnything)
- return true;
-
- // CODETAG_QUOTEDTEXT_SIMILAR_CODE
- const char cQuote = '"';
- const size_t nPos = vrTxt.find(cQuote);
- if (nPos == std::string::npos)
- return false;
-
- // Is one and only quote at end of the string
- if (nPos == (vrTxt.length() - 1))
- return false;
-
- // Quote must be the first character in the string or be preceded by a space
- // Also check for embedded string formating quote
- const char cBckSlash = '\\';
- const char cSpace = ' ';
- if ((nPos > 1) && (vrTxt[nPos - 1] == cBckSlash) &&
- (vrTxt[nPos - 2] != cSpace)) {
- return false;
- }
- if ((nPos > 0) && (vrTxt[nPos - 1] != cSpace))
- return false;
-
- // Need to find the other quote
- const size_t nPos2 = vrTxt.rfind(cQuote);
- if (nPos2 == std::string::npos)
- return false;
-
- // Make sure not same quote, need two quotes
- if (nPos == nPos2)
- return MIstatus::failure;
-
- return true;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument.
-// Take into account quotes surrounding the text. Take into account
-// string format
-// embedded quotes surrounding the text i.e. "\\\"%5d\\\"". Note this
-// function falls
-// through to IsStringArgQuotedText() should the criteria match fail.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValString::IsStringArgQuotedTextEmbedded(
- const CMIUtilString &vrTxt) const {
- // CODETAG_QUOTEDTEXT_SIMILAR_CODE
- const char cBckSlash = '\\';
- const size_t nPos = vrTxt.find(cBckSlash);
- if (nPos == std::string::npos)
- return false;
-
- // Slash must be the first character in the string or be preceded by a space
- const char cSpace = ' ';
- if ((nPos > 0) && (vrTxt[nPos - 1] != cSpace))
- return false;
-
- // Need to find the other matching slash
- const size_t nPos2 = vrTxt.rfind(cBckSlash);
- if (nPos2 == std::string::npos)
- return false;
-
- // Make sure not same back slash, need two slashes
- if (nPos == nPos2)
- return MIstatus::failure;
-
- return false;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument.
-// Take into account quotes surrounding the text. Take into account
-// string format
-// embedded quotes surrounding the text i.e. "\\\"%5d\\\"". Note this
-// function falls
-// through to IsStringArgQuotedTextEmbedded() should the criteria match
-// fail.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValString::IsStringArgQuotedQuotedTextEmbedded(
- const CMIUtilString &vrTxt) const {
- const size_t nPos = vrTxt.find("\"\\\"");
- if (nPos == std::string::npos)
- return false;
-
- const size_t nPos2 = vrTxt.rfind("\\\"\"");
- if (nPos2 == std::string::npos)
- return false;
-
- const size_t nLen = vrTxt.length();
- return !((nLen > 5) && ((nPos + 2) == (nPos2 - 2)));
-}
diff --git a/tools/lldb-mi/MICmdArgValString.h b/tools/lldb-mi/MICmdArgValString.h
deleted file mode 100644
index 77041c2d0c9f..000000000000
--- a/tools/lldb-mi/MICmdArgValString.h
+++ /dev/null
@@ -1,82 +0,0 @@
-//===-- MICmdArgValString.h -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmdArgValBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValBase class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument and so extract a value from it .
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValString : public CMICmdArgValBaseTemplate<CMIUtilString> {
- // Methods:
-public:
- /* ctor */ CMICmdArgValString();
- /* ctor */ CMICmdArgValString(const bool vbAnything);
- /* ctor */ CMICmdArgValString(const bool vbHandleQuotes,
- const bool vbAcceptNumbers,
- const bool vbHandleDirPaths);
- /* ctor */ CMICmdArgValString(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const bool vbHandleQuotes = false,
- const bool vbAcceptNumbers = false);
- /* ctor */ CMICmdArgValString(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd,
- const bool vbHandleQuotes,
- const bool vbAcceptNumbers,
- const bool vbHandleDirPaths);
- //
- bool IsStringArg(const CMIUtilString &vrTxt) const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValString() override;
- // From CMICmdArgSet::IArg
- bool Validate(CMICmdArgContext &vrwArgContext) override;
-
- // Methods:
-private:
- bool ValidateSingleText(CMICmdArgContext &vrwArgContext);
- bool ValidateQuotedText(CMICmdArgContext &vrwArgContext);
- bool ValidateQuotedTextEmbedded(CMICmdArgContext &vrwArgContext);
- bool ValidateQuotedQuotedTextEmbedded(CMICmdArgContext &vrwArgContext);
- bool IsStringArgSingleText(const CMIUtilString &vrTxt) const;
- bool IsStringArgQuotedText(const CMIUtilString &vrTxt) const;
- bool IsStringArgQuotedTextEmbedded(const CMIUtilString &vrTxt) const;
- bool IsStringArgQuotedQuotedTextEmbedded(const CMIUtilString &vrTxt) const;
-
- // Attribute:
-private:
- bool m_bHandleQuotedString; // True = Parse a string surrounded by quotes
- // spaces are not delimiters, false = only text up
- // to next
- // delimiting space character
- bool m_bAcceptNumbers; // True = Parse a string and accept as a number if
- // number, false = numbers not recognised as string
- // types
- bool m_bHandleDirPaths; // True = Parse a string and accept directory file
- // style string if present, false = directory file
- // path not
- // accepted
- bool m_bHandleAnything; // True = Parse a string and accept anything if
- // present, false = validate for criteria matches
-};
diff --git a/tools/lldb-mi/MICmdArgValThreadGrp.cpp b/tools/lldb-mi/MICmdArgValThreadGrp.cpp
deleted file mode 100644
index 201d516525fd..000000000000
--- a/tools/lldb-mi/MICmdArgValThreadGrp.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-//===-- MICmdArgValThreadGrp.cpp --------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdArgValThreadGrp.h"
-#include "MICmdArgContext.h"
-
-//++
-// Details: CMICmdArgValThreadGrp constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValThreadGrp::CMICmdArgValThreadGrp() : m_nThreadGrp(0) {}
-
-//++
-// Details: CMICmdArgValThreadGrp constructor.
-// Type: Method.
-// Args: vrArgName - (R) Argument's name to search by.
-// vbMandatory - (R) True = Yes must be present, false = optional
-// argument.
-// vbHandleByCmd - (R) True = Command processes *this option, false =
-// not handled.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValThreadGrp::CMICmdArgValThreadGrp(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd)
- : CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd),
- m_nThreadGrp(0) {}
-
-//++
-// Details: CMICmdArgValThreadGrp destructor.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdArgValThreadGrp::~CMICmdArgValThreadGrp() {}
-
-//++
-// Details: Parse the command's argument options string and try to extract the
-// value *this
-// argument is looking for.
-// Type: Overridden.
-// Args: vwArgContext - (RW) The command's argument options string.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValThreadGrp::Validate(CMICmdArgContext &vwArgContext) {
- if (vwArgContext.IsEmpty())
- return m_bMandatory ? MIstatus::failure : MIstatus::success;
-
- if (vwArgContext.GetNumberArgsPresent() == 1) {
- const CMIUtilString &rArg(vwArgContext.GetArgsLeftToParse());
- if (IsArgThreadGrp(rArg) && ExtractNumber(rArg)) {
- m_bFound = true;
- m_bValid = true;
- m_argValue = GetNumber();
- vwArgContext.RemoveArg(rArg);
- return MIstatus::success;
- } else
- return MIstatus::failure;
- }
-
- // More than one option...
- const CMIUtilString::VecString_t vecOptions(vwArgContext.GetArgs());
- CMIUtilString::VecString_t::const_iterator it = vecOptions.begin();
- while (it != vecOptions.end()) {
- const CMIUtilString &rArg(*it);
- if (IsArgThreadGrp(rArg) && ExtractNumber(rArg)) {
- m_bFound = true;
-
- if (vwArgContext.RemoveArg(rArg)) {
- m_bValid = true;
- m_argValue = GetNumber();
- return MIstatus::success;
- } else
- return MIstatus::failure;
- }
-
- // Next
- ++it;
- }
-
- return MIstatus::failure;
-}
-
-//++
-// Details: Examine the string and determine if it is a valid string type
-// argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: bool - True = yes valid arg, false = no.
-// Throws: None.
-//--
-bool CMICmdArgValThreadGrp::IsArgThreadGrp(const CMIUtilString &vrTxt) const {
- // Look for i1 i2 i3....
- const MIint nPos = vrTxt.find('i');
- if (nPos != 0)
- return false;
-
- const CMIUtilString strNum = vrTxt.substr(1);
- return strNum.IsNumber();
-}
-
-//++
-// Details: Extract the thread group number from the thread group argument.
-// Type: Method.
-// Args: vrTxt - (R) Some text.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdArgValThreadGrp::ExtractNumber(const CMIUtilString &vrTxt) {
- const CMIUtilString strNum = vrTxt.substr(1);
- MIint64 nNumber = 0;
- bool bOk = strNum.ExtractNumber(nNumber);
- if (bOk) {
- m_nThreadGrp = static_cast<MIuint>(nNumber);
- }
-
- return bOk;
-}
-
-//++
-// Details: Retrieve the thread group ID found in the argument.
-// Type: Method.
-// Args: None.
-// Return: MIuint - Thread group ID.
-// Throws: None.
-//--
-MIuint CMICmdArgValThreadGrp::GetNumber() const { return m_nThreadGrp; }
diff --git a/tools/lldb-mi/MICmdArgValThreadGrp.h b/tools/lldb-mi/MICmdArgValThreadGrp.h
deleted file mode 100644
index 12d3a1e90244..000000000000
--- a/tools/lldb-mi/MICmdArgValThreadGrp.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//===-- MICmdArgValThreadGrp.h ----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-// In-house headers:
-#include "MICmdArgValBase.h"
-
-// Declarations:
-class CMICmdArgContext;
-
-//++
-//============================================================================
-// Details: MI common code class. Command argument class. Arguments object
-// needing specialization derived from the CMICmdArgValBase class.
-// An argument knows what type of argument it is and how it is to
-// interpret the options (context) string to find and validate a
-// matching
-// argument and so extract a value from it. Thread group looks like
-// "i1" in the options text.
-// Based on the Interpreter pattern.
-//--
-class CMICmdArgValThreadGrp : public CMICmdArgValBaseTemplate<MIuint> {
- // Methods:
-public:
- /* ctor */ CMICmdArgValThreadGrp();
- /* ctor */ CMICmdArgValThreadGrp(const CMIUtilString &vrArgName,
- const bool vbMandatory,
- const bool vbHandleByCmd);
- //
- bool IsArgThreadGrp(const CMIUtilString &vrTxt) const;
-
- // Overridden:
-public:
- // From CMICmdArgValBase
- /* dtor */ ~CMICmdArgValThreadGrp() override;
- // From CMICmdArgSet::IArg
- bool Validate(CMICmdArgContext &vArgContext) override;
-
- // Methods:
-private:
- bool ExtractNumber(const CMIUtilString &vrTxt);
- MIuint GetNumber() const;
-
- // Attributes:
-private:
- MIuint m_nThreadGrp;
-};
diff --git a/tools/lldb-mi/MICmdBase.cpp b/tools/lldb-mi/MICmdBase.cpp
deleted file mode 100644
index df36cfe86420..000000000000
--- a/tools/lldb-mi/MICmdBase.cpp
+++ /dev/null
@@ -1,329 +0,0 @@
-//===-- MICmdBase.cpp -------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmdArgValConsume.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnMIValueConst.h"
-
-//++
-// Details: CMICmdBase constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdBase::CMICmdBase()
- : m_pSelfCreatorFn(nullptr),
- m_rLLDBDebugSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()),
- m_bHasResultRecordExtra(false), m_constStrArgThreadGroup("thread-group"),
- m_constStrArgThread("thread"), m_constStrArgFrame("frame"),
- m_constStrArgConsume("--"), m_ThreadGrpArgMandatory(false),
- m_ThreadArgMandatory(false), m_FrameArgMandatory(false) {}
-
-//++
-// Details: CMICmdBase destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdBase::~CMICmdBase() {}
-
-//++
-// Details: The invoker requires this function.
-// Type: Overridden.
-// Args: None.
-// Return: SMICmdData & - *this command's present status/data/information.
-// Throws: None.
-//--
-const SMICmdData &CMICmdBase::GetCmdData() const { return m_cmdData; }
-
-//++
-// Details: The invoker requires this function.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString & - *this command's current error description.
-// Empty string indicates command status ok.
-// Throws: None.
-//--
-const CMIUtilString &CMICmdBase::GetErrorDescription() const {
- return m_strCurrentErrDescription;
-}
-
-//++
-// Details: The CMICmdFactory requires this function. Retrieve the command and
-// argument
-// options description string.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString & - Command description.
-// Throws: None.
-//--
-const CMIUtilString &CMICmdBase::GetMiCmd() const { return m_strMiCmd; }
-
-//++
-// Details: Help parse the arguments that are common to all commands.
-// Args: None.
-// Return: None
-// Throws: None.
-//--
-void CMICmdBase::AddCommonArgs() {
- m_setCmdArgs.Add(new CMICmdArgValOptionLong(
- m_constStrArgThreadGroup, m_ThreadGrpArgMandatory, true,
- CMICmdArgValListBase::eArgValType_ThreadGrp, 1));
- m_setCmdArgs.Add(new CMICmdArgValOptionLong(
- m_constStrArgThread, m_ThreadArgMandatory, true,
- CMICmdArgValListBase::eArgValType_Number, 1));
- m_setCmdArgs.Add(
- new CMICmdArgValOptionLong(m_constStrArgFrame, m_FrameArgMandatory, true,
- CMICmdArgValListBase::eArgValType_Number, 1));
- m_setCmdArgs.Add(new CMICmdArgValConsume(m_constStrArgConsume, false));
-}
-
-//++
-// Details: The invoker requires this function. A command must be given working
-// data and
-// provide data about its status or provide information to other
-// objects.
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMICmdBase::SetCmdData(const SMICmdData &vCmdData) {
- m_cmdData = vCmdData;
-}
-
-//++
-// Details: The command factory requires this function. The factory calls this
-// function
-// so it can obtain *this command's creation function.
-// Type: Overridden.
-// Args: None.
-// Return: CMICmdFactory::CmdCreatorFnPtr - Function pointer.
-// Throws: None.
-//--
-CMICmdFactory::CmdCreatorFnPtr CMICmdBase::GetCmdCreatorFn() const {
- return m_pSelfCreatorFn;
-}
-
-//++
-// Details: If a command is an event type (has callbacks registered with
-// SBListener) it
-// needs to inform the Invoker that it has finished its work so that
-// the
-// Invoker can tidy up and call the commands Acknowledge function (yes
-// the
-// command itself could call the Acknowledge itself but not doing that
-// way).
-// Type: Overridden.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-void CMICmdBase::CmdFinishedTellInvoker() const {
- CMICmdInvoker::Instance().CmdExecuteFinished(const_cast<CMICmdBase &>(*this));
-}
-
-//++
-// Details: Returns the final version of the MI result record built up in the
-// command's
-// Acknowledge function. The one line text of MI result.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString & - MI text version of the MI result record.
-// Throws: None.
-//--
-const CMIUtilString &CMICmdBase::GetMIResultRecord() const {
- return m_miResultRecord.GetString();
-}
-
-//++
-// Details: Retrieve from the command additional MI result to its 1 line
-// response.
-// Because of using LLDB additional 'fake'/hack output is sometimes
-// required to
-// help the driver client operate i.e. Eclipse.
-// Type: Overridden.
-// Args: None.
-// Return: CMIUtilString & - MI text version of the MI result record.
-// Throws: None.
-//--
-const CMIUtilString &CMICmdBase::GetMIResultRecordExtra() const {
- return m_miResultRecordExtra;
-}
-
-//++
-// Details: Hss *this command got additional MI result to its 1 line response.
-// Because of using LLDB additional 'fake'/hack output is sometimes
-// required to
-// help the driver client operate i.e. Eclipse.
-// Type: Overridden.
-// Args: None.
-// Return: bool - True = Yes have additional MI output, false = no nothing
-// extra.
-// Throws: None.
-//--
-bool CMICmdBase::HasMIResultRecordExtra() const {
- return m_bHasResultRecordExtra;
-}
-
-//++
-// Details: Short cut function to enter error information into the command's
-// metadata
-// object and set the command's error status.
-// Type: Method.
-// Args: rErrMsg - (R) Status description.
-// Return: None.
-// Throws: None.
-//--
-void CMICmdBase::SetError(const CMIUtilString &rErrMsg) {
- m_cmdData.bCmdValid = false;
- m_cmdData.strErrorDescription = rErrMsg;
- m_cmdData.bCmdExecutedSuccessfully = false;
-
- const CMICmnMIValueResult valueResult("msg", CMICmnMIValueConst(rErrMsg));
- const CMICmnMIResultRecord miResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- valueResult);
- m_miResultRecord = miResultRecord;
- m_cmdData.strMiCmdResultRecord = miResultRecord.GetString();
-}
-
-//++
-// Details: Short cut function to check MI command's execute status and
-// set an error in case of failure.
-// Type: Method.
-// Args: error - (R) Error description object.
-// successHandler - (R) function describing actions to execute
-// in case of success state of passed SBError object.
-// errorHandler - (R) function describing actions to execute
-// in case of fail status of passed SBError object.
-// Return: bool.
-// Throws: None.
-//--
-bool CMICmdBase::HandleSBError(const lldb::SBError &error,
- const std::function<bool()> &successHandler,
- const std::function<void()> &errorHandler) {
- if (error.Success())
- return successHandler();
-
- SetError(error.GetCString());
- errorHandler();
- return MIstatus::failure;
-}
-
-//++
-// Details: Short cut function to check MI command's execute status and
-// call specified handler function for success case.
-// Type: Method.
-// Args: error - (R) Error description object.
-// successHandler - (R) function describing actions to execute
-// in case of success state of passed SBError object.
-// Return: bool.
-// Throws: None.
-//--
-bool CMICmdBase::HandleSBErrorWithSuccess(
- const lldb::SBError &error,
- const std::function<bool()> &successHandler) {
- return HandleSBError(error, successHandler);
-}
-
-//++
-// Details: Short cut function to check MI command's execute status and
-// call specified handler function for error case.
-// Type: Method.
-// Args: error - (R) Error description object.
-// errorHandler - (R) function describing actions to execute
-// in case of fail status of passed SBError object.
-// Return: bool.
-// Throws: None.
-//--
-bool CMICmdBase::HandleSBErrorWithFailure(
- const lldb::SBError &error,
- const std::function<void()> &errorHandler) {
- return HandleSBError(error, [] { return MIstatus::success; }, errorHandler);
-}
-
-//++
-// Details: Ask a command to provide its unique identifier.
-// Type: Method.
-// Args: A unique identifier for this command class.
-// Return: None.
-// Throws: None.
-//--
-MIuint CMICmdBase::GetGUID() {
- MIuint64 vptr = reinterpret_cast<MIuint64>(this);
- MIuint id = (vptr)&0xFFFFFFFF;
- id ^= (vptr >> 32) & 0xFFFFFFFF;
-
- return id;
-}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdBase::ParseArgs() {
- // Do nothing - override to implement
-
- return MIstatus::success;
-}
-
-//++
-// Details: Having previously given CMICmdArgSet m_setCmdArgs all the argument
-// or option
-// definitions for the command to handle proceed to parse and validate
-// the
-// command's options text for those arguments and extract the values
-// for each if
-// any.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdBase::ParseValidateCmdOptions() {
- CMICmdArgContext argCntxt(m_cmdData.strMiCmdOption);
- if (m_setCmdArgs.Validate(m_cmdData.strMiCmd, argCntxt))
- return MIstatus::success;
-
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_ARGS),
- m_cmdData.strMiCmd.c_str(),
- m_setCmdArgs.GetErrorDescription().c_str()));
-
- return MIstatus::failure;
-}
-
-//++
-// Details: If the MI Driver is not operating via a client i.e. Eclipse but say
-// operating
-// on a executable passed in as a argument to the drive then what
-// should the driver
-// do on a command failing? Either continue operating or exit the
-// application.
-// Override this function where a command failure cannot allow the
-// driver to
-// continue operating.
-// Type: Overrideable.
-// Args: None.
-// Return: bool - True = Fatal if command fails, false = can continue if
-// command fails.
-// Throws: None.
-//--
-bool CMICmdBase::GetExitAppOnCommandFailure() const { return false; }
diff --git a/tools/lldb-mi/MICmdBase.h b/tools/lldb-mi/MICmdBase.h
deleted file mode 100644
index 4e32ed6a5262..000000000000
--- a/tools/lldb-mi/MICmdBase.h
+++ /dev/null
@@ -1,193 +0,0 @@
-//===-- MICmdBase.h ---------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#pragma once
-
-#include <functional>
-
-#include "lldb/API/SBError.h"
-
-#include "MICmdArgSet.h"
-#include "MICmdData.h"
-#include "MICmdFactory.h"
-#include "MICmdInvoker.h"
-#include "MICmnBase.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnResources.h"
-#include "MIUtilString.h"
-
-// Declarations:
-class CMICmnLLDBDebugSessionInfo;
-
-//++
-//============================================================================
-// Details: MI command base class. MI commands derive from this base class.
-// The Command Factory creates command objects and passes them to the
-// Command Invoker. The Invoker takes ownership of any commands created
-// which means it is the only object to delete them when a command is
-// finished working. Commands do not delete themselves.
-// There are two types of command implicitly defined by the state of
-// the m_bWaitForEventFromSBDebugger flag. There is the event type
-// command which registers (command fn) callbacks with the SBListener
-// does some work then wakes up again when called back, does more work
-// perhaps, ends, then the Invoker calls the command's Acknowledge
-// function. The other type of command is one that just does some work,
-// ends, then the Invoker calls the command's Acknowledge function. No
-// events set up.
-// A command's Execute(), Acknowledge() and event callback functions
-// are
-// carried out in the main thread.
-// A command may use the argument derived object classes
-// (CMICmdArgValBase)
-// to factor handling and parsing of different types of arguments
-// presented to a command. A command will produce an error should it
-// be presented with arguments or options it does not understand.
-//--
-class CMICmdBase : public CMICmnBase,
- public CMICmdInvoker::ICmd,
- public CMICmdFactory::ICmd {
- // Methods:
-public:
- CMICmdBase();
-
- // Overridden:
- // From CMICmdInvoker::ICmd
- const SMICmdData &GetCmdData() const override;
- const CMIUtilString &GetErrorDescription() const override;
- void SetCmdData(const SMICmdData &vCmdData) override;
- void CmdFinishedTellInvoker() const override;
- const CMIUtilString &GetMIResultRecord() const override;
- const CMIUtilString &GetMIResultRecordExtra() const override;
- bool HasMIResultRecordExtra() const override;
- bool ParseArgs() override;
- // From CMICmdFactory::ICmd
- const CMIUtilString &GetMiCmd() const override;
- CMICmdFactory::CmdCreatorFnPtr GetCmdCreatorFn() const override;
-
- virtual MIuint GetGUID();
- void AddCommonArgs();
-
- // Overrideable:
- ~CMICmdBase() override;
- virtual bool GetExitAppOnCommandFailure() const;
-
- // Methods:
-protected:
- void SetError(const CMIUtilString &rErrMsg);
- bool HandleSBError(const lldb::SBError &error,
- const std::function<bool()> &successHandler =
- [] { return MIstatus::success; },
- const std::function<void()> &errorHandler = [] {});
- bool HandleSBErrorWithSuccess(const lldb::SBError &error,
- const std::function<bool()> &successHandler);
- bool HandleSBErrorWithFailure(const lldb::SBError &error,
- const std::function<void()> &errorHandler);
- template <class T> T *GetOption(const CMIUtilString &vStrOptionName);
- bool ParseValidateCmdOptions();
-
- // Attributes:
- CMICmdFactory::CmdCreatorFnPtr m_pSelfCreatorFn;
- CMIUtilString m_strCurrentErrDescription; // Reason for Execute or Acknowledge
- // function failure
- SMICmdData m_cmdData; // Holds information/status of *this command. Used by
- // other MI code to report or determine state of a
- // command.
- bool m_bWaitForEventFromSBDebugger; // True = yes event type command wait,
- // false = command calls Acknowledge()
- // straight after Execute()
- // no waiting
- CMIUtilString
- m_strMiCmd; // The MI text identifying *this command i.e. 'break-insert'
- CMICmnMIResultRecord m_miResultRecord; // This is completed in the
- // Acknowledge() function and returned
- // to the Command Invoker to proceed
- // stdout output. Each command forms 1 response to its input.
- CMIUtilString m_miResultRecordExtra; // This is completed in the Acknowledge()
- // function and returned to the Command
- // Invoker to proceed
- // stdout output. Hack command produce more response text to help the client
- // because of using LLDB
- CMICmnLLDBDebugSessionInfo &m_rLLDBDebugSessionInfo; // Access to command
- // sharing information or
- // data across any and
- // all command based
- // derived classes.
- bool m_bHasResultRecordExtra; // True = Yes command produced additional MI
- // output to its 1 line response, false = no
- // extra MI output
- // formed.
- CMICmdArgSet m_setCmdArgs; // The list of arguments *this command needs to
- // parse from the options string to carry out work.
- const CMIUtilString m_constStrArgThreadGroup;
- const CMIUtilString m_constStrArgThread;
- const CMIUtilString m_constStrArgFrame;
- const CMIUtilString m_constStrArgConsume;
-
- // These 3 members can be used by the derived classes to make any of
- // "thread", "frame" or "thread-group" mandatory.
- bool m_ThreadGrpArgMandatory;
- bool m_ThreadArgMandatory;
- bool m_FrameArgMandatory;
-};
-
-//++
-// Details: Retrieve the command argument or option object pointer so that it
-// can be
-// examined. If the option found and valid get the value (number,
-// string or list
-// - see CMICmdArgValBase class) from it to use with the command's
-// decision
-// making. If the argument is not found the command's error description
-// is set
-// describing the error condition.
-// Type: Template method.
-// Args: vStrOptionName - (R) The text name of the argument or option to
-// search for in
-// the list of the command's possible arguments
-// or options.
-// Return: T * - CMICmdArgValBase derived object.
-// - nullptr = function has failed, unable to retrieve the
-// option/arg object.
-// Throws: None.
-//--
-template <class T>
-T *CMICmdBase::GetOption(const CMIUtilString &vStrOptionName) {
- CMICmdArgValBase *pPtrBase = nullptr;
- if (!m_setCmdArgs.GetArg(vStrOptionName, pPtrBase)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- vStrOptionName.c_str()));
- return nullptr;
- }
-
- return static_cast<T *>(pPtrBase);
-}
-
-//++
-// Details: Retrieve the command argument or option object pointer using
-// template function
-// CMICmdBase::GetOption(). Should the argument (by name) not be found
-// the
-// command will exit with a failure (set in GetOption()).
-// Type: Preprocessor macro.
-// Args: a - (R) The actual variable's name.
-// b - (R) The type of variable (appended to CMICmdArgVal i.e.
-// CMICmdArgValString).
-// c - (R) The text name of the argument or option to search for in
-// the list of
-// the command's possible arguments or options.
-// Return: T * - CMICmdArgValBase derived object.
-// - nullptr = function has failed, unable to retrieve the
-// option/arg object.
-// Throws: None.
-//--
-#define CMICMDBASE_GETOPTION(a, b, c) \
- CMICmdArgVal##b *a = CMICmdBase::GetOption<CMICmdArgVal##b>(c); \
- if (a == nullptr) \
- return MIstatus::failure;
-// This comment is to stop compile warning for #define
diff --git a/tools/lldb-mi/MICmdCmd.cpp b/tools/lldb-mi/MICmdCmd.cpp
deleted file mode 100644
index 081cff6fa51f..000000000000
--- a/tools/lldb-mi/MICmdCmd.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-//===-- MICmdCmd.cpp --------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdEnablePrettyPrinting implementation.
-// CMICmdCmdSource implementation.
-//
-
-// In-house headers:
-#include "MICmdCmd.h"
-
-//++
-// Details: CMICmdCmdEnablePrettyPrinting constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdEnablePrettyPrinting::CMICmdCmdEnablePrettyPrinting() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "enable-pretty-printing";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdEnablePrettyPrinting::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdEnablePrettyPrinting destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdEnablePrettyPrinting::~CMICmdCmdEnablePrettyPrinting() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdEnablePrettyPrinting::Execute() {
- // Do nothing
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdEnablePrettyPrinting::Acknowledge() {
- const CMICmnMIValueConst miValueConst("0");
- const CMICmnMIValueResult miValueResult("supported", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdEnablePrettyPrinting::CreateSelf() {
- return new CMICmdCmdEnablePrettyPrinting();
-}
-
-
-//++
-// Details: CMICmdCmdSource constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdSource::CMICmdCmdSource() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "source";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdSource::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdSource destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdSource::~CMICmdCmdSource() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSource::Execute() {
- // Do nothing
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSource::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdSource::CreateSelf() { return new CMICmdCmdSource(); }
diff --git a/tools/lldb-mi/MICmdCmd.h b/tools/lldb-mi/MICmdCmd.h
deleted file mode 100644
index aeaaa4b01db6..000000000000
--- a/tools/lldb-mi/MICmdCmd.h
+++ /dev/null
@@ -1,90 +0,0 @@
-//===-- MICmdCmd.h ----------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdEnablePrettyPrinting interface.
-// CMICmdCmdSource interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-/*
-MI commands implemented are:
- See MICmdCommands.cpp
-*/
-
-#pragma once
-
-// Third party headers:
-#include "lldb/API/SBBreakpoint.h"
-#include "lldb/API/SBCommandReturnObject.h"
-#include <vector>
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "enable-pretty-printing".
-// Enables Python base pretty printing.
-// Ref:
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html
-//--
-class CMICmdCmdEnablePrettyPrinting : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdEnablePrettyPrinting();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdEnablePrettyPrinting() override;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "source".
-//--
-class CMICmdCmdSource : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdSource();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdSource() override;
-};
diff --git a/tools/lldb-mi/MICmdCmdBreak.cpp b/tools/lldb-mi/MICmdCmdBreak.cpp
deleted file mode 100644
index 1cd0bacf51d5..000000000000
--- a/tools/lldb-mi/MICmdCmdBreak.cpp
+++ /dev/null
@@ -1,1024 +0,0 @@
-//===-- MICmdCmdBreak.cpp ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdBreakInsert implementation.
-// CMICmdCmdBreakDelete implementation.
-// CMICmdCmdBreakDisable implementation.
-// CMICmdCmdBreakEnable implementation.
-// CMICmdCmdBreakAfter implementation.
-// CMICmdCmdBreakCondition implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBBreakpointLocation.h"
-
-// In-house headers:
-#include "MICmdArgValFile.h"
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValString.h"
-#include "MICmdArgValThreadGrp.h"
-#include "MICmdCmdBreak.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnMIOutOfBandRecord.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-#include "MICmnStreamStdout.h"
-
-//++
-// Details: CMICmdCmdBreakInsert constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakInsert::CMICmdCmdBreakInsert()
- : m_bBrkPtIsTemp(false), m_bBrkPtIsPending(false), m_nBrkPtIgnoreCount(0),
- m_bBrkPtEnabled(false), m_bBrkPtCondition(false), m_bBrkPtThreadId(false),
- m_nBrkPtThreadId(0), m_constStrArgNamedTempBrkPt("t"),
- m_constStrArgNamedHWBrkPt("h"), m_constStrArgNamedPendinfBrkPt("f"),
- m_constStrArgNamedDisableBrkPt("d"), m_constStrArgNamedTracePt("a"),
- m_constStrArgNamedConditionalBrkPt("c"), m_constStrArgNamedInoreCnt("i"),
- m_constStrArgNamedRestrictBrkPtToThreadId("p"),
- m_constStrArgNamedLocation("location") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "break-insert";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdBreakInsert::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdBreakInsert destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakInsert::~CMICmdCmdBreakInsert() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakInsert::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValOptionShort(m_constStrArgNamedTempBrkPt, false, true));
- // Not implemented m_setCmdArgs.Add(new CMICmdArgValOptionShort(
- // m_constStrArgNamedHWBrkPt, false, false));
- m_setCmdArgs.Add(new CMICmdArgValOptionShort(
- m_constStrArgNamedPendinfBrkPt, false, true,
- CMICmdArgValListBase::eArgValType_StringQuotedNumberPath, 1));
- m_setCmdArgs.Add(new CMICmdArgValOptionShort(m_constStrArgNamedDisableBrkPt,
- false, false));
- // Not implemented m_setCmdArgs.Add(new CMICmdArgValOptionShort(
- // m_constStrArgNamedTracePt, false, false));
- m_setCmdArgs.Add(new CMICmdArgValOptionShort(
- m_constStrArgNamedConditionalBrkPt, false, true,
- CMICmdArgValListBase::eArgValType_StringQuoted, 1));
- m_setCmdArgs.Add(
- new CMICmdArgValOptionShort(m_constStrArgNamedInoreCnt, false, true,
- CMICmdArgValListBase::eArgValType_Number, 1));
- m_setCmdArgs.Add(new CMICmdArgValOptionShort(
- m_constStrArgNamedRestrictBrkPtToThreadId, false, true,
- CMICmdArgValListBase::eArgValType_Number, 1));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedLocation, false,
- true, false, false, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Helper function for CMICmdCmdBreakInsert::Execute().
-//
-// Given a string, return the position of the ':' separator in 'file:func'
-// or 'file:line', if any. If not found, return npos. For example, return
-// 5 for 'foo.c:std::string'.
-//--
-static size_t findFileSeparatorPos(const std::string &x) {
- // Full paths in windows can have ':' after a drive letter, so we
- // search backwards, taking care to skip C++ namespace tokens '::'.
- size_t n = x.rfind(':');
- while (n != std::string::npos && n > 1 && x[n - 1] == ':') {
- n = x.rfind(':', n - 2);
- }
- return n;
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakInsert::Execute() {
- CMICMDBASE_GETOPTION(pArgTempBrkPt, OptionShort, m_constStrArgNamedTempBrkPt);
- CMICMDBASE_GETOPTION(pArgThreadGroup, OptionLong, m_constStrArgThreadGroup);
- CMICMDBASE_GETOPTION(pArgLocation, String, m_constStrArgNamedLocation);
- CMICMDBASE_GETOPTION(pArgIgnoreCnt, OptionShort, m_constStrArgNamedInoreCnt);
- CMICMDBASE_GETOPTION(pArgPendingBrkPt, OptionShort,
- m_constStrArgNamedPendinfBrkPt);
- CMICMDBASE_GETOPTION(pArgDisableBrkPt, OptionShort,
- m_constStrArgNamedDisableBrkPt);
- CMICMDBASE_GETOPTION(pArgConditionalBrkPt, OptionShort,
- m_constStrArgNamedConditionalBrkPt);
- CMICMDBASE_GETOPTION(pArgRestrictBrkPtToThreadId, OptionShort,
- m_constStrArgNamedRestrictBrkPtToThreadId);
-
- // Ask LLDB for the target to check if we have valid or dummy one.
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
-
- m_bBrkPtEnabled = !pArgDisableBrkPt->GetFound();
- m_bBrkPtIsTemp = pArgTempBrkPt->GetFound();
- m_bHaveArgOptionThreadGrp = pArgThreadGroup->GetFound();
- if (m_bHaveArgOptionThreadGrp) {
- MIuint nThreadGrp = 0;
- pArgThreadGroup->GetExpectedOption<CMICmdArgValThreadGrp, MIuint>(
- nThreadGrp);
- m_strArgOptionThreadGrp = CMIUtilString::Format("i%d", nThreadGrp);
- }
-
- if (sbTarget == rSessionInfo.GetDebugger().GetDummyTarget())
- m_bBrkPtIsPending = true;
- else {
- m_bBrkPtIsPending = pArgPendingBrkPt->GetFound();
- if (!m_bBrkPtIsPending) {
- CMIUtilString pending;
- if (m_rLLDBDebugSessionInfo.SharedDataRetrieve("breakpoint.pending", pending)) {
- m_bBrkPtIsPending = pending == "on";
- }
- }
- }
-
- if (pArgLocation->GetFound())
- m_brkName = pArgLocation->GetValue();
- else if (m_bBrkPtIsPending) {
- pArgPendingBrkPt->GetExpectedOption<CMICmdArgValString, CMIUtilString>(
- m_brkName);
- }
- if (pArgIgnoreCnt->GetFound()) {
- pArgIgnoreCnt->GetExpectedOption<CMICmdArgValNumber, MIuint>(
- m_nBrkPtIgnoreCount);
- }
- m_bBrkPtCondition = pArgConditionalBrkPt->GetFound();
- if (m_bBrkPtCondition) {
- pArgConditionalBrkPt->GetExpectedOption<CMICmdArgValString, CMIUtilString>(
- m_brkPtCondition);
- }
- m_bBrkPtThreadId = pArgRestrictBrkPtToThreadId->GetFound();
- if (m_bBrkPtCondition) {
- pArgRestrictBrkPtToThreadId->GetExpectedOption<CMICmdArgValNumber, MIuint>(
- m_nBrkPtThreadId);
- }
-
- // Determine if break on a file line or at a function
- BreakPoint_e eBrkPtType = eBreakPoint_NotDefineYet;
- CMIUtilString fileName;
- MIuint nFileLine = 0;
- CMIUtilString strFileFn;
- CMIUtilString rStrLineOrFn;
- // Is the string in the form 'file:func' or 'file:line'?
- // If so, find the position of the ':' separator.
- const size_t nPosColon = findFileSeparatorPos(m_brkName);
- if (nPosColon != std::string::npos) {
- // Extract file name and line number from it
- fileName = m_brkName.substr(0, nPosColon);
- rStrLineOrFn =
- m_brkName.substr(nPosColon + 1, m_brkName.size() - nPosColon - 1);
-
- if (rStrLineOrFn.empty())
- eBrkPtType = eBreakPoint_ByName;
- else {
- MIint64 nValue = 0;
- if (rStrLineOrFn.ExtractNumber(nValue)) {
- nFileLine = static_cast<MIuint>(nValue);
- eBrkPtType = eBreakPoint_ByFileLine;
- } else {
- strFileFn = rStrLineOrFn;
- eBrkPtType = eBreakPoint_ByFileFn;
- }
- }
- }
-
- // Determine if break defined as an address
- lldb::addr_t nAddress = 0;
- if (eBrkPtType == eBreakPoint_NotDefineYet) {
- MIint64 nValue = 0;
- if (m_brkName.ExtractNumber(nValue)) {
- nAddress = static_cast<lldb::addr_t>(nValue);
- eBrkPtType = eBreakPoint_ByAddress;
- }
- }
-
- // Break defined as an function
- if (eBrkPtType == eBreakPoint_NotDefineYet) {
- eBrkPtType = eBreakPoint_ByName;
- }
-
- // Ask LLDB to create a breakpoint
- bool bOk = MIstatus::success;
- switch (eBrkPtType) {
- case eBreakPoint_ByAddress:
- m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress);
- break;
- case eBreakPoint_ByFileFn: {
- lldb::SBFileSpecList module; // search in all modules
- lldb::SBFileSpecList compUnit;
- compUnit.Append(lldb::SBFileSpec(fileName.c_str()));
- m_brkPt =
- sbTarget.BreakpointCreateByName(strFileFn.c_str(), module, compUnit);
- break;
- }
- case eBreakPoint_ByFileLine:
- m_brkPt = sbTarget.BreakpointCreateByLocation(fileName.c_str(), nFileLine);
- break;
- case eBreakPoint_ByName:
- m_brkPt = sbTarget.BreakpointCreateByName(m_brkName.c_str(), nullptr);
- break;
- case eBreakPoint_count:
- case eBreakPoint_NotDefineYet:
- case eBreakPoint_Invalid:
- bOk = MIstatus::failure;
- break;
- }
-
- if (bOk) {
- if (!m_bBrkPtIsPending && (m_brkPt.GetNumLocations() == 0)) {
- sbTarget.BreakpointDelete(m_brkPt.GetID());
- SetError(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(), m_brkName.c_str()));
- return MIstatus::failure;
- }
-
- m_brkPt.SetEnabled(m_bBrkPtEnabled);
- m_brkPt.SetIgnoreCount(m_nBrkPtIgnoreCount);
- if (m_bBrkPtCondition)
- m_brkPt.SetCondition(m_brkPtCondition.c_str());
- if (m_bBrkPtThreadId)
- m_brkPt.SetThreadID(m_nBrkPtThreadId);
- }
-
- // CODETAG_LLDB_BREAKPOINT_CREATION
- // This is in the main thread
- // Record break point information to be by LLDB event handler function
- CMICmnLLDBDebugSessionInfo::SBrkPtInfo sBrkPtInfo;
- if (!rSessionInfo.GetBrkPtInfo(m_brkPt, sBrkPtInfo))
- return MIstatus::failure;
- sBrkPtInfo.m_id = m_brkPt.GetID();
- sBrkPtInfo.m_bDisp = m_bBrkPtIsTemp;
- sBrkPtInfo.m_bEnabled = m_bBrkPtEnabled;
- sBrkPtInfo.m_bHaveArgOptionThreadGrp = m_bHaveArgOptionThreadGrp;
- sBrkPtInfo.m_strOptThrdGrp = m_strArgOptionThreadGrp;
- sBrkPtInfo.m_nTimes = m_brkPt.GetHitCount();
- sBrkPtInfo.m_strOrigLoc = m_brkName;
- sBrkPtInfo.m_nIgnore = m_nBrkPtIgnoreCount;
- sBrkPtInfo.m_bPending = m_bBrkPtIsPending;
- sBrkPtInfo.m_bCondition = m_bBrkPtCondition;
- sBrkPtInfo.m_strCondition = m_brkPtCondition;
- sBrkPtInfo.m_bBrkPtThreadId = m_bBrkPtThreadId;
- sBrkPtInfo.m_nBrkPtThreadId = m_nBrkPtThreadId;
-
- bOk = bOk && rSessionInfo.RecordBrkPtInfo(m_brkPt.GetID(), sBrkPtInfo);
- if (!bOk) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_brkName.c_str()));
- return MIstatus::failure;
- }
-
- // CODETAG_LLDB_BRKPT_ID_MAX
- if (m_brkPt.GetID() > (lldb::break_id_t)rSessionInfo.m_nBrkPointCntMax) {
- SetError(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_BRKPT_CNT_EXCEEDED), m_cmdData.strMiCmd.c_str(),
- rSessionInfo.m_nBrkPointCntMax, m_brkName.c_str()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakInsert::Acknowledge() {
- // Get breakpoint information
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- CMICmnLLDBDebugSessionInfo::SBrkPtInfo sBrkPtInfo;
- if (!rSessionInfo.RecordBrkPtInfoGet(m_brkPt.GetID(), sBrkPtInfo))
- return MIstatus::failure;
-
- // MI print
- // "^done,bkpt={number=\"%d\",type=\"breakpoint\",disp=\"%s\",enabled=\"%c\",addr=\"0x%016"
- // PRIx64
- // "\",func=\"%s\",file=\"%s\",fullname=\"%s/%s\",line=\"%d\",thread-groups=[\"%s\"],times=\"%d\",original-location=\"%s\"}"
- CMICmnMIValueTuple miValueTuple;
- if (!rSessionInfo.MIResponseFormBrkPtInfo(sBrkPtInfo, miValueTuple))
- return MIstatus::failure;
-
- const CMICmnMIValueResult miValueResultD("bkpt", miValueTuple);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResultD);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdBreakInsert::CreateSelf() {
- return new CMICmdCmdBreakInsert();
-}
-
-
-//++
-// Details: CMICmdCmdBreakDelete constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakDelete::CMICmdCmdBreakDelete()
- : m_constStrArgNamedBrkPt("breakpoint") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "break-delete";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdBreakDelete::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdBreakDelete destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakDelete::~CMICmdCmdBreakDelete() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakDelete::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValListOfN(m_constStrArgNamedBrkPt, true, true,
- CMICmdArgValListBase::eArgValType_Number));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakDelete::Execute() {
- CMICMDBASE_GETOPTION(pArgBrkPt, ListOfN, m_constStrArgNamedBrkPt);
-
- // ATM we only handle one break point ID
- MIuint64 nBrk = UINT64_MAX;
- if (!pArgBrkPt->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nBrk)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgNamedBrkPt.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- const bool bBrkPt = rSessionInfo.GetTarget().BreakpointDelete(
- static_cast<lldb::break_id_t>(nBrk));
- if (!bBrkPt) {
- const CMIUtilString strBrkNum(CMIUtilString::Format("%d", nBrk));
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INVALID),
- m_cmdData.strMiCmd.c_str(),
- strBrkNum.c_str()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakDelete::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdBreakDelete::CreateSelf() {
- return new CMICmdCmdBreakDelete();
-}
-
-
-//++
-// Details: CMICmdCmdBreakDisable constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakDisable::CMICmdCmdBreakDisable()
- : m_constStrArgNamedBrkPt("breakpoint"), m_bBrkPtDisabledOk(false),
- m_nBrkPtId(0) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "break-disable";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdBreakDisable::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdBreakDisable destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakDisable::~CMICmdCmdBreakDisable() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakDisable::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValListOfN(m_constStrArgNamedBrkPt, true, true,
- CMICmdArgValListBase::eArgValType_Number));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakDisable::Execute() {
- CMICMDBASE_GETOPTION(pArgBrkPt, ListOfN, m_constStrArgNamedBrkPt);
-
- // ATM we only handle one break point ID
- MIuint64 nBrk = UINT64_MAX;
- if (!pArgBrkPt->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nBrk)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgNamedBrkPt.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBBreakpoint brkPt = rSessionInfo.GetTarget().FindBreakpointByID(
- static_cast<lldb::break_id_t>(nBrk));
- if (brkPt.IsValid()) {
- m_bBrkPtDisabledOk = true;
- brkPt.SetEnabled(false);
- m_nBrkPtId = nBrk;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakDisable::Acknowledge() {
- if (m_bBrkPtDisabledOk) {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- const CMIUtilString strBrkPtId(CMIUtilString::Format("%d", m_nBrkPtId));
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_BRKPT_INVALID), strBrkPtId.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdBreakDisable::CreateSelf() {
- return new CMICmdCmdBreakDisable();
-}
-
-
-//++
-// Details: CMICmdCmdBreakEnable constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakEnable::CMICmdCmdBreakEnable()
- : m_constStrArgNamedBrkPt("breakpoint"), m_bBrkPtEnabledOk(false),
- m_nBrkPtId(0) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "break-enable";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdBreakEnable::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdBreakEnable destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakEnable::~CMICmdCmdBreakEnable() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakEnable::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValListOfN(m_constStrArgNamedBrkPt, true, true,
- CMICmdArgValListBase::eArgValType_Number));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakEnable::Execute() {
- CMICMDBASE_GETOPTION(pArgBrkPt, ListOfN, m_constStrArgNamedBrkPt);
-
- // ATM we only handle one break point ID
- MIuint64 nBrk = UINT64_MAX;
- if (!pArgBrkPt->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nBrk)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgNamedBrkPt.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBBreakpoint brkPt = rSessionInfo.GetTarget().FindBreakpointByID(
- static_cast<lldb::break_id_t>(nBrk));
- if (brkPt.IsValid()) {
- m_bBrkPtEnabledOk = true;
- brkPt.SetEnabled(true);
- m_nBrkPtId = nBrk;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakEnable::Acknowledge() {
- if (m_bBrkPtEnabledOk) {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- const CMIUtilString strBrkPtId(CMIUtilString::Format("%d", m_nBrkPtId));
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_BRKPT_INVALID), strBrkPtId.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdBreakEnable::CreateSelf() {
- return new CMICmdCmdBreakEnable();
-}
-
-
-//++
-// Details: CMICmdCmdBreakAfter constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakAfter::CMICmdCmdBreakAfter()
- : m_constStrArgNamedNumber("number"), m_constStrArgNamedCount("count"),
- m_nBrkPtId(0), m_nBrkPtCount(0) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "break-after";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdBreakAfter::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdBreakAfter destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakAfter::~CMICmdCmdBreakAfter() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakAfter::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValNumber(m_constStrArgNamedNumber, true, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNamedCount, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakAfter::Execute() {
- CMICMDBASE_GETOPTION(pArgNumber, Number, m_constStrArgNamedNumber);
- CMICMDBASE_GETOPTION(pArgCount, Number, m_constStrArgNamedCount);
-
- m_nBrkPtId = pArgNumber->GetValue();
- m_nBrkPtCount = pArgCount->GetValue();
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBBreakpoint brkPt = rSessionInfo.GetTarget().FindBreakpointByID(
- static_cast<lldb::break_id_t>(m_nBrkPtId));
- if (brkPt.IsValid()) {
- brkPt.SetIgnoreCount(m_nBrkPtCount);
-
- CMICmnLLDBDebugSessionInfo::SBrkPtInfo sBrkPtInfo;
- if (!rSessionInfo.RecordBrkPtInfoGet(m_nBrkPtId, sBrkPtInfo)) {
- SetError(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(), m_nBrkPtId));
- return MIstatus::failure;
- }
- sBrkPtInfo.m_nIgnore = m_nBrkPtCount;
- rSessionInfo.RecordBrkPtInfo(m_nBrkPtId, sBrkPtInfo);
- } else {
- const CMIUtilString strBrkPtId(CMIUtilString::Format("%d", m_nBrkPtId));
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INVALID),
- m_cmdData.strMiCmd.c_str(),
- strBrkPtId.c_str()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakAfter::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdBreakAfter::CreateSelf() {
- return new CMICmdCmdBreakAfter();
-}
-
-
-//++
-// Details: CMICmdCmdBreakCondition constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakCondition::CMICmdCmdBreakCondition()
- : m_constStrArgNamedNumber("number"), m_constStrArgNamedExpr("expr"),
- m_constStrArgNamedExprNoQuotes(
- "expression not surround by quotes") // Not specified in MI spec, we
- // need to handle expressions not
- // surrounded by quotes
- ,
- m_nBrkPtId(0) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "break-condition";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdBreakCondition::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdBreakCondition destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdBreakCondition::~CMICmdCmdBreakCondition() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakCondition::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValNumber(m_constStrArgNamedNumber, true, true));
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgNamedExpr, true, true, true, true));
- m_setCmdArgs.Add(new CMICmdArgValListOfN(
- m_constStrArgNamedExprNoQuotes, false, false,
- CMICmdArgValListBase::eArgValType_StringQuotedNumber));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakCondition::Execute() {
- CMICMDBASE_GETOPTION(pArgNumber, Number, m_constStrArgNamedNumber);
- CMICMDBASE_GETOPTION(pArgExpr, String, m_constStrArgNamedExpr);
-
- m_nBrkPtId = pArgNumber->GetValue();
- m_strBrkPtExpr = pArgExpr->GetValue();
- m_strBrkPtExpr += GetRestOfExpressionNotSurroundedInQuotes();
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBBreakpoint brkPt = rSessionInfo.GetTarget().FindBreakpointByID(
- static_cast<lldb::break_id_t>(m_nBrkPtId));
- if (brkPt.IsValid()) {
- brkPt.SetCondition(m_strBrkPtExpr.c_str());
-
- CMICmnLLDBDebugSessionInfo::SBrkPtInfo sBrkPtInfo;
- if (!rSessionInfo.RecordBrkPtInfoGet(m_nBrkPtId, sBrkPtInfo)) {
- SetError(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(), m_nBrkPtId));
- return MIstatus::failure;
- }
- sBrkPtInfo.m_strCondition = m_strBrkPtExpr;
- rSessionInfo.RecordBrkPtInfo(m_nBrkPtId, sBrkPtInfo);
- } else {
- const CMIUtilString strBrkPtId(CMIUtilString::Format("%d", m_nBrkPtId));
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_INVALID),
- m_cmdData.strMiCmd.c_str(),
- strBrkPtId.c_str()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdBreakCondition::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdBreakCondition::CreateSelf() {
- return new CMICmdCmdBreakCondition();
-}
-
-//++
-// Details: A breakpoint expression can be passed to *this command as:
-// a single string i.e. '2' -> ok.
-// a quoted string i.e. "a > 100" -> ok
-// a non quoted string i.e. 'a > 100' -> not ok
-// CMICmdArgValString only extracts the first space separated string,
-// the "a".
-// This function using the optional argument type CMICmdArgValListOfN
-// collects
-// the rest of the expression so that is may be added to the 'a' part
-// to form a
-// complete expression string i.e. "a > 100".
-// If the expression value was guaranteed to be surrounded by quotes
-// them this
-// function would not be necessary.
-// Type: Method.
-// Args: None.
-// Return: CMIUtilString - Rest of the breakpoint expression.
-// Throws: None.
-//--
-CMIUtilString
-CMICmdCmdBreakCondition::GetRestOfExpressionNotSurroundedInQuotes() {
- CMIUtilString strExpression;
-
- CMICmdArgValListOfN *pArgExprNoQuotes =
- CMICmdBase::GetOption<CMICmdArgValListOfN>(
- m_constStrArgNamedExprNoQuotes);
- if (pArgExprNoQuotes != nullptr) {
- const CMICmdArgValListBase::VecArgObjPtr_t &rVecExprParts(
- pArgExprNoQuotes->GetExpectedOptions());
- if (!rVecExprParts.empty()) {
- CMICmdArgValListBase::VecArgObjPtr_t::const_iterator it =
- rVecExprParts.begin();
- while (it != rVecExprParts.end()) {
- const CMICmdArgValString *pPartExpr =
- static_cast<CMICmdArgValString *>(*it);
- const CMIUtilString &rPartExpr = pPartExpr->GetValue();
- strExpression += " ";
- strExpression += rPartExpr;
-
- // Next
- ++it;
- }
- strExpression = strExpression.Trim();
- }
- }
-
- return strExpression;
-}
diff --git a/tools/lldb-mi/MICmdCmdBreak.h b/tools/lldb-mi/MICmdCmdBreak.h
deleted file mode 100644
index 00c5aa236eac..000000000000
--- a/tools/lldb-mi/MICmdCmdBreak.h
+++ /dev/null
@@ -1,262 +0,0 @@
-//===-- MICmdCmdBreak.h -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdBreakInsert interface.
-// CMICmdCmdBreakDelete interface.
-// CMICmdCmdBreakDisable interface.
-// CMICmdCmdBreakEnable interface.
-// CMICmdCmdBreakAfter interface.
-// CMICmdCmdBreakCondition interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// Third party headers:
-#include "lldb/API/SBBreakpoint.h"
-
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "break-insert".
-// This command does not follow the MI documentation exactly.
-//--
-class CMICmdCmdBreakInsert : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdBreakInsert();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdBreakInsert() override;
-
- // Enumerations:
-private:
- //++ ===================================================================
- // Details: The type of break point give in the MI command text.
- //--
- enum BreakPoint_e {
- eBreakPoint_Invalid = 0,
- eBreakPoint_ByFileLine,
- eBreakPoint_ByFileFn,
- eBreakPoint_ByName,
- eBreakPoint_ByAddress,
- eBreakPoint_count,
- eBreakPoint_NotDefineYet
- };
-
- // Attributes:
-private:
- bool m_bBrkPtIsTemp;
- bool m_bHaveArgOptionThreadGrp;
- CMIUtilString m_brkName;
- CMIUtilString m_strArgOptionThreadGrp;
- lldb::SBBreakpoint m_brkPt;
- bool m_bBrkPtIsPending;
- MIuint m_nBrkPtIgnoreCount;
- bool m_bBrkPtEnabled;
- bool m_bBrkPtCondition;
- CMIUtilString m_brkPtCondition;
- bool m_bBrkPtThreadId;
- MIuint m_nBrkPtThreadId;
- const CMIUtilString m_constStrArgNamedTempBrkPt;
- const CMIUtilString m_constStrArgNamedHWBrkPt; // Not handled by *this command
- const CMIUtilString m_constStrArgNamedPendinfBrkPt;
- const CMIUtilString m_constStrArgNamedDisableBrkPt;
- const CMIUtilString m_constStrArgNamedTracePt; // Not handled by *this command
- const CMIUtilString m_constStrArgNamedConditionalBrkPt;
- const CMIUtilString m_constStrArgNamedInoreCnt;
- const CMIUtilString m_constStrArgNamedRestrictBrkPtToThreadId;
- const CMIUtilString m_constStrArgNamedLocation;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "break-delete".
-//--
-class CMICmdCmdBreakDelete : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdBreakDelete();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdBreakDelete() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNamedBrkPt;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "break-disable".
-//--
-class CMICmdCmdBreakDisable : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdBreakDisable();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdBreakDisable() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNamedBrkPt;
- bool m_bBrkPtDisabledOk;
- MIuint m_nBrkPtId;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "break-enable".
-//--
-class CMICmdCmdBreakEnable : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdBreakEnable();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdBreakEnable() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNamedBrkPt;
- bool m_bBrkPtEnabledOk;
- MIuint m_nBrkPtId;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "break-after".
-//--
-class CMICmdCmdBreakAfter : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdBreakAfter();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdBreakAfter() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNamedNumber;
- const CMIUtilString m_constStrArgNamedCount;
- MIuint m_nBrkPtId;
- MIuint m_nBrkPtCount;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "break-condition".
-//--
-class CMICmdCmdBreakCondition : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdBreakCondition();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdBreakCondition() override;
-
- // Methods:
-private:
- CMIUtilString GetRestOfExpressionNotSurroundedInQuotes();
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNamedNumber;
- const CMIUtilString m_constStrArgNamedExpr;
- const CMIUtilString m_constStrArgNamedExprNoQuotes; // Not specified in MI
- // spec, we need to handle
- // expressions not
- // surrounded by quotes
- MIuint m_nBrkPtId;
- CMIUtilString m_strBrkPtExpr;
-};
diff --git a/tools/lldb-mi/MICmdCmdData.cpp b/tools/lldb-mi/MICmdCmdData.cpp
deleted file mode 100644
index e0a165765199..000000000000
--- a/tools/lldb-mi/MICmdCmdData.cpp
+++ /dev/null
@@ -1,1673 +0,0 @@
-//===-- MICmdCmdData.cpp ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdDataEvaluateExpression implementation.
-// CMICmdCmdDataDisassemble implementation.
-// CMICmdCmdDataReadMemoryBytes implementation.
-// CMICmdCmdDataReadMemory implementation.
-// CMICmdCmdDataListRegisterNames implementation.
-// CMICmdCmdDataListRegisterValues implementation.
-// CMICmdCmdDataListRegisterChanged implementation.
-// CMICmdCmdDataWriteMemoryBytes implementation.
-// CMICmdCmdDataWriteMemory implementation.
-// CMICmdCmdDataInfoLine implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBInstruction.h"
-#include "lldb/API/SBInstructionList.h"
-#include "lldb/API/SBStream.h"
-#include "lldb/API/SBThread.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/Twine.h"
-#include <inttypes.h>
-#include <string>
-
-// In-house headers:
-#include "MICmdArgValConsume.h"
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValString.h"
-#include "MICmdArgValThreadGrp.h"
-#include "MICmdCmdData.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugSessionInfoVarObj.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnLLDBProxySBValue.h"
-#include "MICmnLLDBUtilSBValue.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-#include "Platform.h"
-
-namespace {
-CMIUtilString IntToHexAddrStr(uint32_t number) {
- return CMIUtilString("0x" + llvm::Twine::utohexstr(number).str());
-}
-} // namespace
-
-//++
-// Details: CMICmdCmdDataEvaluateExpression constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataEvaluateExpression::CMICmdCmdDataEvaluateExpression()
- : m_bExpressionValid(true), m_bEvaluatedExpression(true), m_strValue("??"),
- m_bFoundInvalidChar(false), m_cExpressionInvalidChar(0x00),
- m_constStrArgExpr("expr") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-evaluate-expression";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataEvaluateExpression::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataEvaluateExpression destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataEvaluateExpression::~CMICmdCmdDataEvaluateExpression() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataEvaluateExpression::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgExpr, true, true, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataEvaluateExpression::Execute() {
- CMICMDBASE_GETOPTION(pArgExpr, String, m_constStrArgExpr);
-
- const CMIUtilString &rExpression(pArgExpr->GetValue());
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBThread thread = sbProcess.GetSelectedThread();
- m_bExpressionValid = (thread.GetNumFrames() > 0);
- if (!m_bExpressionValid)
- return MIstatus::success;
-
- lldb::SBFrame frame = thread.GetSelectedFrame();
- lldb::SBValue value = frame.EvaluateExpression(rExpression.c_str());
- m_Error = value.GetError();
- if (!value.IsValid() || m_Error.Fail())
- value = frame.FindVariable(rExpression.c_str());
- const CMICmnLLDBUtilSBValue utilValue(value, true);
- if (!utilValue.IsValid() || utilValue.IsValueUnknown()) {
- m_bEvaluatedExpression = false;
- return MIstatus::success;
- }
- if (!utilValue.HasName()) {
- if (HaveInvalidCharacterInExpression(rExpression,
- m_cExpressionInvalidChar)) {
- m_bFoundInvalidChar = true;
- return MIstatus::success;
- }
-
- m_strValue = rExpression;
- return MIstatus::success;
- }
- if (rExpression.IsQuoted()) {
- m_strValue = rExpression.Trim('\"');
- return MIstatus::success;
- }
- m_strValue = utilValue.GetValue(true).Escape().AddSlashes();
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataEvaluateExpression::Acknowledge() {
- if (m_bExpressionValid) {
- if (m_bEvaluatedExpression) {
- if (m_bFoundInvalidChar) {
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format(
- "Invalid character '%c' in expression", m_cExpressionInvalidChar));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- const CMICmnMIValueConst miValueConst(m_strValue);
- const CMICmnMIValueResult miValueResult("value", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
- CMIUtilString mi_error_msg = "Could not evaluate expression";
- if (const char *err_msg = m_Error.GetCString())
- mi_error_msg = err_msg;
- const CMICmnMIValueConst miValueConst(mi_error_msg.Escape(true));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- const CMICmnMIValueConst miValueConst("Invalid expression");
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataEvaluateExpression::CreateSelf() {
- return new CMICmdCmdDataEvaluateExpression();
-}
-
-//++
-// Details: Examine the expression string to see if it contains invalid
-// characters.
-// Type: Method.
-// Args: vrExpr - (R) Expression string given to *this command.
-// vrwInvalidChar - (W) True = Invalid character found, false =
-// nothing found.
-// Return: bool - True = Invalid character found, false = nothing found.
-// Throws: None.
-//--
-bool CMICmdCmdDataEvaluateExpression::HaveInvalidCharacterInExpression(
- const CMIUtilString &vrExpr, char &vrwInvalidChar) {
- static const std::string strInvalidCharacters(";#\\");
- const size_t nInvalidCharacterOffset =
- vrExpr.find_first_of(strInvalidCharacters);
- const bool bFoundInvalidCharInExpression =
- (nInvalidCharacterOffset != CMIUtilString::npos);
- vrwInvalidChar =
- bFoundInvalidCharInExpression ? vrExpr[nInvalidCharacterOffset] : 0x00;
- return bFoundInvalidCharInExpression;
-}
-
-
-//++
-// Details: CMICmdCmdDataDisassemble constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataDisassemble::CMICmdCmdDataDisassemble()
- : m_constStrArgAddrStart("s"), m_constStrArgAddrEnd("e"),
- m_constStrArgMode("mode"), m_miValueList(true) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-disassemble";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataDisassemble::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataDisassemble destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataDisassemble::~CMICmdCmdDataDisassemble() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataDisassemble::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValOptionShort(
- m_constStrArgAddrStart, true, true,
- CMICmdArgValListBase::eArgValType_StringQuotedNumber, 1));
- m_setCmdArgs.Add(new CMICmdArgValOptionShort(
- m_constStrArgAddrEnd, true, true,
- CMICmdArgValListBase::eArgValType_StringQuotedNumber, 1));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgMode, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataDisassemble::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
- CMICMDBASE_GETOPTION(pArgAddrStart, OptionShort, m_constStrArgAddrStart);
- CMICMDBASE_GETOPTION(pArgAddrEnd, OptionShort, m_constStrArgAddrEnd);
- CMICMDBASE_GETOPTION(pArgMode, Number, m_constStrArgMode);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- CMIUtilString strAddrStart;
- if (!pArgAddrStart->GetExpectedOption<CMICmdArgValString, CMIUtilString>(
- strAddrStart)) {
- SetError(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_DISASM_ADDR_START_INVALID),
- m_cmdData.strMiCmd.c_str(), m_constStrArgAddrStart.c_str()));
- return MIstatus::failure;
- }
- MIint64 nAddrStart = 0;
- if (!strAddrStart.ExtractNumber(nAddrStart)) {
- SetError(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_DISASM_ADDR_START_INVALID),
- m_cmdData.strMiCmd.c_str(), m_constStrArgAddrStart.c_str()));
- return MIstatus::failure;
- }
-
- CMIUtilString strAddrEnd;
- if (!pArgAddrEnd->GetExpectedOption<CMICmdArgValString, CMIUtilString>(
- strAddrEnd)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_DISASM_ADDR_END_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgAddrEnd.c_str()));
- return MIstatus::failure;
- }
- MIint64 nAddrEnd = 0;
- if (!strAddrEnd.ExtractNumber(nAddrEnd)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_DISASM_ADDR_END_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgAddrEnd.c_str()));
- return MIstatus::failure;
- }
- const MIuint nDisasmMode = pArgMode->GetValue();
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
- lldb::addr_t lldbStartAddr = static_cast<lldb::addr_t>(nAddrStart);
- lldb::SBInstructionList instructions = sbTarget.ReadInstructions(
- lldb::SBAddress(lldbStartAddr, sbTarget), nAddrEnd - nAddrStart);
- const MIuint nInstructions = instructions.GetSize();
- // Calculate the offset of first instruction so that we can generate offset
- // starting at 0
- lldb::addr_t start_offset = 0;
- if (nInstructions > 0)
- start_offset =
- instructions.GetInstructionAtIndex(0).GetAddress().GetOffset();
-
- for (size_t i = 0; i < nInstructions; i++) {
- const char *pUnknown = "??";
- lldb::SBInstruction instrt = instructions.GetInstructionAtIndex(i);
- const char *pStrMnemonic = instrt.GetMnemonic(sbTarget);
- pStrMnemonic = (pStrMnemonic != nullptr) ? pStrMnemonic : pUnknown;
- const char *pStrComment = instrt.GetComment(sbTarget);
- CMIUtilString strComment;
- if (pStrComment != nullptr && *pStrComment != '\0')
- strComment = CMIUtilString::Format("; %s", pStrComment);
- lldb::SBAddress address = instrt.GetAddress();
- lldb::addr_t addr = address.GetLoadAddress(sbTarget);
- const char *pFnName = address.GetFunction().GetName();
- pFnName = (pFnName != nullptr) ? pFnName : pUnknown;
- lldb::addr_t addrOffSet = address.GetOffset() - start_offset;
- const char *pStrOperands = instrt.GetOperands(sbTarget);
- pStrOperands = (pStrOperands != nullptr) ? pStrOperands : pUnknown;
- const size_t instrtSize = instrt.GetByteSize();
-
- // MI "{address=\"0x%016" PRIx64
- // "\",func-name=\"%s\",offset=\"%lld\",inst=\"%s %s\"}"
- const CMICmnMIValueConst miValueConst(
- CMIUtilString::Format("0x%016" PRIx64, addr));
- const CMICmnMIValueResult miValueResult("address", miValueConst);
- CMICmnMIValueTuple miValueTuple(miValueResult);
- const CMICmnMIValueConst miValueConst2(pFnName);
- const CMICmnMIValueResult miValueResult2("func-name", miValueConst2);
- miValueTuple.Add(miValueResult2);
- const CMICmnMIValueConst miValueConst3(
- CMIUtilString::Format("%lld", addrOffSet));
- const CMICmnMIValueResult miValueResult3("offset", miValueConst3);
- miValueTuple.Add(miValueResult3);
- const CMICmnMIValueConst miValueConst4(
- CMIUtilString::Format("%d", instrtSize));
- const CMICmnMIValueResult miValueResult4("size", miValueConst4);
- miValueTuple.Add(miValueResult4);
- const CMICmnMIValueConst miValueConst5(
- CMIUtilString::Format("%s %s%s", pStrMnemonic, pStrOperands,
- strComment.Escape(true).c_str()));
- const CMICmnMIValueResult miValueResult5("inst", miValueConst5);
- miValueTuple.Add(miValueResult5);
-
- if (nDisasmMode == 1) {
- lldb::SBLineEntry lineEntry = address.GetLineEntry();
- const MIuint nLine = lineEntry.GetLine();
- const char *pFileName = lineEntry.GetFileSpec().GetFilename();
- pFileName = (pFileName != nullptr) ? pFileName : pUnknown;
- // Get a full path to the file.
- char pathBuffer[PATH_MAX];
- lineEntry.GetFileSpec().GetPath(pathBuffer, PATH_MAX);
-
- // MI "src_and_asm_line={line=\"%u\",file=\"%s\",line_asm_insn=[ ],
- // fullname=\"%s\"}"
- const CMICmnMIValueConst miValueConst(
- CMIUtilString::Format("%u", nLine));
- const CMICmnMIValueResult miValueResult("line", miValueConst);
- CMICmnMIValueTuple miValueTuple2(miValueResult);
- const CMICmnMIValueConst miValueConst2(pFileName);
- const CMICmnMIValueResult miValueResult2("file", miValueConst2);
- miValueTuple2.Add(miValueResult2);
- const CMICmnMIValueList miValueList(miValueTuple);
- const CMICmnMIValueResult miValueResult3("line_asm_insn", miValueList);
- miValueTuple2.Add(miValueResult3);
- const CMICmnMIValueConst miValueConst5(pathBuffer);
- const CMICmnMIValueResult miValueResult5("fullname", miValueConst5);
- miValueTuple2.Add(miValueResult5);
- const CMICmnMIValueResult miValueResult4("src_and_asm_line",
- miValueTuple2);
- m_miValueList.Add(miValueResult4);
- } else {
- m_miValueList.Add(miValueTuple);
- }
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataDisassemble::Acknowledge() {
- const CMICmnMIValueResult miValueResult("asm_insns", m_miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataDisassemble::CreateSelf() {
- return new CMICmdCmdDataDisassemble();
-}
-
-
-//++
-// Details: CMICmdCmdDataReadMemoryBytes constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataReadMemoryBytes::CMICmdCmdDataReadMemoryBytes()
- : m_constStrArgByteOffset("o"), m_constStrArgAddrExpr("address"),
- m_constStrArgNumBytes("count"), m_pBufferMemory(nullptr), m_nAddrStart(0),
- m_nAddrNumBytesToRead(0) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-read-memory-bytes";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataReadMemoryBytes::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataReadMemoryBytes destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataReadMemoryBytes::~CMICmdCmdDataReadMemoryBytes() {
- if (m_pBufferMemory != nullptr) {
- delete[] m_pBufferMemory;
- m_pBufferMemory = nullptr;
- }
-}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataReadMemoryBytes::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValOptionShort(m_constStrArgByteOffset, false, true,
- CMICmdArgValListBase::eArgValType_Number, 1));
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgAddrExpr, true, true, true, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumBytes, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataReadMemoryBytes::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
- CMICMDBASE_GETOPTION(pArgFrame, OptionLong, m_constStrArgFrame);
- CMICMDBASE_GETOPTION(pArgAddrOffset, OptionShort, m_constStrArgByteOffset);
- CMICMDBASE_GETOPTION(pArgAddrExpr, String, m_constStrArgAddrExpr);
- CMICMDBASE_GETOPTION(pArgNumBytes, Number, m_constStrArgNumBytes);
-
- // get the --thread option value
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- // get the --frame option value
- MIuint64 nFrame = UINT64_MAX;
- if (pArgFrame->GetFound() &&
- !pArgFrame->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nFrame)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgFrame.c_str()));
- return MIstatus::failure;
- }
-
- // get the -o option value
- MIuint64 nAddrOffset = 0;
- if (pArgAddrOffset->GetFound() &&
- !pArgAddrOffset->GetExpectedOption<CMICmdArgValNumber, MIuint64>(
- nAddrOffset)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgByteOffset.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- if (!sbProcess.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBThread thread = (nThreadId != UINT64_MAX)
- ? sbProcess.GetThreadByIndexID(nThreadId)
- : sbProcess.GetSelectedThread();
- if (!thread.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBFrame frame = (nFrame != UINT64_MAX) ? thread.GetFrameAtIndex(nFrame)
- : thread.GetSelectedFrame();
- if (!frame.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_FRAME_INVALID),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- const CMIUtilString &rAddrExpr = pArgAddrExpr->GetValue();
- lldb::SBValue addrExprValue = frame.EvaluateExpression(rAddrExpr.c_str());
- lldb::SBError error = addrExprValue.GetError();
- if (error.Fail()) {
- SetError(error.GetCString());
- return MIstatus::failure;
- } else if (!addrExprValue.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_EXPR_INVALID),
- rAddrExpr.c_str()));
- return MIstatus::failure;
- }
-
- MIuint64 nAddrStart = 0;
- if (!CMICmnLLDBProxySBValue::GetValueAsUnsigned(addrExprValue, nAddrStart)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_EXPR_INVALID),
- rAddrExpr.c_str()));
- return MIstatus::failure;
- }
-
- nAddrStart += nAddrOffset;
- const MIuint64 nAddrNumBytes = pArgNumBytes->GetValue();
-
- m_pBufferMemory = new unsigned char[nAddrNumBytes];
- if (m_pBufferMemory == nullptr) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_MEMORY_ALLOC_FAILURE),
- m_cmdData.strMiCmd.c_str(), nAddrNumBytes));
- return MIstatus::failure;
- }
-
- const MIuint64 nReadBytes =
- sbProcess.ReadMemory(static_cast<lldb::addr_t>(nAddrStart),
- (void *)m_pBufferMemory, nAddrNumBytes, error);
- if (nReadBytes != nAddrNumBytes) {
- SetError(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK),
- m_cmdData.strMiCmd.c_str(), nAddrNumBytes, nAddrStart));
- return MIstatus::failure;
- }
- if (error.Fail()) {
- lldb::SBStream err;
- const bool bOk = error.GetDescription(err);
- MIunused(bOk);
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES),
- m_cmdData.strMiCmd.c_str(), nAddrNumBytes,
- nAddrStart, err.GetData()));
- return MIstatus::failure;
- }
-
- m_nAddrStart = nAddrStart;
- m_nAddrNumBytesToRead = nAddrNumBytes;
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataReadMemoryBytes::Acknowledge() {
- // MI: memory=[{begin=\"0x%016" PRIx64 "\",offset=\"0x%016" PRIx64"
- // \",end=\"0x%016" PRIx64 "\",contents=\" \" }]"
- const CMICmnMIValueConst miValueConst(
- CMIUtilString::Format("0x%016" PRIx64, m_nAddrStart));
- const CMICmnMIValueResult miValueResult("begin", miValueConst);
- CMICmnMIValueTuple miValueTuple(miValueResult);
- const MIuint64 nAddrOffset = 0;
- const CMICmnMIValueConst miValueConst2(
- CMIUtilString::Format("0x%016" PRIx64, nAddrOffset));
- const CMICmnMIValueResult miValueResult2("offset", miValueConst2);
- miValueTuple.Add(miValueResult2);
- const CMICmnMIValueConst miValueConst3(CMIUtilString::Format(
- "0x%016" PRIx64, m_nAddrStart + m_nAddrNumBytesToRead));
- const CMICmnMIValueResult miValueResult3("end", miValueConst3);
- miValueTuple.Add(miValueResult3);
-
- // MI: contents=\" \"
- CMIUtilString strContent;
- strContent.reserve((m_nAddrNumBytesToRead << 1) + 1);
- for (MIuint64 i = 0; i < m_nAddrNumBytesToRead; i++) {
- strContent += CMIUtilString::Format("%02hhx", m_pBufferMemory[i]);
- }
- const CMICmnMIValueConst miValueConst4(strContent);
- const CMICmnMIValueResult miValueResult4("contents", miValueConst4);
- miValueTuple.Add(miValueResult4);
- const CMICmnMIValueList miValueList(miValueTuple);
- const CMICmnMIValueResult miValueResult5("memory", miValueList);
-
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult5);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataReadMemoryBytes::CreateSelf() {
- return new CMICmdCmdDataReadMemoryBytes();
-}
-
-
-//++
-// Details: CMICmdCmdDataReadMemory constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataReadMemory::CMICmdCmdDataReadMemory() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-read-memory";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataReadMemory::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataReadMemory destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataReadMemory::~CMICmdCmdDataReadMemory() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataReadMemory::Execute() {
- // Do nothing - command deprecated use "data-read-memory-bytes" command
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataReadMemory::Acknowledge() {
- // Command CMICmdCmdSupportListFeatures sends "data-read-memory-bytes" which
- // causes this command not to be called
- const CMICmnMIValueConst miValueConst(
- MIRSRC(IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataReadMemory::CreateSelf() {
- return new CMICmdCmdDataReadMemory();
-}
-
-
-//++
-// Details: CMICmdCmdDataListRegisterNames constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataListRegisterNames::CMICmdCmdDataListRegisterNames()
- : m_constStrArgRegNo("regno"), m_miValueList(true) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-list-register-names";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataListRegisterNames::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataReadMemoryBytes destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataListRegisterNames::~CMICmdCmdDataListRegisterNames() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataListRegisterNames::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValListOfN(m_constStrArgRegNo, false, false,
- CMICmdArgValListBase::eArgValType_Number));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataListRegisterNames::Execute() {
- CMICMDBASE_GETOPTION(pArgRegNo, ListOfN, m_constStrArgRegNo);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- if (!sbProcess.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- const CMICmdArgValListBase::VecArgObjPtr_t &rVecRegNo(
- pArgRegNo->GetExpectedOptions());
- if (!rVecRegNo.empty()) {
- // List of required registers
- CMICmdArgValListBase::VecArgObjPtr_t::const_iterator it = rVecRegNo.begin();
- while (it != rVecRegNo.end()) {
- const CMICmdArgValNumber *pRegNo = static_cast<CMICmdArgValNumber *>(*it);
- const MIuint nRegIndex = pRegNo->GetValue();
- lldb::SBValue regValue = GetRegister(nRegIndex);
- if (regValue.IsValid()) {
- const CMICmnMIValueConst miValueConst(
- CMICmnLLDBUtilSBValue(regValue).GetName());
- m_miValueList.Add(miValueConst);
- }
-
- // Next
- ++it;
- }
- } else {
- // List of all registers
- lldb::SBThread thread = sbProcess.GetSelectedThread();
- lldb::SBFrame frame = thread.GetSelectedFrame();
- lldb::SBValueList registers = frame.GetRegisters();
- const MIuint nRegisters = registers.GetSize();
- for (MIuint i = 0; i < nRegisters; i++) {
- lldb::SBValue value = registers.GetValueAtIndex(i);
- const MIuint nRegChildren = value.GetNumChildren();
- for (MIuint j = 0; j < nRegChildren; j++) {
- lldb::SBValue regValue = value.GetChildAtIndex(j);
- if (regValue.IsValid()) {
- const CMICmnMIValueConst miValueConst(
- CMICmnLLDBUtilSBValue(regValue).GetName());
- m_miValueList.Add(miValueConst);
- }
- }
- }
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataListRegisterNames::Acknowledge() {
- const CMICmnMIValueResult miValueResult("register-names", m_miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataListRegisterNames::CreateSelf() {
- return new CMICmdCmdDataListRegisterNames();
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Method.
-// Args: None.
-// Return: lldb::SBValue - LLDB SBValue object.
-// Throws: None.
-//--
-lldb::SBValue
-CMICmdCmdDataListRegisterNames::GetRegister(const MIuint vRegisterIndex) const {
- lldb::SBThread thread =
- CMICmnLLDBDebugSessionInfo::Instance().GetProcess().GetSelectedThread();
- lldb::SBFrame frame = thread.GetSelectedFrame();
- lldb::SBValueList registers = frame.GetRegisters();
- const MIuint nRegisters = registers.GetSize();
- MIuint nRegisterIndex(vRegisterIndex);
- for (MIuint i = 0; i < nRegisters; i++) {
- lldb::SBValue value = registers.GetValueAtIndex(i);
- const MIuint nRegChildren = value.GetNumChildren();
- if (nRegisterIndex >= nRegChildren) {
- nRegisterIndex -= nRegChildren;
- continue;
- }
-
- lldb::SBValue value2 = value.GetChildAtIndex(nRegisterIndex);
- if (value2.IsValid()) {
- return value2;
- }
- }
-
- return lldb::SBValue();
-}
-
-
-//++
-// Details: CMICmdCmdDataListRegisterValues constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataListRegisterValues::CMICmdCmdDataListRegisterValues()
- : m_constStrArgSkip("skip-unavailable"), m_constStrArgFormat("fmt"),
- m_constStrArgRegNo("regno"), m_miValueList(true) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-list-register-values";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataListRegisterValues::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataListRegisterValues destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataListRegisterValues::~CMICmdCmdDataListRegisterValues() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataListRegisterValues::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValOptionLong(m_constStrArgThread, false, false,
- CMICmdArgValListBase::eArgValType_Number, 1));
- m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgSkip, false, false));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgFormat, true, true));
- m_setCmdArgs.Add(
- new CMICmdArgValListOfN(m_constStrArgRegNo, false, true,
- CMICmdArgValListBase::eArgValType_Number));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataListRegisterValues::Execute() {
- CMICMDBASE_GETOPTION(pArgFormat, String, m_constStrArgFormat);
- CMICMDBASE_GETOPTION(pArgRegNo, ListOfN, m_constStrArgRegNo);
-
- const CMIUtilString &rStrFormat(pArgFormat->GetValue());
- if (rStrFormat.length() != 1) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_FORMAT_TYPE),
- m_cmdData.strMiCmd.c_str(),
- rStrFormat.c_str()));
- return MIstatus::failure;
- }
- const CMICmnLLDBDebugSessionInfoVarObj::varFormat_e eFormat =
- CMICmnLLDBDebugSessionInfoVarObj::GetVarFormatForChar(rStrFormat[0]);
- if (eFormat == CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Invalid) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_FORMAT_TYPE),
- m_cmdData.strMiCmd.c_str(),
- rStrFormat.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- if (!sbProcess.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- const CMICmdArgValListBase::VecArgObjPtr_t &rVecRegNo(
- pArgRegNo->GetExpectedOptions());
- if (!rVecRegNo.empty()) {
- // List of required registers
- CMICmdArgValListBase::VecArgObjPtr_t::const_iterator it = rVecRegNo.begin();
- while (it != rVecRegNo.end()) {
- const CMICmdArgValNumber *pRegNo = static_cast<CMICmdArgValNumber *>(*it);
- const MIuint nRegIndex = pRegNo->GetValue();
- lldb::SBValue regValue = GetRegister(nRegIndex);
- if (regValue.IsValid()) {
- AddToOutput(nRegIndex, regValue, eFormat);
- }
-
- // Next
- ++it;
- }
- } else {
- // No register numbers are provided. Output all registers.
- lldb::SBThread thread = sbProcess.GetSelectedThread();
- lldb::SBFrame frame = thread.GetSelectedFrame();
- lldb::SBValueList registers = frame.GetRegisters();
- const MIuint nRegisters = registers.GetSize();
- MIuint nRegIndex = 0;
- for (MIuint i = 0; i < nRegisters; i++) {
- lldb::SBValue value = registers.GetValueAtIndex(i);
- const MIuint nRegChildren = value.GetNumChildren();
- for (MIuint j = 0; j < nRegChildren; j++) {
- lldb::SBValue regValue = value.GetChildAtIndex(j);
- if (regValue.IsValid()) {
- AddToOutput(nRegIndex, regValue, eFormat);
- }
-
- // Next
- ++nRegIndex;
- }
- }
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataListRegisterValues::Acknowledge() {
- const CMICmnMIValueResult miValueResult("register-values", m_miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataListRegisterValues::CreateSelf() {
- return new CMICmdCmdDataListRegisterValues();
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Method.
-// Args: None.
-// Return: lldb::SBValue - LLDB SBValue object.
-// Throws: None.
-//--
-lldb::SBValue CMICmdCmdDataListRegisterValues::GetRegister(
- const MIuint vRegisterIndex) const {
- lldb::SBThread thread =
- CMICmnLLDBDebugSessionInfo::Instance().GetProcess().GetSelectedThread();
- lldb::SBFrame frame = thread.GetSelectedFrame();
- lldb::SBValueList registers = frame.GetRegisters();
- const MIuint nRegisters = registers.GetSize();
- MIuint nRegisterIndex(vRegisterIndex);
- for (MIuint i = 0; i < nRegisters; i++) {
- lldb::SBValue value = registers.GetValueAtIndex(i);
- const MIuint nRegChildren = value.GetNumChildren();
- if (nRegisterIndex >= nRegChildren) {
- nRegisterIndex -= nRegChildren;
- continue;
- }
-
- lldb::SBValue value2 = value.GetChildAtIndex(nRegisterIndex);
- if (value2.IsValid()) {
- return value2;
- }
- }
-
- return lldb::SBValue();
-}
-
-//++
-// Details: Adds the register value to the output list.
-// Type: Method.
-// Args: Value of the register, its index and output format.
-// Return: None
-// Throws: None.
-//--
-void CMICmdCmdDataListRegisterValues::AddToOutput(
- const MIuint vnIndex, const lldb::SBValue &vrValue,
- CMICmnLLDBDebugSessionInfoVarObj::varFormat_e veVarFormat) {
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%u", vnIndex));
- const CMICmnMIValueResult miValueResult("number", miValueConst);
- CMICmnMIValueTuple miValueTuple(miValueResult);
- const CMIUtilString strRegValue(
- CMICmnLLDBDebugSessionInfoVarObj::GetValueStringFormatted(vrValue,
- veVarFormat));
- const CMICmnMIValueConst miValueConst2(strRegValue);
- const CMICmnMIValueResult miValueResult2("value", miValueConst2);
- miValueTuple.Add(miValueResult2);
- m_miValueList.Add(miValueTuple);
-}
-
-
-//++
-// Details: CMICmdCmdDataListRegisterChanged constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataListRegisterChanged::CMICmdCmdDataListRegisterChanged() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-list-changed-registers";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataListRegisterChanged::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataListRegisterChanged destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataListRegisterChanged::~CMICmdCmdDataListRegisterChanged() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataListRegisterChanged::Execute() {
- // Do nothing
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataListRegisterChanged::Acknowledge() {
- const CMICmnMIValueConst miValueConst(MIRSRC(IDS_WORD_NOT_IMPLEMENTED));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataListRegisterChanged::CreateSelf() {
- return new CMICmdCmdDataListRegisterChanged();
-}
-
-
-//++
-// Details: CMICmdCmdDataWriteMemoryBytes constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataWriteMemoryBytes::CMICmdCmdDataWriteMemoryBytes()
- : m_constStrArgAddr("address"), m_constStrArgContents("contents"),
- m_constStrArgCount("count") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-write-memory-bytes";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataWriteMemoryBytes::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataWriteMemoryBytes destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataWriteMemoryBytes::~CMICmdCmdDataWriteMemoryBytes() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataWriteMemoryBytes::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgAddr, true, true, false, true));
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgContents, true, true, true, true));
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgCount, false, true, false, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataWriteMemoryBytes::Execute() {
- // Do nothing - not reproduceable (yet) in Eclipse
- // CMICMDBASE_GETOPTION( pArgOffset, OptionShort, m_constStrArgOffset );
- // CMICMDBASE_GETOPTION( pArgAddr, String, m_constStrArgAddr );
- // CMICMDBASE_GETOPTION( pArgNumber, String, m_constStrArgNumber );
- // CMICMDBASE_GETOPTION( pArgContents, String, m_constStrArgContents );
- //
- // Numbers extracts as string types as they could be hex numbers
- // '&' is not recognised and so has to be removed
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataWriteMemoryBytes::Acknowledge() {
- const CMICmnMIValueConst miValueConst(MIRSRC(IDS_WORD_NOT_IMPLEMENTED));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataWriteMemoryBytes::CreateSelf() {
- return new CMICmdCmdDataWriteMemoryBytes();
-}
-
-
-//++
-// Details: CMICmdCmdDataWriteMemory constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataWriteMemory::CMICmdCmdDataWriteMemory()
- : m_constStrArgOffset("o"), m_constStrArgAddr("address"),
- m_constStrArgD("d"), m_constStrArgNumber("a number"),
- m_constStrArgContents("contents"), m_nAddr(0), m_nCount(0),
- m_pBufferMemory(nullptr) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-write-memory";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataWriteMemory::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataWriteMemory destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataWriteMemory::~CMICmdCmdDataWriteMemory() {
- if (m_pBufferMemory != nullptr) {
- delete[] m_pBufferMemory;
- m_pBufferMemory = nullptr;
- }
-}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataWriteMemory::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValOptionShort(m_constStrArgOffset, false, true,
- CMICmdArgValListBase::eArgValType_Number, 1));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgAddr, true, true));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgD, true, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, true, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgContents, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataWriteMemory::Execute() {
- CMICMDBASE_GETOPTION(pArgOffset, OptionShort, m_constStrArgOffset);
- CMICMDBASE_GETOPTION(pArgAddr, Number, m_constStrArgAddr);
- CMICMDBASE_GETOPTION(pArgNumber, Number, m_constStrArgNumber);
- CMICMDBASE_GETOPTION(pArgContents, Number, m_constStrArgContents);
-
- MIuint nAddrOffset = 0;
- if (pArgOffset->GetFound() &&
- !pArgOffset->GetExpectedOption<CMICmdArgValNumber, MIuint>(nAddrOffset)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ARGS_ERR_VALIDATION_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgAddr.c_str()));
- return MIstatus::failure;
- }
- m_nAddr = pArgAddr->GetValue();
- m_nCount = pArgNumber->GetValue();
- const MIuint64 nValue = pArgContents->GetValue();
-
- m_pBufferMemory = new unsigned char[m_nCount];
- if (m_pBufferMemory == nullptr) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_MEMORY_ALLOC_FAILURE),
- m_cmdData.strMiCmd.c_str(), m_nCount));
- return MIstatus::failure;
- }
- *m_pBufferMemory = static_cast<char>(nValue);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBError error;
- lldb::addr_t addr = static_cast<lldb::addr_t>(m_nAddr + nAddrOffset);
- const size_t nBytesWritten = sbProcess.WriteMemory(
- addr, (const void *)m_pBufferMemory, (size_t)m_nCount, error);
- if (nBytesWritten != static_cast<size_t>(m_nCount)) {
- SetError(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK),
- m_cmdData.strMiCmd.c_str(), m_nCount, addr));
- return MIstatus::failure;
- }
- if (error.Fail()) {
- lldb::SBStream err;
- const bool bOk = error.GetDescription(err);
- MIunused(bOk);
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_LLDB_ERR_WRITE_MEM_BYTES),
- m_cmdData.strMiCmd.c_str(), m_nCount, addr,
- err.GetData()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataWriteMemory::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataWriteMemory::CreateSelf() {
- return new CMICmdCmdDataWriteMemory();
-}
-
-
-//++
-// Details: CMICmdCmdDataInfoLine constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataInfoLine::CMICmdCmdDataInfoLine()
- : m_constStrArgLocation("location"),
- m_resultRecord(m_cmdData.strMiCmdToken,
- CMICmnMIResultRecord::eResultClass_Done) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "data-info-line";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdDataInfoLine::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdDataInfoLine destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdDataInfoLine::~CMICmdCmdDataInfoLine() = default;
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataInfoLine::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgLocation, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataInfoLine::Execute() {
- CMICMDBASE_GETOPTION(pArgLocation, String, m_constStrArgLocation);
-
- lldb::SBLineEntry line;
- bool found_line = false;
- const CMIUtilString &strLocation(pArgLocation->GetValue());
- lldb::SBTarget target = CMICmnLLDBDebugSessionInfo::Instance().GetTarget();
-
- if (strLocation.at(0) == '*') {
- // Parse argument:
- // *0x12345
- // ^^^^^^^^^ -- address
- lldb::addr_t address = 0x0;
- if (llvm::StringRef(strLocation.substr(1)).getAsInteger(0, address)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SOME_ERROR),
- m_cmdData.strMiCmd.c_str(),
- "Failed to parse address."));
- return MIstatus::failure;
- }
- line = target.ResolveFileAddress(address).GetLineEntry();
- // Check that found line is valid.
- if (line.GetLine())
- found_line = true;
- } else {
- const size_t nLineStartPos = strLocation.rfind(':');
- if ((nLineStartPos == std::string::npos) || (nLineStartPos == 0) ||
- (nLineStartPos == strLocation.length() - 1)) {
- SetError(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_INVALID_LOCATION_FORMAT),
- m_cmdData.strMiCmd.c_str(), strLocation.c_str()));
- return MIstatus::failure;
- }
- // Parse argument:
- // hello.cpp:5
- // ^^^^^^^^^ -- file
- // ^ -- line
- const CMIUtilString &strFile(strLocation.substr(0, nLineStartPos));
- uint32_t numLine = 0;
- llvm::StringRef(strLocation.substr(nLineStartPos + 1))
- .getAsInteger(0, numLine);
- lldb::SBSymbolContextList sc_cu_list =
- target.FindCompileUnits(lldb::SBFileSpec(strFile.c_str(), false));
- for (uint32_t i = 0, e = sc_cu_list.GetSize(); i < e; ++i) {
- const lldb::SBCompileUnit &cu =
- sc_cu_list.GetContextAtIndex(i).GetCompileUnit();
- // Break if we have already found requested line.
- if (found_line)
- break;
- for (uint32_t j = 0, e = cu.GetNumLineEntries(); j < e; ++j) {
- const lldb::SBLineEntry &curLine = cu.GetLineEntryAtIndex(j);
- if (curLine.GetLine() == numLine) {
- line = curLine;
- found_line = true;
- break;
- }
- }
- }
- }
- if (!found_line) {
- SetError(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_SOME_ERROR), m_cmdData.strMiCmd.c_str(),
- "The LineEntry is absent or has an unknown format."));
- return MIstatus::failure;
- }
- // Start address.
- m_resultRecord.Add(CMICmnMIValueResult(
- "start", CMICmnMIValueConst(IntToHexAddrStr(
- line.GetStartAddress().GetFileAddress()))));
- // End address.
- m_resultRecord.Add(CMICmnMIValueResult(
- "end", CMICmnMIValueConst(IntToHexAddrStr(
- line.GetEndAddress().GetFileAddress()))));
- // File.
- std::unique_ptr<char[]> upPath(new char[PATH_MAX]);
- line.GetFileSpec().GetPath(upPath.get(), PATH_MAX);
- m_resultRecord.Add(CMICmnMIValueResult(
- "file", CMICmnMIValueConst(CMIUtilString(upPath.get()))));
- // Line.
- m_resultRecord.Add(CMICmnMIValueResult(
- "line", CMICmnMIValueConst(std::to_string(line.GetLine()))));
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdDataInfoLine::Acknowledge() {
- m_miResultRecord = m_resultRecord;
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdDataInfoLine::CreateSelf() {
- return new CMICmdCmdDataInfoLine();
-}
diff --git a/tools/lldb-mi/MICmdCmdData.h b/tools/lldb-mi/MICmdCmdData.h
deleted file mode 100644
index 19c5319faab3..000000000000
--- a/tools/lldb-mi/MICmdCmdData.h
+++ /dev/null
@@ -1,381 +0,0 @@
-//===-- MICmdCmdData.h ------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdDataEvaluateExpression interface.
-// CMICmdCmdDataDisassemble interface.
-// CMICmdCmdDataReadMemoryBytes interface.
-// CMICmdCmdDataReadMemory interface.
-// CMICmdCmdDataListRegisterNames interface.
-// CMICmdCmdDataListRegisterValues interface.
-// CMICmdCmdDataListRegisterChanged interface.
-// CMICmdCmdDataWriteMemoryBytes interface.
-// CMICmdCmdDataWriteMemory interface.
-// CMICmdCmdDataInfoLine interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-//
-
-#pragma once
-
-// Third party headers:
-#include "lldb/API/SBError.h"
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnLLDBDebugSessionInfoVarObj.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-#include "MICmnMIResultRecord.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-evaluate-expression".
-//--
-class CMICmdCmdDataEvaluateExpression : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataEvaluateExpression();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataEvaluateExpression() override;
-
- // Methods:
-private:
- bool HaveInvalidCharacterInExpression(const CMIUtilString &vrExpr,
- char &vrwInvalidChar);
-
- // Attributes:
-private:
- bool m_bExpressionValid; // True = yes is valid, false = not valid
- bool m_bEvaluatedExpression; // True = yes is expression evaluated, false =
- // failed
- lldb::SBError m_Error; // Status object, which is examined when
- // m_bEvaluatedExpression is false
- CMIUtilString m_strValue;
- CMICmnMIValueTuple m_miValueTuple;
- bool m_bFoundInvalidChar; // True = yes found unexpected character in the
- // expression, false = all ok
- char m_cExpressionInvalidChar;
- const CMIUtilString m_constStrArgExpr;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-disassemble".
-//--
-class CMICmdCmdDataDisassemble : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataDisassemble();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataDisassemble() override;
-
- // Attributes:
-private:
- const CMIUtilString
- m_constStrArgAddrStart; // MI spec non mandatory, *this command mandatory
- const CMIUtilString
- m_constStrArgAddrEnd; // MI spec non mandatory, *this command mandatory
- const CMIUtilString m_constStrArgMode;
- CMICmnMIValueList m_miValueList;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-read-memory-bytes".
-//--
-class CMICmdCmdDataReadMemoryBytes : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataReadMemoryBytes();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataReadMemoryBytes() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgByteOffset;
- const CMIUtilString m_constStrArgAddrExpr;
- const CMIUtilString m_constStrArgNumBytes;
- unsigned char *m_pBufferMemory;
- MIuint64 m_nAddrStart;
- MIuint64 m_nAddrNumBytesToRead;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-read-memory".
-//--
-class CMICmdCmdDataReadMemory : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataReadMemory();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataReadMemory() override;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-list-register-names".
-//--
-class CMICmdCmdDataListRegisterNames : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataListRegisterNames();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataListRegisterNames() override;
-
- // Methods:
-private:
- lldb::SBValue GetRegister(const MIuint vRegisterIndex) const;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgRegNo; // Not handled by *this command
- CMICmnMIValueList m_miValueList;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-list-register-values".
-//--
-class CMICmdCmdDataListRegisterValues : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataListRegisterValues();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataListRegisterValues() override;
-
- // Methods:
-private:
- lldb::SBValue GetRegister(const MIuint vRegisterIndex) const;
- void AddToOutput(const MIuint vnIndex, const lldb::SBValue &vrValue,
- CMICmnLLDBDebugSessionInfoVarObj::varFormat_e veVarFormat);
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgSkip; // Not handled by *this command
- const CMIUtilString m_constStrArgFormat;
- const CMIUtilString m_constStrArgRegNo;
- CMICmnMIValueList m_miValueList;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-list-changed-registers".
-//--
-class CMICmdCmdDataListRegisterChanged : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataListRegisterChanged();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataListRegisterChanged() override;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-read-memory-bytes".
-//--
-class CMICmdCmdDataWriteMemoryBytes : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataWriteMemoryBytes();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataWriteMemoryBytes() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgAddr;
- const CMIUtilString m_constStrArgContents;
- const CMIUtilString m_constStrArgCount;
- CMIUtilString m_strContents;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-read-memory".
-// Not specified in MI spec but Eclipse gives *this command.
-//--
-class CMICmdCmdDataWriteMemory : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataWriteMemory();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataWriteMemory() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgOffset; // Not specified in MI spec but
- // Eclipse gives this option.
- const CMIUtilString m_constStrArgAddr; // Not specified in MI spec but Eclipse
- // gives this option.
- const CMIUtilString
- m_constStrArgD; // Not specified in MI spec but Eclipse gives this option.
- const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but
- // Eclipse gives this option.
- const CMIUtilString m_constStrArgContents; // Not specified in MI spec but
- // Eclipse gives this option.
- MIuint64 m_nAddr;
- CMIUtilString m_strContents;
- MIuint64 m_nCount;
- unsigned char *m_pBufferMemory;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "data-info-line".
-// See MIExtensions.txt for details.
-//--
-class CMICmdCmdDataInfoLine : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdDataInfoLine();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdDataInfoLine() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgLocation;
- CMICmnMIResultRecord m_resultRecord;
-};
diff --git a/tools/lldb-mi/MICmdCmdEnviro.cpp b/tools/lldb-mi/MICmdCmdEnviro.cpp
deleted file mode 100644
index e7a92f3c9e89..000000000000
--- a/tools/lldb-mi/MICmdCmdEnviro.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-//===-- MICmdCmdEnviro.cpp --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdEnvironmentCd implementation.
-
-// In-house headers:
-#include "MICmdCmdEnviro.h"
-#include "MICmdArgValFile.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-//++
-// Details: CMICmdCmdEnvironmentCd constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdEnvironmentCd::CMICmdCmdEnvironmentCd()
- : m_constStrArgNamePathDir("pathdir") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "environment-cd";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdEnvironmentCd::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdEnvironmentCd destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdEnvironmentCd::~CMICmdCmdEnvironmentCd() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdEnvironmentCd::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValFile(m_constStrArgNamePathDir, true, true));
- CMICmdArgContext argCntxt(m_cmdData.strMiCmdOption);
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdEnvironmentCd::Execute() {
- CMICMDBASE_GETOPTION(pArgPathDir, File, m_constStrArgNamePathDir);
- const CMIUtilString &strWkDir(pArgPathDir->GetValue());
- CMICmnLLDBDebugger &rDbg(CMICmnLLDBDebugger::Instance());
- lldb::SBDebugger &rLldbDbg = rDbg.GetTheDebugger();
- bool bOk = rLldbDbg.SetCurrentPlatformSDKRoot(strWkDir.c_str());
- if (bOk) {
- const CMIUtilString &rStrKeyWkDir(
- m_rLLDBDebugSessionInfo.m_constStrSharedDataKeyWkDir);
- if (!m_rLLDBDebugSessionInfo.SharedDataAdd<CMIUtilString>(rStrKeyWkDir,
- strWkDir)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_ADD),
- m_cmdData.strMiCmd.c_str(),
- rStrKeyWkDir.c_str()));
- bOk = MIstatus::failure;
- }
- } else
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_FNFAILED),
- m_cmdData.strMiCmd.c_str(),
- "SetCurrentPlatformSDKRoot()"));
-
- lldb::SBTarget sbTarget = m_rLLDBDebugSessionInfo.GetTarget();
- if (sbTarget.IsValid()) {
- lldb::SBLaunchInfo sbLaunchInfo = sbTarget.GetLaunchInfo();
- sbLaunchInfo.SetWorkingDirectory(strWkDir.c_str());
- sbTarget.SetLaunchInfo(sbLaunchInfo);
- }
-
- return bOk;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdEnvironmentCd::Acknowledge() {
- const CMIUtilString &rStrKeyWkDir(
- m_rLLDBDebugSessionInfo.m_constStrSharedDataKeyWkDir);
- CMIUtilString strWkDir;
- const bool bOk = m_rLLDBDebugSessionInfo.SharedDataRetrieve<CMIUtilString>(
- rStrKeyWkDir, strWkDir);
- if (bOk) {
- const CMICmnMIValueConst miValueConst(strWkDir);
- const CMICmnMIValueResult miValueResult("path", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SHARED_DATA_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- rStrKeyWkDir.c_str()));
- return MIstatus::failure;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdEnvironmentCd::CreateSelf() {
- return new CMICmdCmdEnvironmentCd();
-}
diff --git a/tools/lldb-mi/MICmdCmdEnviro.h b/tools/lldb-mi/MICmdCmdEnviro.h
deleted file mode 100644
index 461ccd83a8f5..000000000000
--- a/tools/lldb-mi/MICmdCmdEnviro.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//===-- MICmdCmdEnviro.h ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdEnvironmentCd interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "environment-cd".
-//--
-class CMICmdCmdEnvironmentCd : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdEnvironmentCd();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdEnvironmentCd() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNamePathDir;
-};
diff --git a/tools/lldb-mi/MICmdCmdExec.cpp b/tools/lldb-mi/MICmdCmdExec.cpp
deleted file mode 100644
index ffdf171aef08..000000000000
--- a/tools/lldb-mi/MICmdCmdExec.cpp
+++ /dev/null
@@ -1,1115 +0,0 @@
-//===-- MICmdCmdExec.cpp ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdExecRun implementation.
-// CMICmdCmdExecContinue implementation.
-// CMICmdCmdExecNext implementation.
-// CMICmdCmdExecStep implementation.
-// CMICmdCmdExecNextInstruction implementation.
-// CMICmdCmdExecStepInstruction implementation.
-// CMICmdCmdExecFinish implementation.
-// CMICmdCmdExecInterrupt implementation.
-// CMICmdCmdExecArguments implementation.
-// CMICmdCmdExecAbort implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBCommandInterpreter.h"
-#include "lldb/API/SBProcess.h"
-#include "lldb/API/SBStream.h"
-#include "lldb/API/SBThread.h"
-#include "lldb/lldb-enumerations.h"
-
-// In-house headers:
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValString.h"
-#include "MICmdArgValThreadGrp.h"
-#include "MICmdCmdExec.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnMIOutOfBandRecord.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-#include "MICmnStreamStdout.h"
-#include "MIDriver.h"
-
-//++
-// Details: CMICmdCmdExecRun constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecRun::CMICmdCmdExecRun() : m_constStrArgStart("start") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-run";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecRun::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecRun destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecRun::~CMICmdCmdExecRun() {}
-
-//++
-// Details: The invoker requires this function. It parses the command line
-// options'
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecRun::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValOptionLong(
- m_constStrArgStart, false, true,
- CMICmdArgValListBase::eArgValType_OptionLong, 0));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecRun::Execute() {
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
-
- {
- // Check we have a valid target.
- // Note: target created via 'file-exec-and-symbols' command.
- lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
- if (!sbTarget.IsValid() ||
- sbTarget == rSessionInfo.GetDebugger().GetDummyTarget()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
- }
-
- lldb::SBError error;
- lldb::SBStream errMsg;
- lldb::SBLaunchInfo launchInfo = rSessionInfo.GetTarget().GetLaunchInfo();
- launchInfo.SetListener(rSessionInfo.GetListener());
-
- // Run to first instruction or main() requested?
- CMICMDBASE_GETOPTION(pArgStart, OptionLong, m_constStrArgStart);
- if (pArgStart->GetFound()) {
- launchInfo.SetLaunchFlags(launchInfo.GetLaunchFlags() |
- lldb::eLaunchFlagStopAtEntry);
- }
-
- lldb::SBProcess process = rSessionInfo.GetTarget().Launch(launchInfo, error);
- if (!process.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
- m_cmdData.strMiCmd.c_str(),
- errMsg.GetData()));
- return MIstatus::failure;
- }
-
- const auto successHandler = [this] {
- if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) {
- const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription());
- SetError(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE),
- m_cmdData.strMiCmd.c_str(), rErrMsg.c_str()));
- return MIstatus::failure;
- }
- return MIstatus::success;
- };
-
- return HandleSBErrorWithSuccess(error, successHandler);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Called only if Execute() set status as successful on completion.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecRun::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
- // Give the client '=thread-group-started,id="i1" pid="xyz"'
- m_bHasResultRecordExtra = true;
- const CMICmnMIValueConst miValueConst2("i1");
- const CMICmnMIValueResult miValueResult2("id", miValueConst2);
- const CMIUtilString strPid(CMIUtilString::Format("%lld", pid));
- const CMICmnMIValueConst miValueConst(strPid);
- const CMICmnMIValueResult miValueResult("pid", miValueConst);
- CMICmnMIOutOfBandRecord miOutOfBand(
- CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, miValueResult2);
- miOutOfBand.Add(miValueResult);
- m_miResultRecordExtra = miOutOfBand.GetString();
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecRun::CreateSelf() { return new CMICmdCmdExecRun(); }
-
-
-//++
-// Details: CMICmdCmdExecContinue constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecContinue::CMICmdCmdExecContinue() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-continue";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecContinue::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecContinue destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecContinue::~CMICmdCmdExecContinue() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecContinue::Execute() {
- const auto successHandler = [this] {
- // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
- if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) {
- const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription());
- SetError(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE),
- m_cmdData.strMiCmd.c_str(), rErrMsg.c_str()));
- return MIstatus::failure;
- }
- return MIstatus::success;
- };
-
- return HandleSBErrorWithSuccess(
- CMICmnLLDBDebugSessionInfo::Instance().GetProcess().Continue(),
- successHandler);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecContinue::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecContinue::CreateSelf() {
- return new CMICmdCmdExecContinue();
-}
-
-
-//++
-// Details: CMICmdCmdExecNext constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecNext::CMICmdCmdExecNext() : m_constStrArgNumber("number") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-next";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecNext::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecNext destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecNext::~CMICmdCmdExecNext() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecNext::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecNext::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
-
- lldb::SBError error;
- if (nThreadId != UINT64_MAX) {
- lldb::SBThread sbThread = rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId);
- if (!sbThread.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- sbThread.StepOver(lldb::eOnlyDuringStepping, error);
- } else
- rSessionInfo.GetProcess().GetSelectedThread().StepOver(
- lldb::eOnlyDuringStepping, error);
-
- return HandleSBError(error);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecNext::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecNext::CreateSelf() { return new CMICmdCmdExecNext(); }
-
-
-//++
-// Details: CMICmdCmdExecStep constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecStep::CMICmdCmdExecStep() : m_constStrArgNumber("number") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-step";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecStep::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecStep destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecStep::~CMICmdCmdExecStep() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecStep::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecStep::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
-
- lldb::SBError error;
- if (nThreadId != UINT64_MAX) {
- lldb::SBThread sbThread =
- rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId);
- if (!sbThread.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- sbThread.StepInto(nullptr, LLDB_INVALID_LINE_NUMBER, error);
- } else
- rSessionInfo.GetProcess().GetSelectedThread().StepInto(
- nullptr, LLDB_INVALID_LINE_NUMBER, error);
-
- return HandleSBError(error);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecStep::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecStep::CreateSelf() { return new CMICmdCmdExecStep(); }
-
-
-//++
-// Details: CMICmdCmdExecNextInstruction constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecNextInstruction::CMICmdCmdExecNextInstruction()
- : m_constStrArgNumber("number") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-next-instruction";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecNextInstruction::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecNextInstruction destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecNextInstruction::~CMICmdCmdExecNextInstruction() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecNextInstruction::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecNextInstruction::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
-
- lldb::SBError error;
- if (nThreadId != UINT64_MAX) {
- lldb::SBThread sbThread =
- rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId);
- if (!sbThread.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- sbThread.StepInstruction(true, error);
- } else
- rSessionInfo.GetProcess().GetSelectedThread().StepInstruction(
- true, error);
-
- return HandleSBError(error);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecNextInstruction::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecNextInstruction::CreateSelf() {
- return new CMICmdCmdExecNextInstruction();
-}
-
-
-//++
-// Details: CMICmdCmdExecStepInstruction constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecStepInstruction::CMICmdCmdExecStepInstruction()
- : m_constStrArgNumber("number") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-step-instruction";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecStepInstruction::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecStepInstruction destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecStepInstruction::~CMICmdCmdExecStepInstruction() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecStepInstruction::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecStepInstruction::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
-
- lldb::SBError error;
- if (nThreadId != UINT64_MAX) {
- lldb::SBThread sbThread =
- rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId);
- if (!sbThread.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- sbThread.StepInstruction(false, error);
- } else
- rSessionInfo.GetProcess().GetSelectedThread().StepInstruction(
- false, error);
-
- return HandleSBError(error);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecStepInstruction::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecStepInstruction::CreateSelf() {
- return new CMICmdCmdExecStepInstruction();
-}
-
-
-//++
-// Details: CMICmdCmdExecFinish constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecFinish::CMICmdCmdExecFinish() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-finish";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecFinish::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecFinish destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecFinish::~CMICmdCmdExecFinish() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecFinish::ParseArgs() { return ParseValidateCmdOptions(); }
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecFinish::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
-
- lldb::SBError error;
- if (nThreadId != UINT64_MAX) {
- lldb::SBThread sbThread =
- rSessionInfo.GetProcess().GetThreadByIndexID(nThreadId);
- if (!sbThread.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- sbThread.StepOut(error);
- } else
- rSessionInfo.GetProcess().GetSelectedThread().StepOut(error);
-
- return HandleSBError(error);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecFinish::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecFinish::CreateSelf() {
- return new CMICmdCmdExecFinish();
-}
-
-
-//++
-// Details: CMICmdCmdExecInterrupt constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecInterrupt::CMICmdCmdExecInterrupt() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-interrupt";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecInterrupt::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecInterrupt destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecInterrupt::~CMICmdCmdExecInterrupt() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecInterrupt::Execute() {
- const auto successHandler = [this] {
- // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
- if (!CMIDriver::Instance().SetDriverStateRunningNotDebugging()) {
- const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription());
- SetErrorDescription(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE),
- m_cmdData.strMiCmd.c_str(),
- rErrMsg.c_str()));
- return MIstatus::failure;
- }
- return MIstatus::success;
- };
-
- return HandleSBErrorWithSuccess(
- CMICmnLLDBDebugSessionInfo::Instance().GetProcess().Stop(),
- successHandler);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecInterrupt::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecInterrupt::CreateSelf() {
- return new CMICmdCmdExecInterrupt();
-}
-
-
-//++
-// Details: CMICmdCmdExecArguments constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecArguments::CMICmdCmdExecArguments()
- : m_constStrArgArguments("arguments") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-arguments";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecArguments::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecArguments destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecArguments::~CMICmdCmdExecArguments() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecArguments::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValListOfN(
- m_constStrArgArguments, false, true,
- CMICmdArgValListBase::eArgValType_StringAnything));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecArguments::Execute() {
- CMICMDBASE_GETOPTION(pArgArguments, ListOfN, m_constStrArgArguments);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
- if (!sbTarget.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBLaunchInfo sbLaunchInfo = sbTarget.GetLaunchInfo();
- sbLaunchInfo.SetArguments(nullptr, false);
-
- CMIUtilString strArg;
- size_t nArgIndex = 0;
- while (pArgArguments->GetExpectedOption<CMICmdArgValString, CMIUtilString>(
- strArg, nArgIndex)) {
- const char *argv[2] = {strArg.c_str(), nullptr};
- sbLaunchInfo.SetArguments(argv, true);
- ++nArgIndex;
- }
-
- sbTarget.SetLaunchInfo(sbLaunchInfo);
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecArguments::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecArguments::CreateSelf() {
- return new CMICmdCmdExecArguments();
-}
-
-
-//++
-// Details: CMICmdCmdExecAbort constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecAbort::CMICmdCmdExecAbort() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "exec-abort";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdExecAbort::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdExecAbort destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdExecAbort::~CMICmdCmdExecAbort() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecAbort::Execute() {
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- if (!sbProcess.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBError sbError = sbProcess.Destroy();
- if (sbError.Fail()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_LLDBPROCESS_DESTROY),
- m_cmdData.strMiCmd.c_str(),
- sbError.GetCString()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdExecAbort::Acknowledge() {
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdExecAbort::CreateSelf() {
- return new CMICmdCmdExecAbort();
-}
diff --git a/tools/lldb-mi/MICmdCmdExec.h b/tools/lldb-mi/MICmdCmdExec.h
deleted file mode 100644
index 8533915e24f8..000000000000
--- a/tools/lldb-mi/MICmdCmdExec.h
+++ /dev/null
@@ -1,316 +0,0 @@
-//===-- MICmdCmdExec.h ------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdExecRun interface.
-// CMICmdCmdExecContinue interface.
-// CMICmdCmdExecNext interface.
-// CMICmdCmdExecStep interface.
-// CMICmdCmdExecNextInstruction interface.
-// CMICmdCmdExecStepInstruction interface.
-// CMICmdCmdExecFinish interface.
-// CMICmdCmdExecInterrupt interface.
-// CMICmdCmdExecArguments interface.
-// CMICmdCmdExecAbort interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// Third party headers:
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-run".
-//--
-class CMICmdCmdExecRun : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecRun();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecRun() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgStart; // StopAtEntry - run to first
- // instruction or main() if specified
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-continue".
-//--
-class CMICmdCmdExecContinue : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecContinue();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecContinue() override;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-next".
-//--
-class CMICmdCmdExecNext : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecNext();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecNext() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but
- // Eclipse gives this option
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-step".
-//--
-class CMICmdCmdExecStep : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecStep();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecStep() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but
- // Eclipse gives this option
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-next-instruction".
-//--
-class CMICmdCmdExecNextInstruction : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecNextInstruction();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecNextInstruction() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but
- // Eclipse gives this option
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-step-instruction".
-//--
-class CMICmdCmdExecStepInstruction : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecStepInstruction();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecStepInstruction() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but
- // Eclipse gives this option
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-finish".
-//--
-class CMICmdCmdExecFinish : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecFinish();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecFinish() override;
-};
-
-// CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-interrupt".
-// Gotchas: Using Eclipse this command is injected into the command system when
-// a
-// SIGINT signal is received while running an inferior program.
-//--
-class CMICmdCmdExecInterrupt : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecInterrupt();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecInterrupt() override;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-arguments".
-//--
-class CMICmdCmdExecArguments : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecArguments();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecArguments() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgArguments;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "exec-abort".
-//--
-class CMICmdCmdExecAbort : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdExecAbort();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdExecAbort() override;
-};
diff --git a/tools/lldb-mi/MICmdCmdFile.cpp b/tools/lldb-mi/MICmdCmdFile.cpp
deleted file mode 100644
index 8b105eb1d58a..000000000000
--- a/tools/lldb-mi/MICmdCmdFile.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-//===-- MICmdCmdFile.cpp ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdFileExecAndSymbols implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBStream.h"
-
-// In-house headers:
-#include "MICmdArgValFile.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValString.h"
-#include "MICmdCmdFile.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnMIResultRecord.h"
-#include "MIUtilFileStd.h"
-
-//++
-// Details: CMICmdCmdFileExecAndSymbols constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdFileExecAndSymbols::CMICmdCmdFileExecAndSymbols()
- : m_constStrArgNameFile("file"), m_constStrArgNamedPlatformName("p"),
- m_constStrArgNamedRemotePath("r") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "file-exec-and-symbols";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdFileExecAndSymbols::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdFileExecAndSymbols destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdFileExecAndSymbols::~CMICmdCmdFileExecAndSymbols() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdFileExecAndSymbols::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValFile(m_constStrArgNameFile, true, true));
- m_setCmdArgs.Add(
- new CMICmdArgValOptionShort(m_constStrArgNamedPlatformName, false, true,
- CMICmdArgValListBase::eArgValType_String, 1));
- m_setCmdArgs.Add(new CMICmdArgValOptionShort(
- m_constStrArgNamedRemotePath, false, true,
- CMICmdArgValListBase::eArgValType_StringQuotedNumberPath, 1));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Synopsis: -file-exec-and-symbols file
-// Ref:
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-File-Commands.html#GDB_002fMI-File-Commands
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdFileExecAndSymbols::Execute() {
- CMICMDBASE_GETOPTION(pArgNamedFile, File, m_constStrArgNameFile);
- CMICMDBASE_GETOPTION(pArgPlatformName, OptionShort,
- m_constStrArgNamedPlatformName);
- CMICMDBASE_GETOPTION(pArgRemotePath, OptionShort,
- m_constStrArgNamedRemotePath);
- CMICmdArgValFile *pArgFile = static_cast<CMICmdArgValFile *>(pArgNamedFile);
- const CMIUtilString &strExeFilePath(pArgFile->GetValue());
- bool bPlatformName = pArgPlatformName->GetFound();
- CMIUtilString platformName;
- if (bPlatformName) {
- pArgPlatformName->GetExpectedOption<CMICmdArgValString, CMIUtilString>(
- platformName);
- }
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBDebugger &rDbgr = rSessionInfo.GetDebugger();
- lldb::SBError error;
- const char *pTargetTriple = nullptr; // Let LLDB discover the triple required
- const char *pTargetPlatformName = platformName.c_str();
- const bool bAddDepModules = false;
- lldb::SBTarget target =
- rDbgr.CreateTarget(strExeFilePath.c_str(), pTargetTriple,
- pTargetPlatformName, bAddDepModules, error);
- CMIUtilString strWkDir;
- const CMIUtilString &rStrKeyWkDir(rSessionInfo.m_constStrSharedDataKeyWkDir);
- if (!rSessionInfo.SharedDataRetrieve<CMIUtilString>(rStrKeyWkDir, strWkDir)) {
- strWkDir = CMIUtilFileStd::StripOffFileName(strExeFilePath);
- if (!rSessionInfo.SharedDataAdd<CMIUtilString>(rStrKeyWkDir, strWkDir)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_ADD),
- m_cmdData.strMiCmd.c_str(),
- rStrKeyWkDir.c_str()));
- return MIstatus::failure;
- }
- }
- if (!rDbgr.SetCurrentPlatformSDKRoot(strWkDir.c_str())) {
-
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_FNFAILED),
- m_cmdData.strMiCmd.c_str(),
- "SetCurrentPlatformSDKRoot()"));
- return MIstatus::failure;
- }
- if (pArgRemotePath->GetFound()) {
- CMIUtilString remotePath;
- pArgRemotePath->GetExpectedOption<CMICmdArgValString, CMIUtilString>(
- remotePath);
- lldb::SBModule module = target.FindModule(target.GetExecutable());
- if (module.IsValid()) {
- module.SetPlatformFileSpec(lldb::SBFileSpec(remotePath.c_str()));
- }
- }
- lldb::SBStream err;
- if (error.Fail()) {
- const bool bOk = error.GetDescription(err);
- MIunused(bOk);
- }
- if (!target.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET),
- m_cmdData.strMiCmd.c_str(),
- strExeFilePath.c_str(), err.GetData()));
- return MIstatus::failure;
- }
- if (error.Fail()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_CREATE_TARGET),
- m_cmdData.strMiCmd.c_str(), err.GetData()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdFileExecAndSymbols::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdFileExecAndSymbols::CreateSelf() {
- return new CMICmdCmdFileExecAndSymbols();
-}
-
-//++
-// Details: If the MI Driver is not operating via a client i.e. Eclipse but say
-// operating
-// on a executable passed in as a argument to the drive then what
-// should the driver
-// do on a command failing? Either continue operating or exit the
-// application.
-// Override this function where a command failure cannot allow the
-// driver to
-// continue operating.
-// Type: Overridden.
-// Args: None.
-// Return: bool - True = Fatal if command fails, false = can continue if
-// command fails.
-// Throws: None.
-//--
-bool CMICmdCmdFileExecAndSymbols::GetExitAppOnCommandFailure() const {
- return true;
-}
diff --git a/tools/lldb-mi/MICmdCmdFile.h b/tools/lldb-mi/MICmdCmdFile.h
deleted file mode 100644
index 4607f748cba5..000000000000
--- a/tools/lldb-mi/MICmdCmdFile.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===-- MICmdCmdFile.h ------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdFileExecAndSymbols interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "file-exec-and-symbols".
-// This command does not follow the MI documentation exactly.
-// Gotchas: This command has additional flags that were not available in GDB MI.
-// See MIextensions.txt for details.
-//--
-class CMICmdCmdFileExecAndSymbols : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdFileExecAndSymbols();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdFileExecAndSymbols() override;
- bool GetExitAppOnCommandFailure() const override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNameFile;
- const CMIUtilString
- m_constStrArgNamedPlatformName; // Added to support iOS platform selection
- const CMIUtilString m_constStrArgNamedRemotePath; // Added to support iOS
- // device remote file
- // location
-};
diff --git a/tools/lldb-mi/MICmdCmdGdbInfo.cpp b/tools/lldb-mi/MICmdCmdGdbInfo.cpp
deleted file mode 100644
index b351353ba1e9..000000000000
--- a/tools/lldb-mi/MICmdCmdGdbInfo.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-//===-- MICmdCmdGdbInfo.cpp -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbInfo implementation.
-
-// Third party headers:
-#include "lldb/API/SBCommandReturnObject.h"
-#include <inttypes.h>
-
-// In-house headers:
-#include "MICmdArgValString.h"
-#include "MICmdCmdGdbInfo.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-#include "MICmnStreamStdout.h"
-
-// Instantiations:
-const CMICmdCmdGdbInfo::MapPrintFnNameToPrintFn_t
- CMICmdCmdGdbInfo::ms_mapPrintFnNameToPrintFn = {
- {"sharedlibrary", &CMICmdCmdGdbInfo::PrintFnSharedLibrary}};
-
-//++
-// Details: CMICmdCmdGdbInfo constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbInfo::CMICmdCmdGdbInfo()
- : m_constStrArgNamedPrint("print"), m_bPrintFnRecognised(true),
- m_bPrintFnSuccessful(false),
- m_strPrintFnError(MIRSRC(IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS)) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "info";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdGdbInfo::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdGdbInfo destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbInfo::~CMICmdCmdGdbInfo() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbInfo::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedPrint, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbInfo::Execute() {
- CMICMDBASE_GETOPTION(pArgPrint, String, m_constStrArgNamedPrint);
- const CMIUtilString &rPrintRequest(pArgPrint->GetValue());
-
- FnPrintPtr pPrintRequestFn = nullptr;
- if (!GetPrintFn(rPrintRequest, pPrintRequestFn)) {
- m_strPrintFnName = rPrintRequest;
- m_bPrintFnRecognised = false;
- return MIstatus::success;
- }
-
- m_bPrintFnSuccessful = (this->*(pPrintRequestFn))();
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbInfo::Acknowledge() {
- if (!m_bPrintFnRecognised) {
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND), m_strPrintFnName.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- if (m_bPrintFnSuccessful) {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_INFO_PRINTFN_FAILED), m_strPrintFnError.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdGdbInfo::CreateSelf() { return new CMICmdCmdGdbInfo(); }
-
-//++
-// Details: Retrieve the print function's pointer for the matching print
-// request.
-// Type: Method.
-// Args: vrPrintFnName - (R) The info requested.
-// vrwpFn - (W) The print function's pointer of the function
-// to carry out
-// Return: bool - True = Print request is implemented, false = not found.
-// Throws: None.
-//--
-bool CMICmdCmdGdbInfo::GetPrintFn(const CMIUtilString &vrPrintFnName,
- FnPrintPtr &vrwpFn) const {
- vrwpFn = nullptr;
-
- const MapPrintFnNameToPrintFn_t::const_iterator it =
- ms_mapPrintFnNameToPrintFn.find(vrPrintFnName);
- if (it != ms_mapPrintFnNameToPrintFn.end()) {
- vrwpFn = (*it).second;
- return true;
- }
-
- return false;
-}
-
-//++
-// Details: Carry out work to complete the request to prepare and send back
-// information
-// asked for.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbInfo::PrintFnSharedLibrary() {
- bool bOk = CMICmnStreamStdout::TextToStdout(
- "~\"From To Syms Read Shared Object Library\"");
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
- const MIuint nModules = sbTarget.GetNumModules();
- for (MIuint i = 0; bOk && (i < nModules); i++) {
- lldb::SBModule module = sbTarget.GetModuleAtIndex(i);
- if (module.IsValid()) {
- const CMIUtilString strModuleFilePath(
- module.GetFileSpec().GetDirectory());
- const CMIUtilString strModuleFileName(module.GetFileSpec().GetFilename());
- const CMIUtilString strModuleFullPath(CMIUtilString::Format(
- "%s/%s", strModuleFilePath.c_str(), strModuleFileName.c_str()));
- const CMIUtilString strHasSymbols =
- (module.GetNumSymbols() > 0) ? "Yes" : "No";
- lldb::addr_t addrLoadS = 0xffffffffffffffff;
- lldb::addr_t addrLoadSize = 0;
- bool bHaveAddrLoad = false;
- const MIuint nSections = module.GetNumSections();
- for (MIuint j = 0; j < nSections; j++) {
- lldb::SBSection section = module.GetSectionAtIndex(j);
- lldb::addr_t addrLoad = section.GetLoadAddress(sbTarget);
- if (addrLoad != (lldb::addr_t)-1) {
- if (!bHaveAddrLoad) {
- bHaveAddrLoad = true;
- addrLoadS = addrLoad;
- }
-
- addrLoadSize += section.GetByteSize();
- }
- }
- bOk = bOk &&
- CMICmnStreamStdout::TextToStdout(CMIUtilString::Format(
- "~\"0x%016" PRIx64 "\t0x%016" PRIx64 "\t%s\t\t%s\"", addrLoadS,
- addrLoadS + addrLoadSize, strHasSymbols.c_str(),
- strModuleFullPath.c_str()));
- }
- }
-
- return bOk;
-}
diff --git a/tools/lldb-mi/MICmdCmdGdbInfo.h b/tools/lldb-mi/MICmdCmdGdbInfo.h
deleted file mode 100644
index 8ad69c49f59c..000000000000
--- a/tools/lldb-mi/MICmdCmdGdbInfo.h
+++ /dev/null
@@ -1,87 +0,0 @@
-//===-- MICmdCmdGdbInfo.h ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbInfo interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// Third party headers:
-#include <map>
-
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements GDB command "info".
-// The design of matching the info request to a request action (or
-// command) is very simple. The request function which carries out
-// the task of information gathering and printing to stdout is part of
-// *this class. Should the request function become more complicated
-// then
-// that request should really reside in a command type class. Then this
-// class instantiates a request info command for a matching request.
-// The
-// design/code of *this class then does not then become bloated. Use a
-// lightweight version of the current MI command system.
-//--
-class CMICmdCmdGdbInfo : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdGdbInfo();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdGdbInfo() override;
-
- // Typedefs:
-private:
- typedef bool (CMICmdCmdGdbInfo::*FnPrintPtr)();
- typedef std::map<CMIUtilString, FnPrintPtr> MapPrintFnNameToPrintFn_t;
-
- // Methods:
-private:
- bool GetPrintFn(const CMIUtilString &vrPrintFnName, FnPrintPtr &vrwpFn) const;
- bool PrintFnSharedLibrary();
-
- // Attributes:
-private:
- const static MapPrintFnNameToPrintFn_t ms_mapPrintFnNameToPrintFn;
- //
- const CMIUtilString m_constStrArgNamedPrint;
- bool m_bPrintFnRecognised; // True = This command has a function with a name
- // that matches the Print argument, false = not
- // found
- bool m_bPrintFnSuccessful; // True = The print function completed its task ok,
- // false = function failed for some reason
- CMIUtilString m_strPrintFnName;
- CMIUtilString m_strPrintFnError;
-};
diff --git a/tools/lldb-mi/MICmdCmdGdbSet.cpp b/tools/lldb-mi/MICmdCmdGdbSet.cpp
deleted file mode 100644
index 162e3d5a345d..000000000000
--- a/tools/lldb-mi/MICmdCmdGdbSet.cpp
+++ /dev/null
@@ -1,491 +0,0 @@
-//===-- MICmdCmdGdbSet.cpp --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbSet implementation.
-
-// In-house headers:
-#include "MICmdCmdGdbSet.h"
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValString.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-// Instantiations:
-const CMICmdCmdGdbSet::MapGdbOptionNameToFnGdbOptionPtr_t
- CMICmdCmdGdbSet::ms_mapGdbOptionNameToFnGdbOptionPtr = {
- {"target-async", &CMICmdCmdGdbSet::OptionFnTargetAsync},
- {"print", &CMICmdCmdGdbSet::OptionFnPrint},
- // { "auto-solib-add", &CMICmdCmdGdbSet::OptionFnAutoSolibAdd }, //
- // Example code if need to implement GDB set other options
- {"output-radix", &CMICmdCmdGdbSet::OptionFnOutputRadix},
- {"solib-search-path", &CMICmdCmdGdbSet::OptionFnSolibSearchPath},
- {"disassembly-flavor", &CMICmdCmdGdbSet::OptionFnDisassemblyFlavor},
- {"fallback", &CMICmdCmdGdbSet::OptionFnFallback},
- {"breakpoint", &CMICmdCmdGdbSet::OptionFnBreakpoint}};
-
-//++
-// Details: CMICmdCmdGdbSet constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbSet::CMICmdCmdGdbSet()
- : m_constStrArgNamedGdbOption("option"), m_bGdbOptionRecognised(true),
- m_bGdbOptionFnSuccessful(false), m_bGbbOptionFnHasError(false),
- m_strGdbOptionFnError(MIRSRC(IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS)) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "gdb-set";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdGdbSet::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdGdbSet destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbSet::~CMICmdCmdGdbSet() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValListOfN(
- m_constStrArgNamedGdbOption, true, true,
- CMICmdArgValListBase::eArgValType_StringAnything));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command is executed in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::Execute() {
- CMICMDBASE_GETOPTION(pArgGdbOption, ListOfN, m_constStrArgNamedGdbOption);
- const CMICmdArgValListBase::VecArgObjPtr_t &rVecWords(
- pArgGdbOption->GetExpectedOptions());
-
- // Get the gdb-set option to carry out. This option will be used as an action
- // which should be done. Further arguments will be used as parameters for it.
- CMICmdArgValListBase::VecArgObjPtr_t::const_iterator it = rVecWords.begin();
- const CMICmdArgValString *pOption =
- static_cast<const CMICmdArgValString *>(*it);
- const CMIUtilString strOption(pOption->GetValue());
- ++it;
-
- // Retrieve the parameter(s) for the option
- CMIUtilString::VecString_t vecWords;
- while (it != rVecWords.end()) {
- const CMICmdArgValString *pWord =
- static_cast<const CMICmdArgValString *>(*it);
- vecWords.push_back(pWord->GetValue());
-
- // Next
- ++it;
- }
-
- FnGdbOptionPtr pPrintRequestFn = nullptr;
- if (!GetOptionFn(strOption, pPrintRequestFn)) {
- // For unimplemented option handlers, fallback on a generic handler
- // ToDo: Remove this when ALL options have been implemented
- if (!GetOptionFn("fallback", pPrintRequestFn)) {
- m_bGdbOptionRecognised = false;
- m_strGdbOptionName = "fallback"; // This would be the strOption name
- return MIstatus::success;
- }
- }
-
- m_bGdbOptionFnSuccessful = (this->*(pPrintRequestFn))(vecWords);
- if (!m_bGdbOptionFnSuccessful && !m_bGbbOptionFnHasError)
- return MIstatus::failure;
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute() method.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::Acknowledge() {
- // Print error if option isn't recognized:
- // ^error,msg="The request '%s' was not recognized, not implemented"
- if (!m_bGdbOptionRecognised) {
- const CMICmnMIValueConst miValueConst(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND),
- m_strGdbOptionName.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // ^done,value="%s"
- if (m_bGdbOptionFnSuccessful) {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // Print error if request failed:
- // ^error,msg="The request '%s' failed.
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_INFO_PRINTFN_FAILED), m_strGdbOptionFnError.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdGdbSet::CreateSelf() { return new CMICmdCmdGdbSet(); }
-
-//++
-// Details: Retrieve the print function's pointer for the matching print
-// request.
-// Type: Method.
-// Args: vrPrintFnName - (R) The info requested.
-// vrwpFn - (W) The print function's pointer of the function
-// to carry out
-// Return: bool - True = Print request is implemented, false = not found.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::GetOptionFn(const CMIUtilString &vrPrintFnName,
- FnGdbOptionPtr &vrwpFn) const {
- vrwpFn = nullptr;
-
- const MapGdbOptionNameToFnGdbOptionPtr_t::const_iterator it =
- ms_mapGdbOptionNameToFnGdbOptionPtr.find(vrPrintFnName);
- if (it != ms_mapGdbOptionNameToFnGdbOptionPtr.end()) {
- vrwpFn = (*it).second;
- return true;
- }
-
- return false;
-}
-
-//++
-// Details: Carry out work to complete the GDB set option 'target-async' to
-// prepare
-// and send back information asked for.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::OptionFnTargetAsync(
- const CMIUtilString::VecString_t &vrWords) {
- bool bAsyncMode = false;
- bool bOk = true;
-
- if (vrWords.size() > 1)
- // Too many arguments.
- bOk = false;
- else if (vrWords.size() == 0)
- // If no arguments, default is "on".
- bAsyncMode = true;
- else if (CMIUtilString::Compare(vrWords[0], "on"))
- bAsyncMode = true;
- else if (CMIUtilString::Compare(vrWords[0], "off"))
- bAsyncMode = false;
- else
- // Unrecognized argument.
- bOk = false;
-
- if (!bOk) {
- // Report error.
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_TARGETASYNC);
- return MIstatus::failure;
- }
-
- // Turn async mode on/off.
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- rSessionInfo.GetDebugger().SetAsync(bAsyncMode);
-
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB set option
-// 'print-char-array-as-string' to
-// prepare and send back information asked for.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::OptionFnPrint(const CMIUtilString::VecString_t &vrWords) {
- const bool bAllArgs(vrWords.size() == 2);
- const bool bArgOn(bAllArgs && (CMIUtilString::Compare(vrWords[1], "on") ||
- CMIUtilString::Compare(vrWords[1], "1")));
- const bool bArgOff(bAllArgs && (CMIUtilString::Compare(vrWords[1], "off") ||
- CMIUtilString::Compare(vrWords[1], "0")));
- if (!bAllArgs || (!bArgOn && !bArgOff)) {
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_PRINT_BAD_ARGS);
- return MIstatus::failure;
- }
-
- const CMIUtilString strOption(vrWords[0]);
- CMIUtilString strOptionKey;
- if (CMIUtilString::Compare(strOption, "char-array-as-string"))
- strOptionKey = m_rLLDBDebugSessionInfo.m_constStrPrintCharArrayAsString;
- else if (CMIUtilString::Compare(strOption, "expand-aggregates"))
- strOptionKey = m_rLLDBDebugSessionInfo.m_constStrPrintExpandAggregates;
- else if (CMIUtilString::Compare(strOption, "aggregate-field-names"))
- strOptionKey = m_rLLDBDebugSessionInfo.m_constStrPrintAggregateFieldNames;
- else {
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_GDBSET_OPT_PRINT_UNKNOWN_OPTION), strOption.c_str());
- return MIstatus::failure;
- }
-
- const bool bOptionValue(bArgOn);
- if (!m_rLLDBDebugSessionInfo.SharedDataAdd<bool>(strOptionKey,
- bOptionValue)) {
- m_bGbbOptionFnHasError = false;
- SetError(CMIUtilString::Format(MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_ADD),
- m_cmdData.strMiCmd.c_str(),
- strOptionKey.c_str()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB set option 'solib-search-path' to
-// prepare
-// and send back information asked for.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::OptionFnSolibSearchPath(
- const CMIUtilString::VecString_t &vrWords) {
- // Check we have at least one argument
- if (vrWords.size() < 1) {
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH);
- return MIstatus::failure;
- }
- const CMIUtilString &rStrValSolibPath(vrWords[0]);
-
- // Add 'solib-search-path' to the shared data list
- const CMIUtilString &rStrKeySolibPath(
- m_rLLDBDebugSessionInfo.m_constStrSharedDataSolibPath);
- if (!m_rLLDBDebugSessionInfo.SharedDataAdd<CMIUtilString>(rStrKeySolibPath,
- rStrValSolibPath)) {
- m_bGbbOptionFnHasError = false;
- SetError(CMIUtilString::Format(MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_ADD),
- m_cmdData.strMiCmd.c_str(),
- rStrKeySolibPath.c_str()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB set option 'output-radix' to
-// prepare
-// and send back information asked for.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::OptionFnOutputRadix(
- const CMIUtilString::VecString_t &vrWords) {
- // Check we have at least one argument
- if (vrWords.size() < 1) {
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH);
- return MIstatus::failure;
- }
- const CMIUtilString &rStrValOutputRadix(vrWords[0]);
-
- CMICmnLLDBDebugSessionInfoVarObj::varFormat_e format =
- CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Invalid;
- MIint64 radix;
- if (rStrValOutputRadix.ExtractNumber(radix)) {
- switch (radix) {
- case 8:
- format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Octal;
- break;
- case 10:
- format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Natural;
- break;
- case 16:
- format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Hex;
- break;
- default:
- format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Invalid;
- break;
- }
- }
- if (format == CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Invalid) {
- m_bGbbOptionFnHasError = false;
- SetError(CMIUtilString::Format(MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_ADD),
- m_cmdData.strMiCmd.c_str(), "Output Radix"));
- return MIstatus::failure;
- }
- CMICmnLLDBDebugSessionInfoVarObj::VarObjSetFormat(format);
-
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB set option 'disassembly-flavor'
-// to prepare
-// and send back information asked for.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::OptionFnDisassemblyFlavor(
- const CMIUtilString::VecString_t &vrWords) {
- // Check we have at least one argument
- if (vrWords.size() < 1) {
- m_bGbbOptionFnHasError = true;
- // m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH);
- return MIstatus::failure;
- }
- const CMIUtilString &rStrValDisasmFlavor(vrWords[0]);
-
- lldb::SBDebugger &rDbgr = m_rLLDBDebugSessionInfo.GetDebugger();
- lldb::SBError error = lldb::SBDebugger::SetInternalVariable(
- "target.x86-disassembly-flavor", rStrValDisasmFlavor.c_str(),
- rDbgr.GetInstanceName());
- if (error.Fail()) {
- m_strGdbOptionFnError = error.GetCString();
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB set option 'breakpoint' to
-// prepare
-// and send back information asked for.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::OptionFnBreakpoint(
- const CMIUtilString::VecString_t &vrWords) {
- bool bPending = false;
- bool bOk = true;
-
- if (vrWords.size() != 2)
- // Wrong number of arguments.
- bOk = false;
- else if (CMIUtilString::Compare(vrWords[0], "pending") &&
- (CMIUtilString::Compare(vrWords[1], "on") ||
- CMIUtilString::Compare(vrWords[1], "1")))
- bPending = true;
- else if (CMIUtilString::Compare(vrWords[0], "pending") &&
- (CMIUtilString::Compare(vrWords[1], "off") ||
- CMIUtilString::Compare(vrWords[1], "0")))
- bPending = false;
- else
- // Unrecognized argument(s).
- bOk = false;
-
- if (!bOk) {
- // Report error.
- m_bGbbOptionFnHasError = false;
- SetError(MIRSRC(IDS_CMD_ERR_GDBSET_OPT_BREAKPOINT));
- return MIstatus::failure;
- }
-
- CMIUtilString sPendingVal = bPending ? "on" : "off";
- CMIUtilString sKey = "breakpoint.pending";
- if (!m_rLLDBDebugSessionInfo.SharedDataAdd(sKey, sPendingVal)) {
- m_bGbbOptionFnHasError = false;
- SetError(CMIUtilString::Format(MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_ADD),
- m_cmdData.strMiCmd.c_str(), sKey.c_str()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB set option to prepare and send
-// back the
-// requested information.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbSet::OptionFnFallback(
- const CMIUtilString::VecString_t &vrWords) {
- MIunused(vrWords);
-
- // Do nothing - intentional. This is a fallback function to do nothing.
- // This allows the search for gdb-set options to always succeed when the
- // option is not
- // found (implemented).
-
- return MIstatus::success;
-}
diff --git a/tools/lldb-mi/MICmdCmdGdbSet.h b/tools/lldb-mi/MICmdCmdGdbSet.h
deleted file mode 100644
index c88f9976ef65..000000000000
--- a/tools/lldb-mi/MICmdCmdGdbSet.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//===-- MICmdCmdGdbSet.h ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbSet interface.
-//
-// To implement new MI commands, derive a new command class from
-// the command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "gdb-set".
-// This command does not follow the MI documentation exactly. While
-// *this
-// command is implemented it does not do anything with the gdb-set
-// variable past in.
-// The design of matching the info request to a request action (or
-// command) is very simple. The request function which carries out
-// the task of information gathering and printing to stdout is part of
-// *this class. Should the request function become more complicated
-// then
-// that request should really reside in a command type class. Then this
-// class instantiates a request info command for a matching request.
-// The
-// design/code of *this class then does not then become bloated. Use a
-// lightweight version of the current MI command system.
-//--
-class CMICmdCmdGdbSet : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdGdbSet();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdGdbSet() override;
-
- // Typedefs:
-private:
- typedef bool (CMICmdCmdGdbSet::*FnGdbOptionPtr)(
- const CMIUtilString::VecString_t &vrWords);
- typedef std::map<CMIUtilString, FnGdbOptionPtr>
- MapGdbOptionNameToFnGdbOptionPtr_t;
-
- // Methods:
-private:
- bool GetOptionFn(const CMIUtilString &vrGdbOptionName,
- FnGdbOptionPtr &vrwpFn) const;
- bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnBreakpoint(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
-
- // Attributes:
-private:
- const static MapGdbOptionNameToFnGdbOptionPtr_t
- ms_mapGdbOptionNameToFnGdbOptionPtr;
- //
- const CMIUtilString m_constStrArgNamedGdbOption;
- bool m_bGdbOptionRecognised; // True = This command has a function with a name
- // that matches the Print argument, false = not
- // found
- bool m_bGdbOptionFnSuccessful; // True = The print function completed its task
- // ok, false = function failed for some reason
- bool m_bGbbOptionFnHasError; // True = The option function has an error
- // condition (not the command!), false = option
- // function ok.
- CMIUtilString m_strGdbOptionName;
- CMIUtilString m_strGdbOptionFnError;
-};
diff --git a/tools/lldb-mi/MICmdCmdGdbShow.cpp b/tools/lldb-mi/MICmdCmdGdbShow.cpp
deleted file mode 100644
index 9ebd36202b7d..000000000000
--- a/tools/lldb-mi/MICmdCmdGdbShow.cpp
+++ /dev/null
@@ -1,395 +0,0 @@
-//===-- MICmdCmdGdbShow.cpp -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbShow implementation.
-
-// Third party headers:
-#include "lldb/API/SBCompileUnit.h"
-#include "lldb/API/SBFrame.h"
-#include "lldb/API/SBLanguageRuntime.h"
-#include "lldb/API/SBStringList.h"
-#include "lldb/API/SBThread.h"
-
-// In-house headers:
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValString.h"
-#include "MICmdCmdGdbShow.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-// Instantiations:
-const CMICmdCmdGdbShow::MapGdbOptionNameToFnGdbOptionPtr_t
- CMICmdCmdGdbShow::ms_mapGdbOptionNameToFnGdbOptionPtr = {
- {"target-async", &CMICmdCmdGdbShow::OptionFnTargetAsync},
- {"print", &CMICmdCmdGdbShow::OptionFnPrint},
- {"language", &CMICmdCmdGdbShow::OptionFnLanguage},
- {"disassembly-flavor", &CMICmdCmdGdbShow::OptionFnDisassemblyFlavor},
- {"fallback", &CMICmdCmdGdbShow::OptionFnFallback},
- {"breakpoint", &CMICmdCmdGdbShow::OptionFnBreakpoint}};
-
-//++
-// Details: CMICmdCmdGdbShow constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbShow::CMICmdCmdGdbShow()
- : m_constStrArgNamedGdbOption("option"), m_bGdbOptionRecognised(true),
- m_bGdbOptionFnSuccessful(false), m_bGbbOptionFnHasError(false),
- m_strGdbOptionFnError(MIRSRC(IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS)) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "gdb-show";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdGdbShow::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdGdbShow destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbShow::~CMICmdCmdGdbShow() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValListOfN(
- m_constStrArgNamedGdbOption, true, true,
- CMICmdArgValListBase::eArgValType_StringAnything));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command is executed in this
-// function.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::Execute() {
- CMICMDBASE_GETOPTION(pArgGdbOption, ListOfN, m_constStrArgNamedGdbOption);
- const CMICmdArgValListBase::VecArgObjPtr_t &rVecWords(
- pArgGdbOption->GetExpectedOptions());
-
- // Get the gdb-show option to carry out. This option will be used as an action
- // which should be done. Further arguments will be used as parameters for it.
- CMICmdArgValListBase::VecArgObjPtr_t::const_iterator it = rVecWords.begin();
- const CMICmdArgValString *pOption =
- static_cast<const CMICmdArgValString *>(*it);
- const CMIUtilString strOption(pOption->GetValue());
- ++it;
-
- // Retrieve the parameter(s) for the option
- CMIUtilString::VecString_t vecWords;
- while (it != rVecWords.end()) {
- const CMICmdArgValString *pWord =
- static_cast<const CMICmdArgValString *>(*it);
- vecWords.push_back(pWord->GetValue());
-
- // Next
- ++it;
- }
-
- FnGdbOptionPtr pPrintRequestFn = nullptr;
- if (!GetOptionFn(strOption, pPrintRequestFn)) {
- // For unimplemented option handlers, fallback to a generic handler
- // ToDo: Remove this when ALL options have been implemented
- if (!GetOptionFn("fallback", pPrintRequestFn)) {
- m_bGdbOptionRecognised = false;
- m_strGdbOptionName = "fallback"; // This would be the strOption name
- return MIstatus::success;
- }
- }
-
- m_bGdbOptionFnSuccessful = (this->*(pPrintRequestFn))(vecWords);
- if (!m_bGdbOptionFnSuccessful && !m_bGbbOptionFnHasError)
- return MIstatus::failure;
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute() method.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::Acknowledge() {
- // Print error if option isn't recognized:
- // ^error,msg="The request '%s' was not recognized, not implemented"
- if (!m_bGdbOptionRecognised) {
- const CMICmnMIValueConst miValueConst(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND),
- m_strGdbOptionName.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // ^done,value="%s"
- if (m_bGdbOptionFnSuccessful && !m_strValue.empty()) {
- const CMICmnMIValueConst miValueConst(m_strValue);
- const CMICmnMIValueResult miValueResult("value", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- } else if (m_bGdbOptionFnSuccessful) {
- // Ignore empty value (for fallback)
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // Print error if request failed:
- // ^error,msg="The request '%s' failed.
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_INFO_PRINTFN_FAILED), m_strGdbOptionFnError.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdGdbShow::CreateSelf() { return new CMICmdCmdGdbShow(); }
-
-//++
-// Details: Retrieve the print function's pointer for the matching print
-// request.
-// Type: Method.
-// Args: vrPrintFnName - (R) The info requested.
-// vrwpFn - (W) The print function's pointer of the function
-// to carry out
-// Return: bool - True = Print request is implemented, false = not found.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::GetOptionFn(const CMIUtilString &vrPrintFnName,
- FnGdbOptionPtr &vrwpFn) const {
- vrwpFn = nullptr;
-
- const MapGdbOptionNameToFnGdbOptionPtr_t::const_iterator it =
- ms_mapGdbOptionNameToFnGdbOptionPtr.find(vrPrintFnName);
- if (it != ms_mapGdbOptionNameToFnGdbOptionPtr.end()) {
- vrwpFn = (*it).second;
- return true;
- }
-
- return false;
-}
-
-//++
-// Details: Carry out work to complete the GDB show option 'target-async' to
-// prepare
-// and send back the requested information.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::OptionFnTargetAsync(
- const CMIUtilString::VecString_t &vrWords) {
- MIunused(vrWords);
-
- // Get async mode
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- const bool bAsyncMode = rSessionInfo.GetDebugger().GetAsync();
-
- m_strValue = bAsyncMode ? "on" : "off";
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB show option 'print' to prepare
-// and send
-// back the requested information.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::OptionFnPrint(
- const CMIUtilString::VecString_t &vrWords) {
- const bool bAllArgs(vrWords.size() == 1);
- if (!bAllArgs) {
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSHOW_OPT_PRINT_BAD_ARGS);
- return MIstatus::failure;
- }
-
- const CMIUtilString strOption(vrWords[0]);
- CMIUtilString strOptionKey;
- bool bOptionValueDefault = false;
- if (CMIUtilString::Compare(strOption, "char-array-as-string"))
- strOptionKey = m_rLLDBDebugSessionInfo.m_constStrPrintCharArrayAsString;
- else if (CMIUtilString::Compare(strOption, "expand-aggregates"))
- strOptionKey = m_rLLDBDebugSessionInfo.m_constStrPrintExpandAggregates;
- else if (CMIUtilString::Compare(strOption, "aggregate-field-names")) {
- strOptionKey = m_rLLDBDebugSessionInfo.m_constStrPrintAggregateFieldNames;
- bOptionValueDefault = true;
- } else {
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_GDBSHOW_OPT_PRINT_UNKNOWN_OPTION),
- strOption.c_str());
- return MIstatus::failure;
- }
-
- bool bOptionValue = false;
- bOptionValue = bOptionValueDefault
- ? !m_rLLDBDebugSessionInfo.SharedDataRetrieve<bool>(
- strOptionKey, bOptionValue) ||
- bOptionValue
- : m_rLLDBDebugSessionInfo.SharedDataRetrieve<bool>(
- strOptionKey, bOptionValue) &&
- bOptionValue;
-
- m_strValue = bOptionValue ? "on" : "off";
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB show option 'language' to prepare
-// and send back the requested information.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::OptionFnLanguage(
- const CMIUtilString::VecString_t &vrWords) {
- MIunused(vrWords);
-
- // Get current language
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBThread sbThread = rSessionInfo.GetProcess().GetSelectedThread();
- const lldb::SBFrame sbFrame = sbThread.GetSelectedFrame();
- lldb::SBCompileUnit sbCompileUnit = sbFrame.GetCompileUnit();
- const lldb::LanguageType eLanguageType = sbCompileUnit.GetLanguage();
-
- m_strValue = lldb::SBLanguageRuntime::GetNameForLanguageType(eLanguageType);
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB show option 'disassembly-flavor' to prepare
-// and send back the requested information.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords) {
- MIunused(vrWords);
-
- // Get current disassembly flavor
- lldb::SBDebugger &rDbgr = m_rLLDBDebugSessionInfo.GetDebugger();
- m_strValue = lldb::SBDebugger::GetInternalVariableValue("target.x86-disassembly-flavor",
- rDbgr.GetInstanceName()).GetStringAtIndex(0);
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB show option 'breakpoint' to
-// prepare
-// and send back the requested information.
-// Type: Method.
-// Args: vrWords - (R) List of additional parameters used by this option.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::OptionFnBreakpoint(
- const CMIUtilString::VecString_t &vrWords) {
- if (vrWords.size() != 1) {
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSHOW_OPT_BREAKPOINT_BAD_ARGS);
- return MIstatus::failure;
- }
-
- const CMIUtilString strOption(vrWords[0]);
- if (!CMIUtilString::Compare(strOption, "pending")) {
- m_bGbbOptionFnHasError = true;
- m_strGdbOptionFnError = CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_GDBSHOW_OPT_BREAKPOINT_UNKNOWN_OPTION),
- strOption.c_str());
- return MIstatus::failure;
- }
-
- if (!m_rLLDBDebugSessionInfo.SharedDataRetrieve("breakpoint.pending",
- m_strValue)) {
- if (m_strValue.empty())
- m_strValue = "off";
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Carry out work to complete the GDB show option to prepare and send
-// back the
-// requested information.
-// Type: Method.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbShow::OptionFnFallback(
- const CMIUtilString::VecString_t &vrWords) {
- MIunused(vrWords);
-
- // Do nothing - intentional. This is a fallback function to do nothing.
- // This allows the search for gdb-show options to always succeed when the
- // option is not
- // found (implemented).
-
- return MIstatus::success;
-}
diff --git a/tools/lldb-mi/MICmdCmdGdbShow.h b/tools/lldb-mi/MICmdCmdGdbShow.h
deleted file mode 100644
index 9de034c617cd..000000000000
--- a/tools/lldb-mi/MICmdCmdGdbShow.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//===-- MICmdCmdGdbShow.h ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbShow interface.
-//
-// To implement new MI commands, derive a new command class from
-// the command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "gdb-show".
-// This command does not follow the MI documentation exactly. While
-// *this
-// command is implemented it does not do anything with the gdb-set
-// variable past in.
-// The design of matching the info request to a request action (or
-// command) is very simple. The request function which carries out
-// the task of information gathering and printing to stdout is part of
-// *this class. Should the request function become more complicated
-// then
-// that request should really reside in a command type class. Then this
-// class instantiates a request info command for a matching request.
-// The
-// design/code of *this class then does not then become bloated. Use a
-// lightweight version of the current MI command system.
-//--
-class CMICmdCmdGdbShow : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdGdbShow();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdGdbShow() override;
-
- // Typedefs:
-private:
- typedef bool (CMICmdCmdGdbShow::*FnGdbOptionPtr)(
- const CMIUtilString::VecString_t &vrWords);
- typedef std::map<CMIUtilString, FnGdbOptionPtr>
- MapGdbOptionNameToFnGdbOptionPtr_t;
-
- // Methods:
-private:
- bool GetOptionFn(const CMIUtilString &vrGdbOptionName,
- FnGdbOptionPtr &vrwpFn) const;
- bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnLanguage(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
- bool OptionFnBreakpoint(const CMIUtilString::VecString_t &vrWords);
-
- // Attributes:
-private:
- const static MapGdbOptionNameToFnGdbOptionPtr_t
- ms_mapGdbOptionNameToFnGdbOptionPtr;
-
- const CMIUtilString m_constStrArgNamedGdbOption;
- bool m_bGdbOptionRecognised; // True = This command has a function with a name
- // that matches the Print argument, false = not
- // found
- bool m_bGdbOptionFnSuccessful; // True = The print function completed its task
- // ok, false = function failed for some reason
- bool m_bGbbOptionFnHasError; // True = The option function has an error
- // condition (not the command!), false = option
- // function ok.
- CMIUtilString m_strGdbOptionName;
- CMIUtilString m_strGdbOptionFnError;
- CMIUtilString m_strValue;
-};
diff --git a/tools/lldb-mi/MICmdCmdGdbThread.cpp b/tools/lldb-mi/MICmdCmdGdbThread.cpp
deleted file mode 100644
index 132cf2c68ef8..000000000000
--- a/tools/lldb-mi/MICmdCmdGdbThread.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-//===-- MICmdCmdGdbThread.cpp -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbThread implementation.
-
-// In-house headers:
-#include "MICmdCmdGdbThread.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-//++
-// Details: CMICmdCmdGdbThread constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbThread::CMICmdCmdGdbThread() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "thread";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdGdbThread::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdThread destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbThread::~CMICmdCmdGdbThread() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbThread::Execute() {
- // Do nothing
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbThread::Acknowledge() {
- const CMICmnMIValueConst miValueConst(MIRSRC(IDS_WORD_NOT_IMPLEMENTED));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdGdbThread::CreateSelf() {
- return new CMICmdCmdGdbThread();
-}
diff --git a/tools/lldb-mi/MICmdCmdGdbThread.h b/tools/lldb-mi/MICmdCmdGdbThread.h
deleted file mode 100644
index 963001f01912..000000000000
--- a/tools/lldb-mi/MICmdCmdGdbThread.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//===-- MICmdCmdGdbThread.h -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbThread interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements GDB command "thread".
-//--
-class CMICmdCmdGdbThread : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdGdbThread();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdGdbThread() override;
-};
diff --git a/tools/lldb-mi/MICmdCmdMiscellanous.cpp b/tools/lldb-mi/MICmdCmdMiscellanous.cpp
deleted file mode 100644
index 5aa795999535..000000000000
--- a/tools/lldb-mi/MICmdCmdMiscellanous.cpp
+++ /dev/null
@@ -1,586 +0,0 @@
-//===-- MICmdCmdMiscellanous.cpp --------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbExit implementation.
-// CMICmdCmdListThreadGroups implementation.
-// CMICmdCmdInterpreterExec implementation.
-// CMICmdCmdInferiorTtySet implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBCommandInterpreter.h"
-#include "lldb/API/SBThread.h"
-
-// In-house headers:
-#include "MICmdArgValFile.h"
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValString.h"
-#include "MICmdArgValThreadGrp.h"
-#include "MICmdCmdMiscellanous.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnMIOutOfBandRecord.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-#include "MICmnStreamStderr.h"
-#include "MICmnStreamStdout.h"
-#include "MIDriverBase.h"
-
-//++
-// Details: CMICmdCmdGdbExit constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbExit::CMICmdCmdGdbExit() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "gdb-exit";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdGdbExit::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdGdbExit destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdGdbExit::~CMICmdCmdGdbExit() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbExit::Execute() {
- CMICmnLLDBDebugger::Instance().GetDriver().SetExitApplicationFlag(true);
- const lldb::SBError sbErr = m_rLLDBDebugSessionInfo.GetProcess().Destroy();
- // Do not check for sbErr.Fail() here, m_lldbProcess is likely !IsValid()
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdGdbExit::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Exit);
- m_miResultRecord = miRecordResult;
-
- // Prod the client i.e. Eclipse with out-of-band results to help it 'continue'
- // because it is using LLDB debugger
- // Give the client '=thread-group-exited,id="i1"'
- m_bHasResultRecordExtra = true;
- const CMICmnMIValueConst miValueConst2("i1");
- const CMICmnMIValueResult miValueResult2("id", miValueConst2);
- const CMICmnMIOutOfBandRecord miOutOfBand(
- CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupExited, miValueResult2);
- m_miResultRecordExtra = miOutOfBand.GetString();
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdGdbExit::CreateSelf() { return new CMICmdCmdGdbExit(); }
-
-
-//++
-// Details: CMICmdCmdListThreadGroups constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdListThreadGroups::CMICmdCmdListThreadGroups()
- : m_bIsI1(false), m_bHaveArgOption(false), m_bHaveArgRecurse(false),
- m_constStrArgNamedAvailable("available"),
- m_constStrArgNamedRecurse("recurse"), m_constStrArgNamedGroup("group"),
- m_constStrArgNamedThreadGroup("i1") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "list-thread-groups";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdListThreadGroups::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdListThreadGroups destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdListThreadGroups::~CMICmdCmdListThreadGroups() {
- m_vecMIValueTuple.clear();
-}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdListThreadGroups::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValOptionLong(m_constStrArgNamedAvailable, false, true));
- m_setCmdArgs.Add(
- new CMICmdArgValOptionLong(m_constStrArgNamedRecurse, false, true,
- CMICmdArgValListBase::eArgValType_Number, 1));
- m_setCmdArgs.Add(
- new CMICmdArgValListOfN(m_constStrArgNamedGroup, false, true,
- CMICmdArgValListBase::eArgValType_Number));
- m_setCmdArgs.Add(
- new CMICmdArgValThreadGrp(m_constStrArgNamedThreadGroup, false, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Synopsis: -list-thread-groups [ --available ] [ --recurse 1 ] [
-// group ... ]
-// This command does not follow the MI documentation exactly. Has an
-// extra
-// argument "i1" to handle.
-// Ref:
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Miscellaneous-Commands.html#GDB_002fMI-Miscellaneous-Commands
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdListThreadGroups::Execute() {
- if (m_setCmdArgs.IsArgContextEmpty())
- // No options so "top level thread groups"
- return MIstatus::success;
-
- CMICMDBASE_GETOPTION(pArgAvailable, OptionLong, m_constStrArgNamedAvailable);
- CMICMDBASE_GETOPTION(pArgRecurse, OptionLong, m_constStrArgNamedRecurse);
- CMICMDBASE_GETOPTION(pArgThreadGroup, ThreadGrp,
- m_constStrArgNamedThreadGroup);
-
- // Got some options so "threads"
- if (pArgAvailable->GetFound()) {
- if (pArgRecurse->GetFound()) {
- m_bHaveArgRecurse = true;
- return MIstatus::success;
- }
-
- m_bHaveArgOption = true;
- return MIstatus::success;
- }
- // "i1" as first argument (pos 0 of possible arg)
- if (!pArgThreadGroup->GetFound())
- return MIstatus::success;
- m_bIsI1 = true;
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
-
- // Note do not check for sbProcess is IsValid(), continue
-
- m_vecMIValueTuple.clear();
- const MIuint nThreads = sbProcess.GetNumThreads();
- for (MIuint i = 0; i < nThreads; i++) {
- // GetThreadAtIndex() uses a base 0 index
- // GetThreadByIndexID() uses a base 1 index
- lldb::SBThread thread = sbProcess.GetThreadAtIndex(i);
-
- if (thread.IsValid()) {
- CMICmnMIValueTuple miTuple;
- if (!rSessionInfo.MIResponseFormThreadInfo(
- m_cmdData, thread,
- CMICmnLLDBDebugSessionInfo::eThreadInfoFormat_NoFrames, miTuple))
- return MIstatus::failure;
-
- m_vecMIValueTuple.push_back(miTuple);
- }
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdListThreadGroups::Acknowledge() {
- if (m_bHaveArgOption) {
- if (m_bHaveArgRecurse) {
- const CMICmnMIValueConst miValueConst(
- MIRSRC(IDS_WORD_NOT_IMPLEMENTED_BRKTS));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
- }
-
- const CMICmnMIValueConst miValueConst1("i1");
- const CMICmnMIValueResult miValueResult1("id", miValueConst1);
- CMICmnMIValueTuple miTuple(miValueResult1);
-
- const CMICmnMIValueConst miValueConst2("process");
- const CMICmnMIValueResult miValueResult2("type", miValueConst2);
- miTuple.Add(miValueResult2);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- if (rSessionInfo.GetProcess().IsValid()) {
- const lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
- const CMIUtilString strPid(CMIUtilString::Format("%lld", pid));
- const CMICmnMIValueConst miValueConst3(strPid);
- const CMICmnMIValueResult miValueResult3("pid", miValueConst3);
- miTuple.Add(miValueResult3);
- }
-
- const CMICmnMIValueConst miValueConst4(
- MIRSRC(IDS_WORD_NOT_IMPLEMENTED_BRKTS));
- const CMICmnMIValueResult miValueResult4("num_children", miValueConst4);
- miTuple.Add(miValueResult4);
-
- const CMICmnMIValueConst miValueConst5(
- MIRSRC(IDS_WORD_NOT_IMPLEMENTED_BRKTS));
- const CMICmnMIValueResult miValueResult5("cores", miValueConst5);
- miTuple.Add(miValueResult5);
-
- const CMICmnMIValueList miValueList(miTuple);
- const CMICmnMIValueResult miValueResult6("groups", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult6);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
- }
-
- if (!m_bIsI1) {
- const CMICmnMIValueConst miValueConst1("i1");
- const CMICmnMIValueResult miValueResult1("id", miValueConst1);
- CMICmnMIValueTuple miTuple(miValueResult1);
-
- const CMICmnMIValueConst miValueConst2("process");
- const CMICmnMIValueResult miValueResult2("type", miValueConst2);
- miTuple.Add(miValueResult2);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- if (rSessionInfo.GetProcess().IsValid()) {
- const lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
- const CMIUtilString strPid(CMIUtilString::Format("%lld", pid));
- const CMICmnMIValueConst miValueConst3(strPid);
- const CMICmnMIValueResult miValueResult3("pid", miValueConst3);
- miTuple.Add(miValueResult3);
- }
-
- if (rSessionInfo.GetTarget().IsValid()) {
- lldb::SBTarget sbTrgt = rSessionInfo.GetTarget();
- const char *pDir = sbTrgt.GetExecutable().GetDirectory();
- const char *pFileName = sbTrgt.GetExecutable().GetFilename();
- const CMIUtilString strFile(
- CMIUtilString::Format("%s/%s",
- CMIUtilString::WithNullAsEmpty(pDir),
- CMIUtilString::WithNullAsEmpty(pFileName)));
- const CMICmnMIValueConst miValueConst4(strFile);
- const CMICmnMIValueResult miValueResult4("executable", miValueConst4);
- miTuple.Add(miValueResult4);
- }
-
- const CMICmnMIValueList miValueList(miTuple);
- const CMICmnMIValueResult miValueResult5("groups", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult5);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // Build up a list of thread information from tuples
- VecMIValueTuple_t::const_iterator it = m_vecMIValueTuple.begin();
- if (it == m_vecMIValueTuple.end()) {
- const CMICmnMIValueConst miValueConst("[]");
- const CMICmnMIValueResult miValueResult("threads", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
- CMICmnMIValueList miValueList(*it);
- ++it;
- while (it != m_vecMIValueTuple.end()) {
- const CMICmnMIValueTuple &rTuple(*it);
- miValueList.Add(rTuple);
-
- // Next
- ++it;
- }
-
- const CMICmnMIValueResult miValueResult("threads", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdListThreadGroups::CreateSelf() {
- return new CMICmdCmdListThreadGroups();
-}
-
-
-//++
-// Details: CMICmdCmdInterpreterExec constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdInterpreterExec::CMICmdCmdInterpreterExec()
- : m_constStrArgNamedInterpreter("interpreter"),
- m_constStrArgNamedCommand("command") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "interpreter-exec";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdInterpreterExec::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdInterpreterExec destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdInterpreterExec::~CMICmdCmdInterpreterExec() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdInterpreterExec::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgNamedInterpreter, true, true));
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgNamedCommand, true, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdInterpreterExec::Execute() {
- CMICMDBASE_GETOPTION(pArgInterpreter, String, m_constStrArgNamedInterpreter);
- CMICMDBASE_GETOPTION(pArgCommand, String, m_constStrArgNamedCommand);
-
- // Handle the interpreter parameter by do nothing on purpose (set to 'handled'
- // in the arg definition above)
- const CMIUtilString &rStrInterpreter(pArgInterpreter->GetValue());
- MIunused(rStrInterpreter);
-
- const CMIUtilString &rStrCommand(pArgCommand->GetValue());
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- const lldb::ReturnStatus rtn =
- rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(
- rStrCommand.c_str(), m_lldbResult, true);
- MIunused(rtn);
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdInterpreterExec::Acknowledge() {
- if (m_lldbResult.GetOutputSize() > 0) {
- const CMIUtilString line(m_lldbResult.GetOutput());
- const bool bEscapeQuotes(true);
- CMICmnMIValueConst miValueConst(line.Escape(bEscapeQuotes));
- CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_ConsoleStreamOutput, miValueConst);
- const bool bOk = CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
- if (!bOk)
- return MIstatus::failure;
- }
- if (m_lldbResult.GetErrorSize() > 0) {
- const CMIUtilString line(m_lldbResult.GetError());
- const bool bEscapeQuotes(true);
- CMICmnMIValueConst miValueConst(line.Escape(bEscapeQuotes));
- CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_LogStreamOutput, miValueConst);
- const bool bOk = CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
- if (!bOk)
- return MIstatus::failure;
- }
-
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdInterpreterExec::CreateSelf() {
- return new CMICmdCmdInterpreterExec();
-}
-
-
-//++
-// Details: CMICmdCmdInferiorTtySet constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdInferiorTtySet::CMICmdCmdInferiorTtySet() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "inferior-tty-set";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdInferiorTtySet::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdInferiorTtySet destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdInferiorTtySet::~CMICmdCmdInferiorTtySet() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdInferiorTtySet::Execute() {
- // Do nothing
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdInferiorTtySet::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdInferiorTtySet::CreateSelf() {
- return new CMICmdCmdInferiorTtySet();
-}
diff --git a/tools/lldb-mi/MICmdCmdMiscellanous.h b/tools/lldb-mi/MICmdCmdMiscellanous.h
deleted file mode 100644
index 614638e59345..000000000000
--- a/tools/lldb-mi/MICmdCmdMiscellanous.h
+++ /dev/null
@@ -1,156 +0,0 @@
-//===-- MICmdCmdMiscellanous.h ----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdGdbExit interface.
-// CMICmdCmdListThreadGroups interface.
-// CMICmdCmdInterpreterExec interface.
-// CMICmdCmdInferiorTtySet interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// Third party headers:
-#include "lldb/API/SBCommandReturnObject.h"
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "gdb-exit".
-//--
-class CMICmdCmdGdbExit : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdGdbExit();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdGdbExit() override;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "list-thread-groups".
-// This command does not follow the MI documentation exactly.
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Miscellaneous-Commands.html#GDB_002fMI-Miscellaneous-Commands
-//--
-class CMICmdCmdListThreadGroups : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdListThreadGroups();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdListThreadGroups() override;
-
- // Typedefs:
-private:
- typedef std::vector<CMICmnMIValueTuple> VecMIValueTuple_t;
-
- // Attributes:
-private:
- bool m_bIsI1; // True = Yes command argument equal "i1", false = no match
- bool m_bHaveArgOption; // True = Yes "--available" present, false = not found
- bool m_bHaveArgRecurse; // True = Yes command argument "--recurse", false = no
- // found
- VecMIValueTuple_t m_vecMIValueTuple;
- const CMIUtilString m_constStrArgNamedAvailable;
- const CMIUtilString m_constStrArgNamedRecurse;
- const CMIUtilString m_constStrArgNamedGroup;
- const CMIUtilString m_constStrArgNamedThreadGroup;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "interpreter-exec".
-//--
-class CMICmdCmdInterpreterExec : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdInterpreterExec();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdInterpreterExec() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNamedInterpreter;
- const CMIUtilString m_constStrArgNamedCommand;
- lldb::SBCommandReturnObject m_lldbResult;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "inferior-tty-set".
-//--
-class CMICmdCmdInferiorTtySet : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdInferiorTtySet();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdInferiorTtySet() override;
-};
diff --git a/tools/lldb-mi/MICmdCmdStack.cpp b/tools/lldb-mi/MICmdCmdStack.cpp
deleted file mode 100644
index 599db37417f5..000000000000
--- a/tools/lldb-mi/MICmdCmdStack.cpp
+++ /dev/null
@@ -1,1053 +0,0 @@
-//===-- MICmdCmdStack.cpp ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdStackInfoDepth implementation.
-// CMICmdCmdStackInfoFrame implementation.
-// CMICmdCmdStackListFrames implementation.
-// CMICmdCmdStackListArguments implementation.
-// CMICmdCmdStackListLocals implementation.
-// CMICmdCmdStackSelectFrame implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBThread.h"
-
-// In-house headers:
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValPrintValues.h"
-#include "MICmdArgValString.h"
-#include "MICmdArgValThreadGrp.h"
-#include "MICmdCmdStack.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnMIOutOfBandRecord.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-#include <algorithm>
-
-//++
-// Details: CMICmdCmdStackInfoDepth constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackInfoDepth::CMICmdCmdStackInfoDepth()
- : m_nThreadFrames(0), m_constStrArgMaxDepth("max-depth") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "stack-info-depth";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdStackInfoDepth::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdStackInfoDepth destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackInfoDepth::~CMICmdCmdStackInfoDepth() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackInfoDepth::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgMaxDepth, false, false));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackInfoDepth::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
- CMICMDBASE_GETOPTION(pArgMaxDepth, Number, m_constStrArgMaxDepth);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBThread thread = (nThreadId != UINT64_MAX)
- ? sbProcess.GetThreadByIndexID(nThreadId)
- : sbProcess.GetSelectedThread();
- m_nThreadFrames = thread.GetNumFrames();
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackInfoDepth::Acknowledge() {
- const CMIUtilString strDepth(CMIUtilString::Format("%d", m_nThreadFrames));
- const CMICmnMIValueConst miValueConst(strDepth);
- const CMICmnMIValueResult miValueResult("depth", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdStackInfoDepth::CreateSelf() {
- return new CMICmdCmdStackInfoDepth();
-}
-
-
-//++
-// Details: CMICmdCmdStackInfoFrame constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackInfoFrame::CMICmdCmdStackInfoFrame() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "stack-info-frame";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdStackInfoFrame::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdStackInfoFrame destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackInfoFrame::~CMICmdCmdStackInfoFrame() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackInfoFrame::ParseArgs() { return ParseValidateCmdOptions(); }
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackInfoFrame::Execute() {
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- if (!sbProcess.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBThread sbThread = sbProcess.GetSelectedThread();
- MIuint nFrameId = sbThread.GetSelectedFrame().GetFrameID();
- if (!rSessionInfo.MIResponseFormFrameInfo(
- sbThread, nFrameId,
- CMICmnLLDBDebugSessionInfo::eFrameInfoFormat_NoArguments,
- m_miValueTuple))
- return MIstatus::failure;
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackInfoFrame::Acknowledge() {
- const CMICmnMIValueResult miValueResult("frame", m_miValueTuple);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdStackInfoFrame::CreateSelf() {
- return new CMICmdCmdStackInfoFrame();
-}
-
-
-//++
-// Details: CMICmdCmdStackListFrames constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackListFrames::CMICmdCmdStackListFrames()
- : m_nThreadFrames(0), m_constStrArgFrameLow("low-frame"),
- m_constStrArgFrameHigh("high-frame") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "stack-list-frames";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdStackListFrames::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdStackListFrames destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackListFrames::~CMICmdCmdStackListFrames() {
- m_vecMIValueResult.clear();
-}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListFrames::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrameLow, false, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrameHigh, false, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListFrames::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
- CMICMDBASE_GETOPTION(pArgFrameLow, Number, m_constStrArgFrameLow);
- CMICMDBASE_GETOPTION(pArgFrameHigh, Number, m_constStrArgFrameHigh);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- // Frame low and high options are not mandatory
- MIuint nFrameHigh =
- pArgFrameHigh->GetFound() ? pArgFrameHigh->GetValue() : UINT32_MAX;
- const MIuint nFrameLow =
- pArgFrameLow->GetFound() ? pArgFrameLow->GetValue() : 0;
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBThread thread = (nThreadId != UINT64_MAX)
- ? sbProcess.GetThreadByIndexID(nThreadId)
- : sbProcess.GetSelectedThread();
- MIuint nThreadFrames = thread.GetNumFrames();
-
- // Adjust nThreadFrames for the nFrameHigh argument as we use nFrameHigh+1 in
- // the min calc as the arg
- // is not an index, but a frame id value.
- if (nFrameHigh < UINT32_MAX) {
- nFrameHigh++;
- nThreadFrames = (nFrameHigh < nThreadFrames) ? nFrameHigh : nThreadFrames;
- }
-
- m_nThreadFrames = nThreadFrames;
- if (nThreadFrames == 0)
- return MIstatus::success;
-
- m_vecMIValueResult.clear();
- for (MIuint nLevel = nFrameLow; nLevel < nThreadFrames; nLevel++) {
- CMICmnMIValueTuple miValueTuple;
- if (!rSessionInfo.MIResponseFormFrameInfo(
- thread, nLevel,
- CMICmnLLDBDebugSessionInfo::eFrameInfoFormat_NoArguments,
- miValueTuple))
- return MIstatus::failure;
-
- const CMICmnMIValueResult miValueResult8("frame", miValueTuple);
- m_vecMIValueResult.push_back(miValueResult8);
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListFrames::Acknowledge() {
- if (m_nThreadFrames == 0) {
- // MI print "3^done,stack=[{}]"
- const CMICmnMIValueTuple miValueTuple;
- const CMICmnMIValueList miValueList(miValueTuple);
- const CMICmnMIValueResult miValueResult("stack", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
- }
-
- // Build up a list of thread information from tuples
- VecMIValueResult_t::const_iterator it = m_vecMIValueResult.begin();
- if (it == m_vecMIValueResult.end()) {
- // MI print "3^done,stack=[{}]"
- const CMICmnMIValueTuple miValueTuple;
- const CMICmnMIValueList miValueList(miValueTuple);
- const CMICmnMIValueResult miValueResult("stack", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
- CMICmnMIValueList miValueList(*it);
- ++it;
- while (it != m_vecMIValueResult.end()) {
- const CMICmnMIValueResult &rTuple(*it);
- miValueList.Add(rTuple);
-
- // Next
- ++it;
- }
- const CMICmnMIValueResult miValueResult("stack", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdStackListFrames::CreateSelf() {
- return new CMICmdCmdStackListFrames();
-}
-
-
-//++
-// Details: CMICmdCmdStackListArguments constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackListArguments::CMICmdCmdStackListArguments()
- : m_bThreadInvalid(false), m_miValueList(true),
- m_constStrArgPrintValues("print-values"),
- m_constStrArgFrameLow("low-frame"), m_constStrArgFrameHigh("high-frame") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "stack-list-arguments";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdStackListArguments::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdStackListArguments destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackListArguments::~CMICmdCmdStackListArguments() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListArguments::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValPrintValues(m_constStrArgPrintValues, true, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrameLow, false, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrameHigh, false, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListArguments::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
- CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues, m_constStrArgPrintValues);
- CMICMDBASE_GETOPTION(pArgFrameLow, Number, m_constStrArgFrameLow);
- CMICMDBASE_GETOPTION(pArgFrameHigh, Number, m_constStrArgFrameHigh);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound()) {
- if (!pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(
- nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- }
-
- const CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat =
- static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(
- pArgPrintValues->GetValue());
-
- MIuint nFrameLow = 0;
- MIuint nFrameHigh = UINT32_MAX;
- if (pArgFrameLow->GetFound() && pArgFrameHigh->GetFound()) {
- nFrameLow = pArgFrameLow->GetValue();
- nFrameHigh = pArgFrameHigh->GetValue() + 1;
- } else if (pArgFrameLow->GetFound() || pArgFrameHigh->GetFound()) {
- // Only low-frame or high-frame was specified but both are required
- SetError(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBThread thread = (nThreadId != UINT64_MAX)
- ? sbProcess.GetThreadByIndexID(nThreadId)
- : sbProcess.GetSelectedThread();
- m_bThreadInvalid = !thread.IsValid();
- if (m_bThreadInvalid)
- return MIstatus::success;
-
- const lldb::StopReason eStopReason = thread.GetStopReason();
- if ((eStopReason == lldb::eStopReasonNone) ||
- (eStopReason == lldb::eStopReasonInvalid)) {
- m_bThreadInvalid = true;
- return MIstatus::success;
- }
-
- const MIuint nFrames = thread.GetNumFrames();
- if (nFrameLow >= nFrames) {
- // The low-frame is larger than the actual number of frames
- SetError(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- nFrameHigh = std::min(nFrameHigh, nFrames);
- for (MIuint i = nFrameLow; i < nFrameHigh; i++) {
- lldb::SBFrame frame = thread.GetFrameAtIndex(i);
- CMICmnMIValueList miValueList(true);
- const MIuint maskVarTypes =
- CMICmnLLDBDebugSessionInfo::eVariableType_Arguments;
- if (!rSessionInfo.MIResponseFormVariableInfo(frame, maskVarTypes,
- eVarInfoFormat, miValueList))
- return MIstatus::failure;
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%d", i));
- const CMICmnMIValueResult miValueResult("level", miValueConst);
- CMICmnMIValueTuple miValueTuple(miValueResult);
- const CMICmnMIValueResult miValueResult2("args", miValueList);
- miValueTuple.Add(miValueResult2);
- const CMICmnMIValueResult miValueResult3("frame", miValueTuple);
- m_miValueList.Add(miValueResult3);
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListArguments::Acknowledge() {
- if (m_bThreadInvalid) {
- // MI print "%s^done,stack-args=[]"
- const CMICmnMIValueList miValueList(true);
- const CMICmnMIValueResult miValueResult("stack-args", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // MI print
- // "%s^done,stack-args=[frame={level=\"0\",args=[%s]},frame={level=\"1\",args=[%s]}]"
- const CMICmnMIValueResult miValueResult4("stack-args", m_miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult4);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdStackListArguments::CreateSelf() {
- return new CMICmdCmdStackListArguments();
-}
-
-
-//++
-// Details: CMICmdCmdStackListLocals constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackListLocals::CMICmdCmdStackListLocals()
- : m_bThreadInvalid(false), m_miValueList(true),
- m_constStrArgPrintValues("print-values") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "stack-list-locals";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdStackListLocals::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdStackListLocals destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackListLocals::~CMICmdCmdStackListLocals() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListLocals::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValPrintValues(m_constStrArgPrintValues, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListLocals::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
- CMICMDBASE_GETOPTION(pArgFrame, OptionLong, m_constStrArgFrame);
- CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues, m_constStrArgPrintValues);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound()) {
- if (!pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(
- nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- }
-
- MIuint64 nFrame = UINT64_MAX;
- if (pArgFrame->GetFound()) {
- if (!pArgFrame->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nFrame)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgFrame.c_str()));
- return MIstatus::failure;
- }
- }
-
- const CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat =
- static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(
- pArgPrintValues->GetValue());
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBThread thread = (nThreadId != UINT64_MAX)
- ? sbProcess.GetThreadByIndexID(nThreadId)
- : sbProcess.GetSelectedThread();
- m_bThreadInvalid = !thread.IsValid();
- if (m_bThreadInvalid)
- return MIstatus::success;
-
- const lldb::StopReason eStopReason = thread.GetStopReason();
- if ((eStopReason == lldb::eStopReasonNone) ||
- (eStopReason == lldb::eStopReasonInvalid)) {
- m_bThreadInvalid = true;
- return MIstatus::success;
- }
-
- lldb::SBFrame frame = (nFrame != UINT64_MAX) ? thread.GetFrameAtIndex(nFrame)
- : thread.GetSelectedFrame();
-
- CMICmnMIValueList miValueList(true);
- const MIuint maskVarTypes = CMICmnLLDBDebugSessionInfo::eVariableType_Locals |
- CMICmnLLDBDebugSessionInfo::eVariableType_InScope;
- if (!rSessionInfo.MIResponseFormVariableInfo(frame, maskVarTypes,
- eVarInfoFormat, miValueList))
- return MIstatus::failure;
-
- m_miValueList = miValueList;
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListLocals::Acknowledge() {
- if (m_bThreadInvalid) {
- // MI print "%s^done,locals=[]"
- const CMICmnMIValueList miValueList(true);
- const CMICmnMIValueResult miValueResult("locals", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // MI print "%s^done,locals=[%s]"
- const CMICmnMIValueResult miValueResult("locals", m_miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdStackListLocals::CreateSelf() {
- return new CMICmdCmdStackListLocals();
-}
-
-
-//++
-// Details: CMICmdCmdStackListVariables constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackListVariables::CMICmdCmdStackListVariables()
- : m_bThreadInvalid(false), m_miValueList(true),
- m_constStrArgPrintValues("print-values") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "stack-list-variables";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdStackListVariables::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdStackListVariables destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackListVariables::~CMICmdCmdStackListVariables() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListVariables::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValPrintValues(m_constStrArgPrintValues, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListVariables::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
- CMICMDBASE_GETOPTION(pArgFrame, OptionLong, m_constStrArgFrame);
- CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues, m_constStrArgPrintValues);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound()) {
- if (!pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(
- nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
- }
-
- MIuint64 nFrame = UINT64_MAX;
- if (pArgFrame->GetFound()) {
- if (!pArgFrame->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nFrame)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgFrame.c_str()));
- return MIstatus::failure;
- }
- }
-
- const CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat =
- static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(
- pArgPrintValues->GetValue());
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBThread thread = (nThreadId != UINT64_MAX)
- ? sbProcess.GetThreadByIndexID(nThreadId)
- : sbProcess.GetSelectedThread();
- m_bThreadInvalid = !thread.IsValid();
- if (m_bThreadInvalid)
- return MIstatus::success;
-
- const lldb::StopReason eStopReason = thread.GetStopReason();
- if ((eStopReason == lldb::eStopReasonNone) ||
- (eStopReason == lldb::eStopReasonInvalid)) {
- m_bThreadInvalid = true;
- return MIstatus::success;
- }
-
- lldb::SBFrame frame = (nFrame != UINT64_MAX) ? thread.GetFrameAtIndex(nFrame)
- : thread.GetSelectedFrame();
-
- CMICmnMIValueList miValueList(true);
- const MIuint maskVarTypes =
- CMICmnLLDBDebugSessionInfo::eVariableType_Arguments |
- CMICmnLLDBDebugSessionInfo::eVariableType_Locals |
- CMICmnLLDBDebugSessionInfo::eVariableType_InScope;
- if (!rSessionInfo.MIResponseFormVariableInfo(
- frame, maskVarTypes, eVarInfoFormat, miValueList, 10, true))
- return MIstatus::failure;
- m_miValueList = miValueList;
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackListVariables::Acknowledge() {
- if (m_bThreadInvalid) {
- // MI print "%s^done,variables=[]"
- const CMICmnMIValueList miValueList(true);
- const CMICmnMIValueResult miValueResult("variables", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // MI print "%s^done,variables=[%s]"
- const CMICmnMIValueResult miValueResult("variables", m_miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdStackListVariables::CreateSelf() {
- return new CMICmdCmdStackListVariables();
-}
-
-
-//++
-// Details: CMICmdCmdStackSelectFrame constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackSelectFrame::CMICmdCmdStackSelectFrame()
- : m_bFrameInvalid(false), m_constStrArgFrameId("frame_id") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "stack-select-frame";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdStackSelectFrame::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdStackSelectFrame destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdStackSelectFrame::~CMICmdCmdStackSelectFrame() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackSelectFrame::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrameId, true, false));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackSelectFrame::Execute() {
- CMICMDBASE_GETOPTION(pArgFrame, Number, m_constStrArgFrameId);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBThread sbThread = rSessionInfo.GetProcess().GetSelectedThread();
-
- const MIuint nFrameId = pArgFrame->GetValue();
- m_bFrameInvalid = (nFrameId >= sbThread.GetNumFrames());
- if (m_bFrameInvalid)
- return MIstatus::success;
-
- lldb::SBFrame sbFrame = sbThread.SetSelectedFrame(nFrameId);
- m_bFrameInvalid = !sbFrame.IsValid();
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Function succeeded.
-// MIstatus::failure - Function failed.
-// Throws: None.
-//--
-bool CMICmdCmdStackSelectFrame::Acknowledge() {
- if (m_bFrameInvalid) {
- // MI print "%s^error,msg=\"Command '-stack-select-frame'. Frame ID
- // invalid\""
- const CMICmnMIValueConst miValueConst(CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_FRAME_INVALID), m_cmdData.strMiCmd.c_str()));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
- }
-
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdStackSelectFrame::CreateSelf() {
- return new CMICmdCmdStackSelectFrame();
-}
diff --git a/tools/lldb-mi/MICmdCmdStack.h b/tools/lldb-mi/MICmdCmdStack.h
deleted file mode 100644
index 04aeb5db0340..000000000000
--- a/tools/lldb-mi/MICmdCmdStack.h
+++ /dev/null
@@ -1,256 +0,0 @@
-//===-- MICmdCmdStack.h -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdStackInfoDepth interface.
-// CMICmdCmdStackInfoFrame interface.
-// CMICmdCmdStackListFrames interface.
-// CMICmdCmdStackListArguments interface.
-// CMICmdCmdStackListLocals interface.
-// CMICmdCmdStackSelectFrame interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "stack-info-depth".
-//--
-class CMICmdCmdStackInfoDepth : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdStackInfoDepth();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdStackInfoDepth() override;
-
- // Attributes:
-private:
- MIuint m_nThreadFrames;
- const CMIUtilString m_constStrArgMaxDepth; // Not handled by *this command
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "stack-info-frame".
-//--
-class CMICmdCmdStackInfoFrame : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdStackInfoFrame();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdStackInfoFrame() override;
-
- // Attributes:
-private:
- CMICmnMIValueTuple m_miValueTuple;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "stack-list-frames".
-//--
-class CMICmdCmdStackListFrames : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdStackListFrames();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdStackListFrames() override;
-
- // Typedefs:
-private:
- typedef std::vector<CMICmnMIValueResult> VecMIValueResult_t;
-
- // Attributes:
-private:
- MIuint m_nThreadFrames;
- VecMIValueResult_t m_vecMIValueResult;
- const CMIUtilString m_constStrArgFrameLow;
- const CMIUtilString m_constStrArgFrameHigh;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "stack-list-arguments".
-//--
-class CMICmdCmdStackListArguments : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdStackListArguments();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdStackListArguments() override;
-
- // Attributes:
-private:
- bool m_bThreadInvalid; // True = yes invalid thread, false = thread object
- // valid
- CMICmnMIValueList m_miValueList;
- const CMIUtilString m_constStrArgPrintValues;
- const CMIUtilString m_constStrArgFrameLow;
- const CMIUtilString m_constStrArgFrameHigh;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "stack-list-locals".
-//--
-class CMICmdCmdStackListLocals : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdStackListLocals();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdStackListLocals() override;
-
- // Attributes:
-private:
- bool m_bThreadInvalid; // True = yes invalid thread, false = thread object
- // valid
- CMICmnMIValueList m_miValueList;
- const CMIUtilString m_constStrArgPrintValues;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "stack-list-variables".
-//--
-class CMICmdCmdStackListVariables : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdStackListVariables();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdStackListVariables() override;
-
- // Attributes
-private:
- bool m_bThreadInvalid; // True = yes invalid thread, false = thread object
- // valid
- CMICmnMIValueList m_miValueList;
- const CMIUtilString m_constStrArgPrintValues;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "stack-select-frame".
-//--
-class CMICmdCmdStackSelectFrame : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdStackSelectFrame();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdStackSelectFrame() override;
-
- // Attributes:
-private:
- bool m_bFrameInvalid; // True = yes invalid frame, false = ok
- const CMIUtilString m_constStrArgFrameId;
-};
diff --git a/tools/lldb-mi/MICmdCmdSupportInfo.cpp b/tools/lldb-mi/MICmdCmdSupportInfo.cpp
deleted file mode 100644
index e17f70a90472..000000000000
--- a/tools/lldb-mi/MICmdCmdSupportInfo.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-//===-- MICmdCmdSupportInfo.cpp ---------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdSupportInfoMiCmdQuery implementation.
-
-// In-house headers:
-#include "MICmdCmdSupportInfo.h"
-#include "MICmdArgValString.h"
-#include "MICmdFactory.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-#include "MICmnMIValueTuple.h"
-
-//++
-// Details: CMICmdCmdSupportInfoMiCmdQuery constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdSupportInfoMiCmdQuery::CMICmdCmdSupportInfoMiCmdQuery()
- : m_bCmdFound(false), m_constStrArgCmdName("cmd_name") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "info-gdb-mi-command";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdSupportInfoMiCmdQuery::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdSupportInfoMiCmdQuery destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdSupportInfoMiCmdQuery::~CMICmdCmdSupportInfoMiCmdQuery() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSupportInfoMiCmdQuery::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgCmdName, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSupportInfoMiCmdQuery::Execute() {
- CMICMDBASE_GETOPTION(pArgNamedCmdName, String, m_constStrArgCmdName);
- const CMIUtilString &rCmdToQuery(pArgNamedCmdName->GetValue());
- const MIuint nLen = rCmdToQuery.length();
- const CMICmdFactory &rCmdFactory = CMICmdFactory::Instance();
- if ((nLen > 1) && (rCmdToQuery[0] == '-'))
- m_bCmdFound = rCmdFactory.CmdExist(rCmdToQuery.substr(1, nLen - 1).c_str());
- else
- m_bCmdFound = rCmdFactory.CmdExist(rCmdToQuery);
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSupportInfoMiCmdQuery::Acknowledge() {
- const CMICmnMIValueConst miValueConst(m_bCmdFound ? "true" : "false");
- const CMICmnMIValueResult miValueResult("exists", miValueConst);
- const CMICmnMIValueTuple miValueTuple(miValueResult);
- const CMICmnMIValueResult miValueResult2("command", miValueTuple);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult2);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdSupportInfoMiCmdQuery::CreateSelf() {
- return new CMICmdCmdSupportInfoMiCmdQuery();
-}
diff --git a/tools/lldb-mi/MICmdCmdSupportInfo.h b/tools/lldb-mi/MICmdCmdSupportInfo.h
deleted file mode 100644
index ba3e4a6c66a5..000000000000
--- a/tools/lldb-mi/MICmdCmdSupportInfo.h
+++ /dev/null
@@ -1,58 +0,0 @@
-//===-- MICmdCmdSupportInfo.h -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdSupportInfoMiCmdQuery interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "info-gdb-mi-command".
-// This command does not follow the MI documentation exactly.
-//--
-class CMICmdCmdSupportInfoMiCmdQuery : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdSupportInfoMiCmdQuery();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdSupportInfoMiCmdQuery() override;
-
- // Attributes:
-private:
- bool m_bCmdFound; // True = query for the command in command factory found,
- // false = not found not recognised
- const CMIUtilString m_constStrArgCmdName;
-};
diff --git a/tools/lldb-mi/MICmdCmdSupportList.cpp b/tools/lldb-mi/MICmdCmdSupportList.cpp
deleted file mode 100644
index e457e0101f4e..000000000000
--- a/tools/lldb-mi/MICmdCmdSupportList.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-//===-- MICmdCmdSupportList.cpp ---------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdSupportListFeatures implementation.
-
-// In-house headers:
-#include "MICmdCmdSupportList.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-#include "MICmnMIValueList.h"
-
-//++
-// Details: CMICmdCmdSupportListFeatures constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdSupportListFeatures::CMICmdCmdSupportListFeatures() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "list-features";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdSupportListFeatures::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdSupportListFeatures destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdSupportListFeatures::~CMICmdCmdSupportListFeatures() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSupportListFeatures::Execute() {
- // Do nothing
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSupportListFeatures::Acknowledge() {
- // Declare supported features here
- const CMICmnMIValueConst miValueConst1("data-read-memory-bytes");
- const CMICmnMIValueConst miValueConst2("exec-run-start-option");
- // Some features may depend on host and/or target, decide what to add below
- CMICmnMIValueList miValueList(true);
- miValueList.Add(miValueConst1);
- miValueList.Add(miValueConst2);
- const CMICmnMIValueResult miValueResult("features", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdSupportListFeatures::CreateSelf() {
- return new CMICmdCmdSupportListFeatures();
-}
diff --git a/tools/lldb-mi/MICmdCmdSupportList.h b/tools/lldb-mi/MICmdCmdSupportList.h
deleted file mode 100644
index 9e8a64bc11a1..000000000000
--- a/tools/lldb-mi/MICmdCmdSupportList.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//===-- MICmdCmdSupportList.h -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdSupportListFeatures interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "list-features".
-// This command does not follow the MI documentation exactly.
-//--
-class CMICmdCmdSupportListFeatures : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdSupportListFeatures();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdSupportListFeatures() override;
-};
diff --git a/tools/lldb-mi/MICmdCmdSymbol.cpp b/tools/lldb-mi/MICmdCmdSymbol.cpp
deleted file mode 100644
index d57d1b008e59..000000000000
--- a/tools/lldb-mi/MICmdCmdSymbol.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-//===-- MICmdCmdSymbol.cpp --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdSymbolListLines implementation.
-
-// Third Party Headers:
-#include "llvm/ADT/Twine.h"
-#include "lldb/API/SBAddress.h"
-#include "lldb/API/SBLineEntry.h"
-#include "lldb/API/SBFileSpec.h"
-#include "lldb/API/SBCompileUnit.h"
-#include "lldb/API/SBSymbolContext.h"
-#include "lldb/API/SBSymbolContextList.h"
-
-// In-house headers:
-#include "MICmdArgValFile.h"
-#include "MICmdCmdSymbol.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueTuple.h"
-#include "MICmnMIValueResult.h"
-
-namespace {
-const CMICmnMIValueTuple
-CreateMITuplePCLine(const uint32_t addr, const uint32_t line_number) {
- const CMICmnMIValueConst miValueConstAddr("0x" + llvm::Twine::utohexstr(addr).str());
- const CMICmnMIValueConst miValueConstLine(llvm::Twine(line_number).str());
- const CMICmnMIValueResult miValueResultAddr("pc", miValueConstAddr);
- const CMICmnMIValueResult miValueResultLine("line", miValueConstLine);
- CMICmnMIValueTuple miValueTuple(miValueResultAddr);
- miValueTuple.Add(miValueResultLine);
- return miValueTuple;
-}
-} // namespace
-
-using namespace lldb; // For operator==(const SBAddress &, const SBAddress &).
-
-//++
-// Details: CMICmdCmdSymbolListLines constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdSymbolListLines::CMICmdCmdSymbolListLines()
- : m_resultList(false), m_constStrArgNameFile("file") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "symbol-list-lines";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdSymbolListLines::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdSymbolListLines destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdSymbolListLines::~CMICmdCmdSymbolListLines() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSymbolListLines::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValFile(m_constStrArgNameFile, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Synopsis: -symbol-list-lines file
-// Ref:
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Symbol-Query.html#GDB_002fMI-Symbol-Query
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSymbolListLines::Execute() {
- CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile);
-
- const auto &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- if (rSessionInfo.GetTarget() == rSessionInfo.GetDebugger().GetDummyTarget()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- const lldb::SBFileSpec source_file_spec(pArgFile->GetValue().c_str(), true);
- const char *source_file_name = source_file_spec.GetFilename();
- const char *source_file_directory = source_file_spec.GetDirectory();
- const bool has_path = source_file_directory;
-
- lldb::SBSymbolContextList sc_cu_list =
- CMICmnLLDBDebugSessionInfo::Instance().GetTarget().FindCompileUnits(
- source_file_spec);
-
- bool found_something = false;
- for (uint32_t i = 0, e = sc_cu_list.GetSize(); i < e; ++i) {
- const lldb::SBCompileUnit cu =
- sc_cu_list.GetContextAtIndex(i).GetCompileUnit();
- for (uint32_t j = 0, e = cu.GetNumLineEntries(); j < e; ++j) {
- const lldb::SBLineEntry line = cu.GetLineEntryAtIndex(j);
- const lldb::SBFileSpec line_spec = line.GetFileSpec();
- if (line_spec.GetFilename() == source_file_name) {
- if (has_path && (line_spec.GetDirectory() != source_file_directory))
- continue;
- // We don't need a line with start address equals to end one,
- // so just skip it.
- const lldb::SBAddress line_start_address = line.GetStartAddress();
- const lldb::SBAddress line_end_address = line.GetEndAddress();
- if (line_start_address == line_end_address)
- continue;
- // We have a matching line.
- found_something = true;
- m_resultList.Add(CreateMITuplePCLine(
- line_start_address.GetFileAddress(),
- line.GetLine()));
- }
- }
- }
- if (!found_something) {
- SetError(MIRSRC(IDS_UTIL_FILE_ERR_INVALID_PATHNAME));
- return MIstatus::failure;
- }
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdSymbolListLines::Acknowledge() {
- // MI print "%s^done,lines=[{pc=\"%d\",line=\"%d\"}...]"
- const CMICmnMIValueResult miValueResult("lines", m_resultList);
- m_miResultRecord = CMICmnMIResultRecord(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdSymbolListLines::CreateSelf() {
- return new CMICmdCmdSymbolListLines();
-}
diff --git a/tools/lldb-mi/MICmdCmdSymbol.h b/tools/lldb-mi/MICmdCmdSymbol.h
deleted file mode 100644
index 839b0153a772..000000000000
--- a/tools/lldb-mi/MICmdCmdSymbol.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//===-- MICmdCmdSymbol.h ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdSymbolListLines interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// Third party headers:
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnMIValueList.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "symbol-list-lines".
-//--
-class CMICmdCmdSymbolListLines : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdSymbolListLines();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdSymbolListLines() override;
-
- // Attributes:
-private:
- CMICmnMIValueList m_resultList;
- const CMIUtilString m_constStrArgNameFile;
-};
diff --git a/tools/lldb-mi/MICmdCmdTarget.cpp b/tools/lldb-mi/MICmdCmdTarget.cpp
deleted file mode 100644
index 18ce038b1685..000000000000
--- a/tools/lldb-mi/MICmdCmdTarget.cpp
+++ /dev/null
@@ -1,447 +0,0 @@
-//===-- MICmdCmdTarget.cpp --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdTargetSelect implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBStream.h"
-#include "lldb/API/SBError.h"
-
-// In-house headers:
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValString.h"
-#include "MICmdCmdTarget.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnMIOutOfBandRecord.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-//++
-// Details: CMICmdCmdTargetSelect constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdTargetSelect::CMICmdCmdTargetSelect()
- : m_constStrArgNamedType("type"),
- m_constStrArgNamedParameters("parameters") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "target-select";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdTargetSelect::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdTargetSelect destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdTargetSelect::~CMICmdCmdTargetSelect() = default;
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetSelect::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedType, true, true));
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgNamedParameters, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Synopsis: -target-select type parameters ...
-// Ref:
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetSelect::Execute() {
- CMICMDBASE_GETOPTION(pArgType, String, m_constStrArgNamedType);
- CMICMDBASE_GETOPTION(pArgParameters, String, m_constStrArgNamedParameters);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget target = rSessionInfo.GetTarget();
-
- // Check we have a valid target.
- // Note: target created via 'file-exec-and-symbols' command.
- if (!target.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- // Verify that we are executing remotely.
- const CMIUtilString &rRemoteType(pArgType->GetValue());
- if (rRemoteType != "remote") {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_TYPE),
- m_cmdData.strMiCmd.c_str(),
- rRemoteType.c_str()));
- return MIstatus::failure;
- }
-
- // Create a URL pointing to the remote gdb stub.
- const CMIUtilString strUrl =
- CMIUtilString::Format("connect://%s", pArgParameters->GetValue().c_str());
-
- lldb::SBError error;
- // Ask LLDB to connect to the target port.
- const char *pPlugin("gdb-remote");
- lldb::SBProcess process = target.ConnectRemote(
- rSessionInfo.GetListener(), strUrl.c_str(), pPlugin, error);
-
- // Verify that we have managed to connect successfully.
- if (!process.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_PLUGIN),
- m_cmdData.strMiCmd.c_str(),
- error.GetCString()));
- return MIstatus::failure;
- }
-
- // Set the environment path if we were given one.
- CMIUtilString strWkDir;
- if (rSessionInfo.SharedDataRetrieve<CMIUtilString>(
- rSessionInfo.m_constStrSharedDataKeyWkDir, strWkDir)) {
- lldb::SBDebugger &rDbgr = rSessionInfo.GetDebugger();
- if (!rDbgr.SetCurrentPlatformSDKRoot(strWkDir.c_str())) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_FNFAILED),
- m_cmdData.strMiCmd.c_str(),
- "target-select"));
- return MIstatus::failure;
- }
- }
-
- // Set the shared object path if we were given one.
- CMIUtilString strSolibPath;
- if (rSessionInfo.SharedDataRetrieve<CMIUtilString>(
- rSessionInfo.m_constStrSharedDataSolibPath, strSolibPath))
- target.AppendImageSearchPath(".", strSolibPath.c_str(), error);
-
- return HandleSBError(error);
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetSelect::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Connected);
- m_miResultRecord = miRecordResult;
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
- // Prod the client i.e. Eclipse with out-of-band results to help it 'continue'
- // because it is using LLDB debugger
- // Give the client '=thread-group-started,id="i1"'
- m_bHasResultRecordExtra = true;
- const CMICmnMIValueConst miValueConst2("i1");
- const CMICmnMIValueResult miValueResult2("id", miValueConst2);
- const CMIUtilString strPid(CMIUtilString::Format("%lld", pid));
- const CMICmnMIValueConst miValueConst(strPid);
- const CMICmnMIValueResult miValueResult("pid", miValueConst);
- CMICmnMIOutOfBandRecord miOutOfBand(
- CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, miValueResult2);
- miOutOfBand.Add(miValueResult);
- m_miResultRecordExtra = miOutOfBand.GetString();
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdTargetSelect::CreateSelf() {
- return new CMICmdCmdTargetSelect();
-}
-
-//++
-// Details: CMICmdCmdTargetAttach constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdTargetAttach::CMICmdCmdTargetAttach()
- : m_constStrArgPid("pid"), m_constStrArgNamedFile("n"),
- m_constStrArgWaitFor("waitfor") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "target-attach";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdTargetAttach::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdTargetAttach destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdTargetAttach::~CMICmdCmdTargetAttach() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetAttach::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgPid, false, true));
- m_setCmdArgs.Add(
- new CMICmdArgValOptionShort(m_constStrArgNamedFile, false, true,
- CMICmdArgValListBase::eArgValType_String, 1));
- m_setCmdArgs.Add(
- new CMICmdArgValOptionLong(m_constStrArgWaitFor, false, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Synopsis: -target-attach file
-// Ref:
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetAttach::Execute() {
- CMICMDBASE_GETOPTION(pArgPid, Number, m_constStrArgPid);
- CMICMDBASE_GETOPTION(pArgFile, OptionShort, m_constStrArgNamedFile);
- CMICMDBASE_GETOPTION(pArgWaitFor, OptionLong, m_constStrArgWaitFor);
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
-
- // If the current target is invalid, create one
- lldb::SBTarget target = rSessionInfo.GetTarget();
- if (!target.IsValid()) {
- target = rSessionInfo.GetDebugger().CreateTarget(nullptr);
- if (!target.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
- }
-
- lldb::SBError error;
- lldb::SBListener listener;
- if (pArgPid->GetFound() && pArgPid->GetValid()) {
- lldb::pid_t pid;
- pid = pArgPid->GetValue();
- target.AttachToProcessWithID(listener, pid, error);
- } else if (pArgFile->GetFound() && pArgFile->GetValid()) {
- bool bWaitFor = (pArgWaitFor->GetFound());
- CMIUtilString file;
- pArgFile->GetExpectedOption<CMICmdArgValString>(file);
- target.AttachToProcessWithName(listener, file.c_str(), bWaitFor, error);
- } else {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_ATTACH_BAD_ARGS),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBStream errMsg;
- if (error.Fail()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_ATTACH_FAILED),
- m_cmdData.strMiCmd.c_str(),
- errMsg.GetData()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetAttach::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
- // Prod the client i.e. Eclipse with out-of-band results to help it 'continue'
- // because it is using LLDB debugger
- // Give the client '=thread-group-started,id="i1"'
- m_bHasResultRecordExtra = true;
- const CMICmnMIValueConst miValueConst2("i1");
- const CMICmnMIValueResult miValueResult2("id", miValueConst2);
- const CMIUtilString strPid(CMIUtilString::Format("%lld", pid));
- const CMICmnMIValueConst miValueConst(strPid);
- const CMICmnMIValueResult miValueResult("pid", miValueConst);
- CMICmnMIOutOfBandRecord miOutOfBand(
- CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, miValueResult2);
- miOutOfBand.Add(miValueResult);
- m_miResultRecordExtra = miOutOfBand.GetString();
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdTargetAttach::CreateSelf() {
- return new CMICmdCmdTargetAttach();
-}
-
-//++
-// Details: CMICmdCmdTargetDetach constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdTargetDetach::CMICmdCmdTargetDetach() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "target-detach";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdTargetDetach::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdTargetDetach destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdTargetDetach::~CMICmdCmdTargetDetach() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetDetach::ParseArgs() { return MIstatus::success; }
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Synopsis: -target-attach file
-// Ref:
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetDetach::Execute() {
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
-
- lldb::SBProcess process = rSessionInfo.GetProcess();
-
- if (!process.IsValid()) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- process.Detach();
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTargetDetach::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdTargetDetach::CreateSelf() {
- return new CMICmdCmdTargetDetach();
-}
diff --git a/tools/lldb-mi/MICmdCmdTarget.h b/tools/lldb-mi/MICmdCmdTarget.h
deleted file mode 100644
index 5cb140fd68b9..000000000000
--- a/tools/lldb-mi/MICmdCmdTarget.h
+++ /dev/null
@@ -1,117 +0,0 @@
-//===-- MICmdCmdTarget.h ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdTargetSelect interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "target-select".
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation
-//--
-class CMICmdCmdTargetSelect : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdTargetSelect();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdTargetSelect() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgNamedType;
- const CMIUtilString m_constStrArgNamedParameters;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "target-attach".
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation
-//--
-class CMICmdCmdTargetAttach : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdTargetAttach();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdTargetAttach() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgPid;
- const CMIUtilString m_constStrArgNamedFile;
- const CMIUtilString m_constStrArgWaitFor;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "target-attach".
-// http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation
-//--
-class CMICmdCmdTargetDetach : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdTargetDetach();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdTargetDetach() override;
-};
diff --git a/tools/lldb-mi/MICmdCmdThread.cpp b/tools/lldb-mi/MICmdCmdThread.cpp
deleted file mode 100644
index e0c74f925a9b..000000000000
--- a/tools/lldb-mi/MICmdCmdThread.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-//===-- MICmdCmdThread.cpp --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdThreadInfo implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBBreakpointLocation.h"
-#include "lldb/API/SBThread.h"
-
-// In-house headers:
-#include "MICmdArgValNumber.h"
-#include "MICmdCmdThread.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-//++
-// Details: CMICmdCmdThreadInfo constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdThreadInfo::CMICmdCmdThreadInfo()
- : m_bSingleThread(false), m_bThreadInvalid(true),
- m_constStrArgNamedThreadId("thread-id"), m_bHasCurrentThread(false) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "thread-info";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdThreadInfo::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdThreadInfo destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdThreadInfo::~CMICmdCmdThreadInfo() { m_vecMIValueTuple.clear(); }
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdThreadInfo::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValNumber(m_constStrArgNamedThreadId, false, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdThreadInfo::Execute() {
- CMICMDBASE_GETOPTION(pArgThreadId, Number, m_constStrArgNamedThreadId);
- MIuint nThreadId = 0;
- if (pArgThreadId->GetFound() && pArgThreadId->GetValid()) {
- m_bSingleThread = true;
- nThreadId = static_cast<MIuint>(pArgThreadId->GetValue());
- }
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBThread thread = sbProcess.GetSelectedThread();
-
- if (m_bSingleThread) {
- thread = sbProcess.GetThreadByIndexID(nThreadId);
- m_bThreadInvalid = !thread.IsValid();
- if (m_bThreadInvalid)
- return MIstatus::success;
-
- CMICmnMIValueTuple miTuple;
- if (!rSessionInfo.MIResponseFormThreadInfo(
- m_cmdData, thread,
- CMICmnLLDBDebugSessionInfo::eThreadInfoFormat_AllFrames, miTuple))
- return MIstatus::failure;
-
- m_miValueTupleThread = miTuple;
-
- return MIstatus::success;
- }
-
- // Multiple threads
- m_vecMIValueTuple.clear();
- const MIuint nThreads = sbProcess.GetNumThreads();
- for (MIuint i = 0; i < nThreads; i++) {
- lldb::SBThread thread = sbProcess.GetThreadAtIndex(i);
- if (thread.IsValid()) {
- CMICmnMIValueTuple miTuple;
- if (!rSessionInfo.MIResponseFormThreadInfo(
- m_cmdData, thread,
- CMICmnLLDBDebugSessionInfo::eThreadInfoFormat_AllFrames, miTuple))
- return MIstatus::failure;
-
- m_vecMIValueTuple.push_back(miTuple);
- }
- }
-
- // -thread-info with multiple threads ends with the current thread id if any
- if (thread.IsValid()) {
- const CMIUtilString strId(CMIUtilString::Format("%d", thread.GetIndexID()));
- CMICmnMIValueConst miValueCurrThreadId(strId);
- m_miValueCurrThreadId = miValueCurrThreadId;
- m_bHasCurrentThread = true;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdThreadInfo::Acknowledge() {
- if (m_bSingleThread) {
- if (m_bThreadInvalid) {
- const CMICmnMIValueConst miValueConst("invalid thread id");
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // MI print
- // "%s^done,threads=[{id=\"%d\",target-id=\"%s\",frame={},state=\"%s\"}]
- const CMICmnMIValueList miValueList(m_miValueTupleThread);
- const CMICmnMIValueResult miValueResult("threads", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- // Build up a list of thread information from tuples
- VecMIValueTuple_t::const_iterator it = m_vecMIValueTuple.begin();
- if (it == m_vecMIValueTuple.end()) {
- const CMICmnMIValueConst miValueConst("[]");
- const CMICmnMIValueResult miValueResult("threads", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
- CMICmnMIValueList miValueList(*it);
- ++it;
- while (it != m_vecMIValueTuple.end()) {
- const CMICmnMIValueTuple &rTuple(*it);
- miValueList.Add(rTuple);
-
- // Next
- ++it;
- }
-
- CMICmnMIValueResult miValueResult("threads", miValueList);
- if (m_bHasCurrentThread) {
- CMIUtilString strCurrThreadId = "current-thread-id";
- miValueResult.Add(strCurrThreadId, m_miValueCurrThreadId);
- }
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdThreadInfo::CreateSelf() {
- return new CMICmdCmdThreadInfo();
-}
diff --git a/tools/lldb-mi/MICmdCmdThread.h b/tools/lldb-mi/MICmdCmdThread.h
deleted file mode 100644
index 413e293447ac..000000000000
--- a/tools/lldb-mi/MICmdCmdThread.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//===-- MICmdCmdThread.h ----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdThreadInfo interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "thread-info".
-//--
-class CMICmdCmdThreadInfo : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdThreadInfo();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdThreadInfo() override;
-
- // Typedefs:
-private:
- typedef std::vector<CMICmnMIValueTuple> VecMIValueTuple_t;
-
- // Attributes:
-private:
- CMICmnMIValueTuple m_miValueTupleThread;
- bool m_bSingleThread; // True = yes single thread, false = multiple threads
- bool m_bThreadInvalid; // True = invalid, false = ok
- VecMIValueTuple_t m_vecMIValueTuple;
- const CMIUtilString m_constStrArgNamedThreadId;
-
- // mi value of current-thread-id if multiple threads are requested
- bool m_bHasCurrentThread;
- CMICmnMIValue m_miValueCurrThreadId;
-};
diff --git a/tools/lldb-mi/MICmdCmdTrace.cpp b/tools/lldb-mi/MICmdCmdTrace.cpp
deleted file mode 100644
index 1daa18010c97..000000000000
--- a/tools/lldb-mi/MICmdCmdTrace.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-//===-- MICmdCmdTrace.cpp ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdTraceStatus implementation.
-
-// In-house headers:
-#include "MICmdCmdTrace.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-//++
-// Details: CMICmdCmdTraceStatus constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdTraceStatus::CMICmdCmdTraceStatus() {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "trace-status";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdTraceStatus::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdTraceStatus destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdTraceStatus::~CMICmdCmdTraceStatus() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTraceStatus::Execute() {
- // Do nothing
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdTraceStatus::Acknowledge() {
- const CMICmnMIValueConst miValueConst(MIRSRC(IDS_CMD_ERR_NOT_IMPLEMENTED));
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdTraceStatus::CreateSelf() {
- return new CMICmdCmdTraceStatus();
-}
diff --git a/tools/lldb-mi/MICmdCmdTrace.h b/tools/lldb-mi/MICmdCmdTrace.h
deleted file mode 100644
index 8796de55b958..000000000000
--- a/tools/lldb-mi/MICmdCmdTrace.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//===-- MICmdCmdTrace.h -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdTraceStatus interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "trace-status".
-//--
-class CMICmdCmdTraceStatus : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdTraceStatus();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdTraceStatus() override;
-};
diff --git a/tools/lldb-mi/MICmdCmdVar.cpp b/tools/lldb-mi/MICmdCmdVar.cpp
deleted file mode 100644
index 3063b1b464dc..000000000000
--- a/tools/lldb-mi/MICmdCmdVar.cpp
+++ /dev/null
@@ -1,1460 +0,0 @@
-//===-- MICmdCmdVar.cpp -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdVarCreate implementation.
-// CMICmdCmdVarUpdate implementation.
-// CMICmdCmdVarDelete implementation.
-// CMICmdCmdVarAssign implementation.
-// CMICmdCmdVarSetFormat implementation.
-// CMICmdCmdVarListChildren implementation.
-// CMICmdCmdVarEvaluateExpression implementation.
-// CMICmdCmdVarInfoPathExpression implementation.
-// CMICmdCmdVarShowAttributes implementation.
-
-// Third Party Headers:
-#include "lldb/API/SBStream.h"
-#include "lldb/API/SBThread.h"
-#include "lldb/API/SBType.h"
-
-// In-house headers:
-#include "MICmdArgValListOfN.h"
-#include "MICmdArgValNumber.h"
-#include "MICmdArgValOptionLong.h"
-#include "MICmdArgValOptionShort.h"
-#include "MICmdArgValPrintValues.h"
-#include "MICmdArgValString.h"
-#include "MICmdArgValThreadGrp.h"
-#include "MICmdCmdVar.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugger.h"
-#include "MICmnLLDBProxySBValue.h"
-#include "MICmnLLDBUtilSBValue.h"
-#include "MICmnMIResultRecord.h"
-#include "MICmnMIValueConst.h"
-
-#include <algorithm>
-
-//++
-// Details: CMICmdCmdVarCreate constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarCreate::CMICmdCmdVarCreate()
- : m_nChildren(0), m_nThreadId(0), m_strType("??"), m_bValid(false),
- m_strValue("??"), m_constStrArgName("name"),
- m_constStrArgFrameAddr("frame-addr"),
- m_constStrArgExpression("expression") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-create";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarCreate::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdVarCreate destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarCreate::~CMICmdCmdVarCreate() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarCreate::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, false, true));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgFrameAddr, false, true));
- m_setCmdArgs.Add(
- new CMICmdArgValString(m_constStrArgExpression, true, true, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarCreate::Execute() {
- CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread);
- CMICMDBASE_GETOPTION(pArgFrame, OptionLong, m_constStrArgFrame);
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
- CMICMDBASE_GETOPTION(pArgFrameAddr, String, m_constStrArgFrameAddr);
- CMICMDBASE_GETOPTION(pArgExpression, String, m_constStrArgExpression);
-
- // Retrieve the --thread option's thread ID (only 1)
- MIuint64 nThreadId = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgThread.c_str()));
- return MIstatus::failure;
- }
-
- // Retrieve the --frame option's number
- MIuint64 nFrame = UINT64_MAX;
- if (pArgThread->GetFound() &&
- !pArgFrame->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nFrame)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgFrame.c_str()));
- return MIstatus::failure;
- }
-
- const CMICmdArgValOptionLong::VecArgObjPtr_t &rVecFrameId(
- pArgFrame->GetExpectedOptions());
- CMICmdArgValOptionLong::VecArgObjPtr_t::const_iterator it2 =
- rVecFrameId.begin();
- if (it2 != rVecFrameId.end()) {
- const CMICmdArgValNumber *pOption = static_cast<CMICmdArgValNumber *>(*it2);
- nFrame = pOption->GetValue();
- }
-
- m_strVarName = "<unnamedvariable>";
- if (pArgName->GetFound()) {
- const CMIUtilString &rArg = pArgName->GetValue();
- const bool bAutoName = (rArg == "-");
- if (bAutoName) {
- m_strVarName = CMIUtilString::Format(
- "var%u", CMICmnLLDBDebugSessionInfoVarObj::VarObjIdGet());
- CMICmnLLDBDebugSessionInfoVarObj::VarObjIdInc();
- } else
- m_strVarName = rArg;
- }
-
- bool bCurrentFrame = false;
- if (pArgFrameAddr->GetFound()) {
- const CMIUtilString &rStrFrameAddr(pArgFrameAddr->GetValue());
- bCurrentFrame = CMIUtilString::Compare(rStrFrameAddr, "*");
- if (!bCurrentFrame && (nFrame == UINT64_MAX)) {
- // FIXME: *addr isn't implemented. Exit with error if --thread isn't
- // specified.
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND),
- m_cmdData.strMiCmd.c_str(),
- m_constStrArgFrame.c_str()));
- return MIstatus::failure;
- }
- }
-
- const CMIUtilString &rStrExpression(pArgExpression->GetValue());
- m_strExpression = rStrExpression;
-
- CMICmnLLDBDebugSessionInfo &rSessionInfo(
- CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- lldb::SBThread thread = (nThreadId != UINT64_MAX)
- ? sbProcess.GetThreadByIndexID(nThreadId)
- : sbProcess.GetSelectedThread();
- m_nThreadId = thread.GetIndexID();
- lldb::SBFrame frame = bCurrentFrame ? thread.GetSelectedFrame()
- : thread.GetFrameAtIndex(nFrame);
- lldb::SBValue value;
-
- if (rStrExpression[0] == '$') {
- const CMIUtilString rStrRegister(rStrExpression.substr(1));
- value = frame.FindRegister(rStrRegister.c_str());
- } else {
- const bool bArgs = true;
- const bool bLocals = true;
- const bool bStatics = true;
- const bool bInScopeOnly = true;
- const lldb::SBValueList valueList =
- frame.GetVariables(bArgs, bLocals, bStatics, bInScopeOnly);
- value = valueList.GetFirstValueByName(rStrExpression.c_str());
- }
-
- if (!value.IsValid())
- value = frame.EvaluateExpression(rStrExpression.c_str());
-
- if (value.IsValid() && value.GetError().Success()) {
- CompleteSBValue(value);
- m_bValid = true;
- m_nChildren = value.GetNumChildren();
- m_strType = CMICmnLLDBUtilSBValue(value).GetTypeNameDisplay();
-
- // This gets added to CMICmnLLDBDebugSessionInfoVarObj static container of
- // varObjs
- CMICmnLLDBDebugSessionInfoVarObj varObj(rStrExpression, m_strVarName,
- value);
- m_strValue = varObj.GetValueFormatted();
- } else {
- m_strValue = value.GetError().GetCString();
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarCreate::Acknowledge() {
- if (m_bValid) {
- // MI print
- // "%s^done,name=\"%s\",numchild=\"%d\",value=\"%s\",type=\"%s\",thread-id=\"%llu\",has_more=\"%u\""
- const CMICmnMIValueConst miValueConst(m_strVarName);
- CMICmnMIValueResult miValueResultAll("name", miValueConst);
- const CMIUtilString strNumChild(CMIUtilString::Format("%d", m_nChildren));
- const CMICmnMIValueConst miValueConst2(strNumChild);
- miValueResultAll.Add("numchild", miValueConst2);
- const CMICmnMIValueConst miValueConst3(m_strValue);
- miValueResultAll.Add("value", miValueConst3);
- const CMICmnMIValueConst miValueConst4(m_strType);
- miValueResultAll.Add("type", miValueConst4);
- const CMIUtilString strThreadId(CMIUtilString::Format("%llu", m_nThreadId));
- const CMICmnMIValueConst miValueConst5(strThreadId);
- miValueResultAll.Add("thread-id", miValueConst5);
- const CMICmnMIValueConst miValueConst6("0");
- miValueResultAll.Add("has_more", miValueConst6);
-
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResultAll);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
- }
-
- CMIUtilString strErrMsg(m_strValue);
- if (m_strValue.empty())
- strErrMsg = CMIUtilString::Format(
- MIRSRC(IDS_CMD_ERR_VARIABLE_CREATION_FAILED), m_strExpression.c_str());
- const CMICmnMIValueConst miValueConst(
- strErrMsg.Escape(true /* vbEscapeQuotes */));
- CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarCreate::CreateSelf() {
- return new CMICmdCmdVarCreate();
-}
-
-//++
-// Details: Complete SBValue object and its children to get
-// SBValue::GetValueDidChange
-// work.
-// Type: Method.
-// Args: vrwValue - (R) Value to update.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-void CMICmdCmdVarCreate::CompleteSBValue(lldb::SBValue &vrwValue) {
- // Force a value to update
- vrwValue.GetValueDidChange();
-
- // And update its children
- lldb::SBType valueType = vrwValue.GetType();
- if (!valueType.IsPointerType() && !valueType.IsReferenceType()) {
- const MIuint nChildren = vrwValue.GetNumChildren();
- for (MIuint i = 0; i < nChildren; ++i) {
- lldb::SBValue member = vrwValue.GetChildAtIndex(i);
- if (member.IsValid())
- CompleteSBValue(member);
- }
- }
-}
-
-
-//++
-// Details: CMICmdCmdVarUpdate constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarUpdate::CMICmdCmdVarUpdate()
- : m_constStrArgPrintValues("print-values"), m_constStrArgName("name"),
- m_bValueChanged(false), m_miValueList(true) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-update";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarUpdate::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdVarUpdate destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarUpdate::~CMICmdCmdVarUpdate() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarUpdate::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValPrintValues(m_constStrArgPrintValues, false, true));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarUpdate::Execute() {
- CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues, m_constStrArgPrintValues);
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
-
- CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat =
- CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
- if (pArgPrintValues->GetFound())
- eVarInfoFormat =
- static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(
- pArgPrintValues->GetValue());
-
- const CMIUtilString &rVarObjName(pArgName->GetValue());
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_DOESNOTEXIST),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBValue &rValue = varObj.GetValue();
- if (!ExamineSBValueForChange(rValue, m_bValueChanged))
- return MIstatus::failure;
-
- if (m_bValueChanged) {
- varObj.UpdateValue();
- const bool bPrintValue(
- (eVarInfoFormat ==
- CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues) ||
- (eVarInfoFormat ==
- CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues &&
- rValue.GetNumChildren() == 0));
- const CMIUtilString strValue(bPrintValue ? varObj.GetValueFormatted() : "");
- const CMIUtilString strInScope(rValue.IsInScope() ? "true" : "false");
- MIFormResponse(rVarObjName, bPrintValue ? strValue.c_str() : nullptr,
- strInScope);
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarUpdate::Acknowledge() {
- if (m_bValueChanged) {
- // MI print
- // "%s^done,changelist=[{name=\"%s\",value=\"%s\",in_scope=\"%s\",type_changed=\"false\",has_more=\"0\"}]"
- CMICmnMIValueResult miValueResult("changelist", m_miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- } else {
- // MI print "%s^done,changelist=[]"
- const CMICmnMIValueList miValueList(true);
- CMICmnMIValueResult miValueResult6("changelist", miValueList);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult6);
- m_miResultRecord = miRecordResult;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarUpdate::CreateSelf() {
- return new CMICmdCmdVarUpdate();
-}
-
-//++
-// Details: Form the MI response for multiple variables.
-// Type: Method.
-// Args: vrStrVarName - (R) Session var object's name.
-// vpValue - (R) Text version of the value held in the
-// variable.
-// vrStrScope - (R) In scope "yes" or "no".
-// Return: None.
-// Throws: None.
-//--
-void CMICmdCmdVarUpdate::MIFormResponse(const CMIUtilString &vrStrVarName,
- const char *const vpValue,
- const CMIUtilString &vrStrScope) {
- // MI print
- // "[{name=\"%s\",value=\"%s\",in_scope=\"%s\",type_changed=\"false\",has_more=\"0\"}]"
- const CMICmnMIValueConst miValueConst(vrStrVarName);
- const CMICmnMIValueResult miValueResult("name", miValueConst);
- CMICmnMIValueTuple miValueTuple(miValueResult);
- if (vpValue != nullptr) {
- const CMICmnMIValueConst miValueConst2(vpValue);
- const CMICmnMIValueResult miValueResult2("value", miValueConst2);
- miValueTuple.Add(miValueResult2);
- }
- const CMICmnMIValueConst miValueConst3(vrStrScope);
- const CMICmnMIValueResult miValueResult3("in_scope", miValueConst3);
- miValueTuple.Add(miValueResult3);
- const CMICmnMIValueConst miValueConst4("false");
- const CMICmnMIValueResult miValueResult4("type_changed", miValueConst4);
- miValueTuple.Add(miValueResult4);
- const CMICmnMIValueConst miValueConst5("0");
- const CMICmnMIValueResult miValueResult5("has_more", miValueConst5);
- miValueTuple.Add(miValueResult5);
- m_miValueList.Add(miValueTuple);
-}
-
-//++
-// Details: Determine if the var object was changed.
-// Type: Method.
-// Args: vrVarObj - (R) Session var object to examine.
-// vrwbChanged - (W) True = The var object was changed,
-// False = It was not changed.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarUpdate::ExamineSBValueForChange(lldb::SBValue &vrwValue,
- bool &vrwbChanged) {
- if (vrwValue.GetValueDidChange()) {
- vrwbChanged = true;
- return MIstatus::success;
- }
-
- const MIuint nChildren = vrwValue.GetNumChildren();
- for (MIuint i = 0; i < nChildren; ++i) {
- lldb::SBValue member = vrwValue.GetChildAtIndex(i);
- if (!member.IsValid())
- continue;
-
- // skip pointers and references to avoid infinite loop
- if (member.GetType().GetTypeFlags() &
- (lldb::eTypeIsPointer | lldb::eTypeIsReference))
- continue;
-
- // Handle composite types (i.e. struct or arrays)
- if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
- return MIstatus::success;
- }
- vrwbChanged = false;
- return MIstatus::success;
-}
-
-
-//++
-// Details: CMICmdCmdVarDelete constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarDelete::CMICmdCmdVarDelete() : m_constStrArgName("name") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-delete";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarDelete::CreateSelf;
-}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarDelete::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: CMICmdCmdVarDelete destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarDelete::~CMICmdCmdVarDelete() {}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarDelete::Execute() {
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
-
- const CMIUtilString &rVarObjName(pArgName->GetValue());
- CMICmnLLDBDebugSessionInfoVarObj::VarObjDelete(rVarObjName);
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarDelete::Acknowledge() {
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarDelete::CreateSelf() {
- return new CMICmdCmdVarDelete();
-}
-
-
-//++
-// Details: CMICmdCmdVarAssign constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarAssign::CMICmdCmdVarAssign()
- : m_bOk(true), m_constStrArgName("name"),
- m_constStrArgExpression("expression") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-assign";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarAssign::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdVarAssign destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarAssign::~CMICmdCmdVarAssign() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarAssign::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgExpression, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarAssign::Execute() {
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
- CMICMDBASE_GETOPTION(pArgExpression, String, m_constStrArgExpression);
-
- const CMIUtilString &rVarObjName(pArgName->GetValue());
- const CMIUtilString &rExpression(pArgExpression->GetValue());
-
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_DOESNOTEXIST),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str()));
- return MIstatus::failure;
- }
- m_varObjName = rVarObjName;
-
- CMIUtilString strExpression(rExpression.Trim());
- strExpression = strExpression.Trim('"');
- lldb::SBValue &rValue(const_cast<lldb::SBValue &>(varObj.GetValue()));
- m_bOk = rValue.SetValueFromCString(strExpression.c_str());
- if (m_bOk)
- varObj.UpdateValue();
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarAssign::Acknowledge() {
- if (m_bOk) {
- // MI print "%s^done,value=\"%s\""
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(m_varObjName, varObj);
- const CMICmnMIValueConst miValueConst(varObj.GetValueFormatted());
- const CMICmnMIValueResult miValueResult("value", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
- }
-
- const CMICmnMIValueConst miValueConst("expression could not be evaluated");
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarAssign::CreateSelf() {
- return new CMICmdCmdVarAssign();
-}
-
-
-//++
-// Details: CMICmdCmdVarSetFormat constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarSetFormat::CMICmdCmdVarSetFormat()
- : m_constStrArgName("name"), m_constStrArgFormatSpec("format-spec") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-set-format";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarSetFormat::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdVarSetFormat destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarSetFormat::~CMICmdCmdVarSetFormat() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarSetFormat::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgFormatSpec, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarSetFormat::Execute() {
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
- CMICMDBASE_GETOPTION(pArgFormatSpec, String, m_constStrArgFormatSpec);
-
- const CMIUtilString &rVarObjName(pArgName->GetValue());
- const CMIUtilString &rExpression(pArgFormatSpec->GetValue());
-
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_DOESNOTEXIST),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str()));
- return MIstatus::failure;
- }
- if (!varObj.SetVarFormat(
- CMICmnLLDBDebugSessionInfoVarObj::GetVarFormatForString(
- rExpression))) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_ENUM_INVALID),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str(), rExpression.c_str()));
- return MIstatus::failure;
- }
- varObj.UpdateValue();
-
- m_varObjName = rVarObjName;
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarSetFormat::Acknowledge() {
- // MI print
- // "%s^done,changelist=[{name=\"%s\",value=\"%s\",in_scope=\"%s\",type_changed=\"false\",has_more=\"0\"}]"
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(m_varObjName, varObj);
- const CMICmnMIValueConst miValueConst(m_varObjName);
- const CMICmnMIValueResult miValueResult("name", miValueConst);
- CMICmnMIValueTuple miValueTuple(miValueResult);
- const CMICmnMIValueConst miValueConst2(varObj.GetValueFormatted());
- const CMICmnMIValueResult miValueResult2("value", miValueConst2);
- miValueTuple.Add(miValueResult2);
- lldb::SBValue &rValue = const_cast<lldb::SBValue &>(varObj.GetValue());
- const CMICmnMIValueConst miValueConst3(rValue.IsInScope() ? "true" : "false");
- const CMICmnMIValueResult miValueResult3("in_scope", miValueConst3);
- miValueTuple.Add(miValueResult3);
- const CMICmnMIValueConst miValueConst4("false");
- const CMICmnMIValueResult miValueResult4("type_changed", miValueConst4);
- miValueTuple.Add(miValueResult4);
- const CMICmnMIValueConst miValueConst5("0");
- const CMICmnMIValueResult miValueResult5("type_changed", miValueConst5);
- miValueTuple.Add(miValueResult5);
- const CMICmnMIValueList miValueList(miValueTuple);
- const CMICmnMIValueResult miValueResult6("changelist", miValueList);
-
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult6);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarSetFormat::CreateSelf() {
- return new CMICmdCmdVarSetFormat();
-}
-
-
-//++
-// Details: CMICmdCmdVarListChildren constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarListChildren::CMICmdCmdVarListChildren()
- : m_constStrArgPrintValues("print-values"), m_constStrArgName("name"),
- m_constStrArgFrom("from"), m_constStrArgTo("to"), m_bValueValid(false),
- m_nChildren(0), m_miValueList(true), m_bHasMore(false) {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-list-children";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarListChildren::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdVarListChildren destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarListChildren::~CMICmdCmdVarListChildren() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarListChildren::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValPrintValues(m_constStrArgPrintValues, false, true));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrom, false, true));
- m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgTo, false, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarListChildren::Execute() {
- CMICMDBASE_GETOPTION(pArgPrintValues, PrintValues, m_constStrArgPrintValues);
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
- CMICMDBASE_GETOPTION(pArgFrom, Number, m_constStrArgFrom);
- CMICMDBASE_GETOPTION(pArgTo, Number, m_constStrArgTo);
-
- CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat =
- CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
- if (pArgPrintValues->GetFound())
- eVarInfoFormat =
- static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(
- pArgPrintValues->GetValue());
-
- const CMIUtilString &rVarObjName(pArgName->GetValue());
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_DOESNOTEXIST),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str()));
- return MIstatus::failure;
- }
-
- MIuint nFrom = 0;
- MIuint nTo = UINT32_MAX;
- if (pArgFrom->GetFound() && pArgTo->GetFound()) {
- nFrom = pArgFrom->GetValue();
- nTo = pArgTo->GetValue();
- } else if (pArgFrom->GetFound() || pArgTo->GetFound()) {
- // Only from or to was specified but both are required
- SetError(
- CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_CHILD_RANGE_INVALID),
- m_cmdData.strMiCmd.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBValue &rValue = const_cast<lldb::SBValue &>(varObj.GetValue());
- m_bValueValid = rValue.IsValid();
- if (!m_bValueValid)
- return MIstatus::success;
-
- const MIuint nChildren = rValue.GetNumChildren();
- m_bHasMore = nTo < nChildren;
- nTo = std::min(nTo, nChildren);
- m_nChildren = nFrom < nTo ? nTo - nFrom : 0;
- for (MIuint i = nFrom; i < nTo; i++) {
- lldb::SBValue member = rValue.GetChildAtIndex(i);
- const CMICmnLLDBUtilSBValue utilValue(member);
- const CMIUtilString strExp = utilValue.GetName();
- const CMIUtilString name(
- strExp.empty() ? CMIUtilString::Format("%s.$%u", rVarObjName.c_str(), i)
- : CMIUtilString::Format("%s.%s", rVarObjName.c_str(),
- strExp.c_str()));
- const MIuint nChildren = member.GetNumChildren();
- const CMIUtilString strThreadId(
- CMIUtilString::Format("%u", member.GetThread().GetIndexID()));
-
- // Varobj gets added to CMICmnLLDBDebugSessionInfoVarObj static container of
- // varObjs
- CMICmnLLDBDebugSessionInfoVarObj var(strExp, name, member, rVarObjName);
-
- // MI print
- // "child={name=\"%s\",exp=\"%s\",numchild=\"%d\",value=\"%s\",type=\"%s\",thread-id=\"%u\",has_more=\"%u\"}"
- const CMICmnMIValueConst miValueConst(name);
- const CMICmnMIValueResult miValueResult("name", miValueConst);
- CMICmnMIValueTuple miValueTuple(miValueResult);
- const CMICmnMIValueConst miValueConst2(strExp);
- const CMICmnMIValueResult miValueResult2("exp", miValueConst2);
- miValueTuple.Add(miValueResult2);
- const CMIUtilString strNumChild(CMIUtilString::Format("%u", nChildren));
- const CMICmnMIValueConst miValueConst3(strNumChild);
- const CMICmnMIValueResult miValueResult3("numchild", miValueConst3);
- miValueTuple.Add(miValueResult3);
- const CMICmnMIValueConst miValueConst5(utilValue.GetTypeNameDisplay());
- const CMICmnMIValueResult miValueResult5("type", miValueConst5);
- miValueTuple.Add(miValueResult5);
- const CMICmnMIValueConst miValueConst6(strThreadId);
- const CMICmnMIValueResult miValueResult6("thread-id", miValueConst6);
- miValueTuple.Add(miValueResult6);
- // nChildren == 0 is used to check for simple values
- if (eVarInfoFormat ==
- CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues ||
- (eVarInfoFormat ==
- CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues &&
- nChildren == 0)) {
- const CMIUtilString strValue(
- CMICmnLLDBDebugSessionInfoVarObj::GetValueStringFormatted(
- member, CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Natural));
- const CMICmnMIValueConst miValueConst7(strValue);
- const CMICmnMIValueResult miValueResult7("value", miValueConst7);
- miValueTuple.Add(miValueResult7);
- }
- const CMICmnMIValueConst miValueConst8("0");
- const CMICmnMIValueResult miValueResult8("has_more", miValueConst8);
- miValueTuple.Add(miValueResult8);
- const CMICmnMIValueResult miValueResult9("child", miValueTuple);
- m_miValueList.Add(miValueResult9);
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarListChildren::Acknowledge() {
- if (m_bValueValid) {
- // MI print "%s^done,numchild=\"%u\",children=[%s],has_more=\"%d\""
- const CMIUtilString strNumChild(CMIUtilString::Format("%u", m_nChildren));
- const CMICmnMIValueConst miValueConst(strNumChild);
- CMICmnMIValueResult miValueResult("numchild", miValueConst);
- if (m_nChildren != 0)
- miValueResult.Add("children", m_miValueList);
- const CMIUtilString strHasMore(m_bHasMore ? "1" : "0");
- const CMICmnMIValueConst miValueConst2(strHasMore);
- miValueResult.Add("has_more", miValueConst2);
-
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
- }
-
- // MI print "%s^error,msg=\"variable invalid\""
- const CMICmnMIValueConst miValueConst("variable invalid");
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarListChildren::CreateSelf() {
- return new CMICmdCmdVarListChildren();
-}
-
-
-//++
-// Details: CMICmdCmdVarEvaluateExpression constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarEvaluateExpression::CMICmdCmdVarEvaluateExpression()
- : m_bValueValid(true), m_constStrArgFormatSpec("-f"),
- m_constStrArgName("name") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-evaluate-expression";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarEvaluateExpression::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdVarEvaluateExpression destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarEvaluateExpression::~CMICmdCmdVarEvaluateExpression() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarEvaluateExpression::ParseArgs() {
- m_setCmdArgs.Add(
- new CMICmdArgValOptionShort(m_constStrArgFormatSpec, false, false,
- CMICmdArgValListBase::eArgValType_String, 1));
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarEvaluateExpression::Execute() {
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
-
- const CMIUtilString &rVarObjName(pArgName->GetValue());
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_DOESNOTEXIST),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBValue &rValue = const_cast<lldb::SBValue &>(varObj.GetValue());
- m_bValueValid = rValue.IsValid();
- if (!m_bValueValid)
- return MIstatus::success;
-
- m_varObjName = rVarObjName;
- varObj.UpdateValue();
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarEvaluateExpression::Acknowledge() {
- if (m_bValueValid) {
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(m_varObjName, varObj);
- const CMICmnMIValueConst miValueConst(varObj.GetValueFormatted());
- const CMICmnMIValueResult miValueResult("value", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- const CMICmnMIValueConst miValueConst("variable invalid");
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarEvaluateExpression::CreateSelf() {
- return new CMICmdCmdVarEvaluateExpression();
-}
-
-
-//++
-// Details: CMICmdCmdVarInfoPathExpression constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarInfoPathExpression::CMICmdCmdVarInfoPathExpression()
- : m_bValueValid(true), m_constStrArgName("name") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-info-path-expression";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarInfoPathExpression::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdVarInfoPathExpression destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarInfoPathExpression::~CMICmdCmdVarInfoPathExpression() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarInfoPathExpression::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarInfoPathExpression::Execute() {
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
-
- const CMIUtilString &rVarObjName(pArgName->GetValue());
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_DOESNOTEXIST),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str()));
- return MIstatus::failure;
- }
-
- lldb::SBValue &rValue = const_cast<lldb::SBValue &>(varObj.GetValue());
- m_bValueValid = rValue.IsValid();
- if (!m_bValueValid)
- return MIstatus::success;
-
- lldb::SBStream stream;
- if (!rValue.GetExpressionPath(stream, true)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_EXPRESSIONPATH),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str()));
- return MIstatus::failure;
- }
-
- const char *pPathExpression = stream.GetData();
- if (pPathExpression == nullptr) {
- // Build expression from what we do know
- m_strPathExpression = varObj.GetNameReal();
- return MIstatus::success;
- }
-
- // Has LLDB returned a var signature of it's own
- if (pPathExpression[0] != '$') {
- m_strPathExpression = pPathExpression;
- return MIstatus::success;
- }
-
- // Build expression from what we do know
- const CMIUtilString &rVarParentName(varObj.GetVarParentName());
- if (rVarParentName.empty()) {
- m_strPathExpression = varObj.GetNameReal();
- } else {
- CMICmnLLDBDebugSessionInfoVarObj varObjParent;
- if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarParentName,
- varObjParent)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_DOESNOTEXIST),
- m_cmdData.strMiCmd.c_str(),
- rVarParentName.c_str()));
- return MIstatus::failure;
- }
- m_strPathExpression =
- CMIUtilString::Format("%s.%s", varObjParent.GetNameReal().c_str(),
- varObj.GetNameReal().c_str());
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarInfoPathExpression::Acknowledge() {
- if (m_bValueValid) {
- const CMICmnMIValueConst miValueConst(m_strPathExpression);
- const CMICmnMIValueResult miValueResult("path_expr", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
- return MIstatus::success;
- }
-
- const CMICmnMIValueConst miValueConst("variable invalid");
- const CMICmnMIValueResult miValueResult("msg", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarInfoPathExpression::CreateSelf() {
- return new CMICmdCmdVarInfoPathExpression();
-}
-
-
-//++
-// Details: CMICmdCmdVarShowAttributes constructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarShowAttributes::CMICmdCmdVarShowAttributes()
- : m_constStrArgName("name") {
- // Command factory matches this name with that received from the stdin stream
- m_strMiCmd = "var-show-attributes";
-
- // Required by the CMICmdFactory when registering *this command
- m_pSelfCreatorFn = &CMICmdCmdVarShowAttributes::CreateSelf;
-}
-
-//++
-// Details: CMICmdCmdVarShowAttributes destructor.
-// Type: Overrideable.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-CMICmdCmdVarShowAttributes::~CMICmdCmdVarShowAttributes() {}
-
-//++
-// Details: The invoker requires this function. The parses the command line
-// options
-// arguments to extract values for each of those arguments.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarShowAttributes::ParseArgs() {
- m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true));
- return ParseValidateCmdOptions();
-}
-
-//++
-// Details: The invoker requires this function. The command does work in this
-// function.
-// The command is likely to communicate with the LLDB SBDebugger in
-// here.
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarShowAttributes::Execute() {
- CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
-
- const CMIUtilString &rVarObjName(pArgName->GetValue());
- CMICmnLLDBDebugSessionInfoVarObj varObj;
- if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj)) {
- SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_VARIABLE_DOESNOTEXIST),
- m_cmdData.strMiCmd.c_str(),
- rVarObjName.c_str()));
- return MIstatus::failure;
- }
-
- return MIstatus::success;
-}
-
-//++
-// Details: The invoker requires this function. The command prepares a MI Record
-// Result
-// for the work carried out in the Execute().
-// Type: Overridden.
-// Args: None.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
-//--
-bool CMICmdCmdVarShowAttributes::Acknowledge() {
- // MI output: "%s^done,status=\"editable\"]"
- const CMICmnMIValueConst miValueConst("editable");
- const CMICmnMIValueResult miValueResult("status", miValueConst);
- const CMICmnMIResultRecord miRecordResult(
- m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done,
- miValueResult);
- m_miResultRecord = miRecordResult;
-
- return MIstatus::success;
-}
-
-//++
-// Details: Required by the CMICmdFactory when registering *this command. The
-// factory
-// calls this function to create an instance of *this command.
-// Type: Static method.
-// Args: None.
-// Return: CMICmdBase * - Pointer to a new command.
-// Throws: None.
-//--
-CMICmdBase *CMICmdCmdVarShowAttributes::CreateSelf() {
- return new CMICmdCmdVarShowAttributes();
-}
diff --git a/tools/lldb-mi/MICmdCmdVar.h b/tools/lldb-mi/MICmdCmdVar.h
deleted file mode 100644
index cdd036688ca3..000000000000
--- a/tools/lldb-mi/MICmdCmdVar.h
+++ /dev/null
@@ -1,348 +0,0 @@
-//===-- MICmdCmdVar.h -------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Overview: CMICmdCmdVarCreate interface.
-// CMICmdCmdVarUpdate interface.
-// CMICmdCmdVarDelete interface.
-// CMICmdCmdVarAssign interface.
-// CMICmdCmdVarSetFormat interface.
-// CMICmdCmdVarListChildren interface.
-// CMICmdCmdVarEvaluateExpression interface.
-// CMICmdCmdVarInfoPathExpression interface.
-// CMICmdCmdVarShowAttributes interface.
-//
-// To implement new MI commands derive a new command class from the
-// command base
-// class. To enable the new command for interpretation add the new
-// command class
-// to the command factory. The files of relevance are:
-// MICmdCommands.cpp
-// MICmdBase.h / .cpp
-// MICmdCmd.h / .cpp
-// For an introduction to adding a new command see
-// CMICmdCmdSupportInfoMiCmdQuery
-// command class as an example.
-
-#pragma once
-
-// In-house headers:
-#include "MICmdBase.h"
-#include "MICmnLLDBDebugSessionInfo.h"
-#include "MICmnLLDBDebugSessionInfoVarObj.h"
-#include "MICmnMIValueList.h"
-#include "MICmnMIValueTuple.h"
-
-// Declarations:
-class CMICmnLLDBDebugSessionInfoVarObj;
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-create".
-//--
-class CMICmdCmdVarCreate : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdVarCreate();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
-
- // Overridden:
-public:
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdVarCreate() override;
-
- // Methods:
-private:
- void CompleteSBValue(lldb::SBValue &vrwValue);
-
- // Attribute:
-private:
- CMIUtilString m_strVarName;
- MIuint m_nChildren;
- MIuint64 m_nThreadId;
- CMIUtilString m_strType;
- bool m_bValid; // True = Variable is valid, false = not valid
- CMIUtilString m_strExpression;
- CMIUtilString m_strValue;
- const CMIUtilString m_constStrArgName;
- const CMIUtilString m_constStrArgFrameAddr;
- const CMIUtilString m_constStrArgExpression;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-update".
-//--
-class CMICmdCmdVarUpdate : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdVarUpdate();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
-
- // Overridden:
-public:
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdVarUpdate() override;
-
- // Methods:
-private:
- bool ExamineSBValueForChange(lldb::SBValue &vrwValue, bool &vrwbChanged);
- void MIFormResponse(const CMIUtilString &vrStrVarName,
- const char *const vpValue,
- const CMIUtilString &vrStrScope);
-
- // Attribute:
-private:
- const CMIUtilString m_constStrArgPrintValues;
- const CMIUtilString m_constStrArgName;
- bool m_bValueChanged; // True = yes value changed, false = no change
- CMICmnMIValueList m_miValueList;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-delete".
-//--
-class CMICmdCmdVarDelete : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdVarDelete();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdVarDelete() override;
-
- // Attribute:
-private:
- const CMIUtilString m_constStrArgName;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-assign".
-//--
-class CMICmdCmdVarAssign : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdVarAssign();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdVarAssign() override;
-
- // Attributes:
-private:
- bool m_bOk; // True = success, false = failure
- CMIUtilString m_varObjName;
- const CMIUtilString m_constStrArgName;
- const CMIUtilString m_constStrArgExpression;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-set-format".
-//--
-class CMICmdCmdVarSetFormat : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdVarSetFormat();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdVarSetFormat() override;
-
- // Attributes:
-private:
- CMIUtilString m_varObjName;
- const CMIUtilString m_constStrArgName;
- const CMIUtilString m_constStrArgFormatSpec;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-list-children".
-//--
-class CMICmdCmdVarListChildren : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdVarListChildren();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdVarListChildren() override;
-
- // Attributes:
-private:
- const CMIUtilString m_constStrArgPrintValues;
- const CMIUtilString m_constStrArgName;
- const CMIUtilString m_constStrArgFrom;
- const CMIUtilString m_constStrArgTo;
- bool m_bValueValid; // True = yes SBValue object is valid, false = not valid
- MIuint m_nChildren;
- CMICmnMIValueList m_miValueList;
- bool m_bHasMore;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-evaluate-expression".
-//--
-class CMICmdCmdVarEvaluateExpression : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdVarEvaluateExpression();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdVarEvaluateExpression() override;
-
- // Attributes:
-private:
- bool m_bValueValid; // True = yes SBValue object is valid, false = not valid
- CMIUtilString m_varObjName;
- const CMIUtilString m_constStrArgFormatSpec; // Not handled by *this command
- const CMIUtilString m_constStrArgName;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-info-path-expression".
-//--
-class CMICmdCmdVarInfoPathExpression : public CMICmdBase {
- // Statics:
-public:
- // Required by the CMICmdFactory when registering *this command
- static CMICmdBase *CreateSelf();
-
- // Methods:
-public:
- /* ctor */ CMICmdCmdVarInfoPathExpression();
-
- // Overridden:
-public:
- // From CMICmdInvoker::ICmd
- bool Execute() override;
- bool Acknowledge() override;
- bool ParseArgs() override;
- // From CMICmnBase
- /* dtor */ ~CMICmdCmdVarInfoPathExpression() override;
-
- // Attributes:
-private:
- bool m_bValueValid; // True = yes SBValue object is valid, false = not valid
- CMIUtilString m_strPathExpression;
- const CMIUtilString m_constStrArgName;
-};
-
-//++
-//============================================================================
-// Details: MI command class. MI commands derived from the command base class.
-// *this class implements MI command "var-show-attributes".
-//--
-class CMICmdCmdVarShowAttributes : public CMICmdBase {
- // Statics:
-p