]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCmdGdbInfo.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdCmdGdbInfo.h
1 //===-- MICmdCmdGdbInfo.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:    CMICmdCmdGdbInfo    interface.
10 //
11 //              To implement new MI commands derive a new command class from the
12 //              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 // Third party headers:
26 #include <map>
27
28 // In-house headers:
29 #include "MICmdBase.h"
30
31 //++
32 //============================================================================
33 // Details: MI command class. MI commands derived from the command base class.
34 //          *this class implements GDB command "info".
35 //          The design of matching the info request to a request action (or
36 //          command) is very simple. The request function which carries out
37 //          the task of information gathering and printing to stdout is part of
38 //          *this class. Should the request function become more complicated
39 //          then
40 //          that request should really reside in a command type class. Then this
41 //          class instantiates a request info command for a matching request.
42 //          The
43 //          design/code of *this class then does not then become bloated. Use a
44 //          lightweight version of the current MI command system.
45 //--
46 class CMICmdCmdGdbInfo : public CMICmdBase {
47   // Statics:
48 public:
49   // Required by the CMICmdFactory when registering *this command
50   static CMICmdBase *CreateSelf();
51
52   // Methods:
53 public:
54   /* ctor */ CMICmdCmdGdbInfo();
55
56   // Overridden:
57 public:
58   // From CMICmdInvoker::ICmd
59   bool Execute() override;
60   bool Acknowledge() override;
61   bool ParseArgs() override;
62   // From CMICmnBase
63   /* dtor */ ~CMICmdCmdGdbInfo() override;
64
65   // Typedefs:
66 private:
67   typedef bool (CMICmdCmdGdbInfo::*FnPrintPtr)();
68   typedef std::map<CMIUtilString, FnPrintPtr> MapPrintFnNameToPrintFn_t;
69
70   // Methods:
71 private:
72   bool GetPrintFn(const CMIUtilString &vrPrintFnName, FnPrintPtr &vrwpFn) const;
73   bool PrintFnSharedLibrary();
74
75   // Attributes:
76 private:
77   const static MapPrintFnNameToPrintFn_t ms_mapPrintFnNameToPrintFn;
78   //
79   const CMIUtilString m_constStrArgNamedPrint;
80   bool m_bPrintFnRecognised; // True = This command has a function with a name
81                              // that matches the Print argument, false = not
82                              // found
83   bool m_bPrintFnSuccessful; // True = The print function completed its task ok,
84                              // false = function failed for some reason
85   CMIUtilString m_strPrintFnName;
86   CMIUtilString m_strPrintFnError;
87 };