]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCmdGdbSet.h
Update lldb to upstream trunk r242221.
[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 // Gotchas: None.
41 // Authors: Illya Rudkin 03/03/2014.
42 // Changes: None.
43 //--
44 class CMICmdCmdGdbSet : public CMICmdBase
45 {
46     // Statics:
47   public:
48     // Required by the CMICmdFactory when registering *this command
49     static CMICmdBase *CreateSelf(void);
50
51     // Methods:
52   public:
53     /* ctor */ CMICmdCmdGdbSet(void);
54
55     // Overridden:
56   public:
57     // From CMICmdInvoker::ICmd
58     bool Execute(void) override;
59     bool Acknowledge(void) override;
60     bool ParseArgs(void) override;
61     // From CMICmnBase
62     /* dtor */ ~CMICmdCmdGdbSet(void) override;
63
64     // Typedefs:
65   private:
66     typedef bool (CMICmdCmdGdbSet::*FnGdbOptionPtr)(const CMIUtilString::VecString_t &vrWords);
67     typedef std::map<CMIUtilString, FnGdbOptionPtr> MapGdbOptionNameToFnGdbOptionPtr_t;
68
69     // Methods:
70   private:
71     bool GetOptionFn(const CMIUtilString &vrGdbOptionName, FnGdbOptionPtr &vrwpFn) const;
72     bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
73     bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
74     bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
75     bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
76     bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
77
78     // Attributes:
79   private:
80     const static MapGdbOptionNameToFnGdbOptionPtr_t ms_mapGdbOptionNameToFnGdbOptionPtr;
81     //
82     const CMIUtilString m_constStrArgNamedThreadGrp;
83     const CMIUtilString m_constStrArgNamedGdbOption;
84     bool m_bGdbOptionRecognised;   // True = This command has a function with a name that matches the Print argument, false = not found
85     bool m_bGdbOptionFnSuccessful; // True = The print function completed its task ok, false = function failed for some reason
86     bool m_bGbbOptionFnHasError;   // True = The option function has an error condition (not the command!), false = option function ok.
87     CMIUtilString m_strGdbOptionName;
88     CMIUtilString m_strGdbOptionFnError;
89 };