1 //===-- MICmdCmdGdbInfo.h ---------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // Overview: CMICmdCmdGdbInfo interface.
11 // To implement new MI commands derive a new command class from the
13 // class. To enable the new command for interpretation add the new
15 // to the command factory. The files of relevance are:
19 // For an introduction to adding a new command see
20 // CMICmdCmdSupportInfoMiCmdQuery
21 // command class as an example.
25 // Third party headers:
29 #include "MICmdBase.h"
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
40 // that request should really reside in a command type class. Then this
41 // class instantiates a request info command for a matching request.
43 // design/code of *this class then does not then become bloated. Use a
44 // lightweight version of the current MI command system.
46 class CMICmdCmdGdbInfo : public CMICmdBase {
49 // Required by the CMICmdFactory when registering *this command
50 static CMICmdBase *CreateSelf();
54 /* ctor */ CMICmdCmdGdbInfo();
58 // From CMICmdInvoker::ICmd
59 bool Execute() override;
60 bool Acknowledge() override;
61 bool ParseArgs() override;
63 /* dtor */ ~CMICmdCmdGdbInfo() override;
67 typedef bool (CMICmdCmdGdbInfo::*FnPrintPtr)();
68 typedef std::map<CMIUtilString, FnPrintPtr> MapPrintFnNameToPrintFn_t;
72 bool GetPrintFn(const CMIUtilString &vrPrintFnName, FnPrintPtr &vrwpFn) const;
73 bool PrintFnSharedLibrary();
77 const static MapPrintFnNameToPrintFn_t ms_mapPrintFnNameToPrintFn;
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
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;