]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCmdGdbSet.h
MFV r310622:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdCmdGdbSet.h
1 //===-- MICmdCmdGdbSet.h ----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // Overview:    CMICmdCmdGdbSet interface.
11 //
12 //              To implement new MI commands, derive a new command class from the command base
13 //              class. To enable the new command for interpretation add the new command class
14 //              to the command factory. The files of relevance are:
15 //                  MICmdCommands.cpp
16 //                  MICmdBase.h / .cpp
17 //                  MICmdCmd.h / .cpp
18 //              For an introduction to adding a new command see CMICmdCmdSupportInfoMiCmdQuery
19 //              command class as an example.
20
21 #pragma once
22
23 // In-house headers:
24 #include "MICmdBase.h"
25
26 //++ ============================================================================
27 // Details: MI command class. MI commands derived from the command base class.
28 //          *this class implements MI command "gdb-set".
29 //          This command does not follow the MI documentation exactly. While *this
30 //          command is implemented it does not do anything with the gdb-set
31 //          variable past in.
32 //          The design of matching the info request to a request action (or
33 //          command) is very simple. The request function which carries out
34 //          the task of information gathering and printing to stdout is part of
35 //          *this class. Should the request function become more complicated then
36 //          that request should really reside in a command type class. Then this
37 //          class instantiates a request info command for a matching request. The
38 //          design/code of *this class then does not then become bloated. Use a
39 //          lightweight version of the current MI command system.
40 //--
41 class CMICmdCmdGdbSet : public CMICmdBase
42 {
43     // Statics:
44   public:
45     // Required by the CMICmdFactory when registering *this command
46     static CMICmdBase *CreateSelf();
47
48     // Methods:
49   public:
50     /* ctor */ CMICmdCmdGdbSet();
51
52     // Overridden:
53   public:
54     // From CMICmdInvoker::ICmd
55     bool Execute() override;
56     bool Acknowledge() override;
57     bool ParseArgs() override;
58     // From CMICmnBase
59     /* dtor */ ~CMICmdCmdGdbSet() override;
60
61     // Typedefs:
62   private:
63     typedef bool (CMICmdCmdGdbSet::*FnGdbOptionPtr)(const CMIUtilString::VecString_t &vrWords);
64     typedef std::map<CMIUtilString, FnGdbOptionPtr> MapGdbOptionNameToFnGdbOptionPtr_t;
65
66     // Methods:
67   private:
68     bool GetOptionFn(const CMIUtilString &vrGdbOptionName, FnGdbOptionPtr &vrwpFn) const;
69     bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
70     bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
71     bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
72     bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
73     bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
74
75     // Attributes:
76   private:
77     const static MapGdbOptionNameToFnGdbOptionPtr_t ms_mapGdbOptionNameToFnGdbOptionPtr;
78     //
79     const CMIUtilString m_constStrArgNamedGdbOption;
80     bool m_bGdbOptionRecognised;   // True = This command has a function with a name that matches the Print argument, false = not found
81     bool m_bGdbOptionFnSuccessful; // True = The print function completed its task ok, false = function failed for some reason
82     bool m_bGbbOptionFnHasError;   // True = The option function has an error condition (not the command!), false = option function ok.
83     CMIUtilString m_strGdbOptionName;
84     CMIUtilString m_strGdbOptionFnError;
85 };