]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/lldb-mi/MICmdCmdGdbShow.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / tools / lldb-mi / MICmdCmdGdbShow.h
1 //===-- MICmdCmdGdbShow.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:    CMICmdCmdGdbShow 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-show".
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 CMICmdCmdGdbShow : 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 */ CMICmdCmdGdbShow();
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 */ ~CMICmdCmdGdbShow() override;
66
67   // Typedefs:
68 private:
69   typedef bool (CMICmdCmdGdbShow::*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 OptionFnLanguage(const CMIUtilString::VecString_t &vrWords);
81   bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
82
83   // Attributes:
84 private:
85   const static MapGdbOptionNameToFnGdbOptionPtr_t
86       ms_mapGdbOptionNameToFnGdbOptionPtr;
87
88   const CMIUtilString m_constStrArgNamedGdbOption;
89   bool m_bGdbOptionRecognised; // True = This command has a function with a name
90                                // that matches the Print argument, false = not
91                                // found
92   bool m_bGdbOptionFnSuccessful; // True = The print function completed its task
93                                  // ok, false = function failed for some reason
94   bool m_bGbbOptionFnHasError;   // True = The option function has an error
95                                  // condition (not the command!), false = option
96                                  // function ok.
97   CMIUtilString m_strGdbOptionName;
98   CMIUtilString m_strGdbOptionFnError;
99   CMIUtilString m_strValue;
100 };