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