1 //===-- MICmdCmdGdbShow.h ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Overview: CMICmdCmdGdbShow interface.
12 // To implement new MI commands, derive a new command class from
14 // class. To enable the new command for interpretation add the new
16 // to the command factory. The files of relevance are:
20 // For an introduction to adding a new command see
21 // CMICmdCmdSupportInfoMiCmdQuery
22 // command class as an example.
27 #include "MICmdBase.h"
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
35 // command is implemented it does not do anything with the gdb-set
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
42 // that request should really reside in a command type class. Then this
43 // class instantiates a request info command for a matching request.
45 // design/code of *this class then does not then become bloated. Use a
46 // lightweight version of the current MI command system.
48 class CMICmdCmdGdbShow : public CMICmdBase {
51 // Required by the CMICmdFactory when registering *this command
52 static CMICmdBase *CreateSelf();
56 /* ctor */ CMICmdCmdGdbShow();
60 // From CMICmdInvoker::ICmd
61 bool Execute() override;
62 bool Acknowledge() override;
63 bool ParseArgs() override;
65 /* dtor */ ~CMICmdCmdGdbShow() override;
69 typedef bool (CMICmdCmdGdbShow::*FnGdbOptionPtr)(
70 const CMIUtilString::VecString_t &vrWords);
71 typedef std::map<CMIUtilString, FnGdbOptionPtr>
72 MapGdbOptionNameToFnGdbOptionPtr_t;
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);
85 const static MapGdbOptionNameToFnGdbOptionPtr_t
86 ms_mapGdbOptionNameToFnGdbOptionPtr;
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
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
97 CMIUtilString m_strGdbOptionName;
98 CMIUtilString m_strGdbOptionFnError;
99 CMIUtilString m_strValue;