]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCmdGdbInfo.h
MFV r316693:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdCmdGdbInfo.h
1 //===-- MICmdCmdGdbInfo.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:    CMICmdCmdGdbInfo    interface.
11 //
12 //              To implement new MI commands derive a new command class from the
13 //              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 // Third party headers:
27 #include <map>
28
29 // In-house headers:
30 #include "MICmdBase.h"
31
32 //++
33 //============================================================================
34 // Details: MI command class. MI commands derived from the command base class.
35 //          *this class implements GDB command "info".
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 CMICmdCmdGdbInfo : 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 */ CMICmdCmdGdbInfo();
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 */ ~CMICmdCmdGdbInfo() override;
65
66   // Typedefs:
67 private:
68   typedef bool (CMICmdCmdGdbInfo::*FnPrintPtr)();
69   typedef std::map<CMIUtilString, FnPrintPtr> MapPrintFnNameToPrintFn_t;
70
71   // Methods:
72 private:
73   bool GetPrintFn(const CMIUtilString &vrPrintFnName, FnPrintPtr &vrwpFn) const;
74   bool PrintFnSharedLibrary();
75
76   // Attributes:
77 private:
78   const static MapPrintFnNameToPrintFn_t ms_mapPrintFnNameToPrintFn;
79   //
80   const CMIUtilString m_constStrArgNamedPrint;
81   bool m_bPrintFnRecognised; // True = This command has a function with a name
82                              // that matches the Print argument, false = not
83                              // found
84   bool m_bPrintFnSuccessful; // True = The print function completed its task ok,
85                              // false = function failed for some reason
86   CMIUtilString m_strPrintFnName;
87   CMIUtilString m_strPrintFnError;
88 };