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