1 //===-- MICmdCmdGdbSet.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: CMICmdCmdGdbSet interface.
12 // To implement new MI commands, derive a new command class from the command base
13 // class. To enable the new command for interpretation add the new command class
14 // to the command factory. The files of relevance are:
18 // For an introduction to adding a new command see CMICmdCmdSupportInfoMiCmdQuery
19 // command class as an example.
24 #include "MICmdBase.h"
26 //++ ============================================================================
27 // Details: MI command class. MI commands derived from the command base class.
28 // *this class implements MI command "gdb-set".
29 // This command does not follow the MI documentation exactly. While *this
30 // command is implemented it does not do anything with the gdb-set
32 // The design of matching the info request to a request action (or
33 // command) is very simple. The request function which carries out
34 // the task of information gathering and printing to stdout is part of
35 // *this class. Should the request function become more complicated then
36 // that request should really reside in a command type class. Then this
37 // class instantiates a request info command for a matching request. The
38 // design/code of *this class then does not then become bloated. Use a
39 // lightweight version of the current MI command system.
41 class CMICmdCmdGdbSet : public CMICmdBase
45 // Required by the CMICmdFactory when registering *this command
46 static CMICmdBase *CreateSelf();
50 /* ctor */ CMICmdCmdGdbSet();
54 // From CMICmdInvoker::ICmd
55 bool Execute() override;
56 bool Acknowledge() override;
57 bool ParseArgs() override;
59 /* dtor */ ~CMICmdCmdGdbSet() override;
63 typedef bool (CMICmdCmdGdbSet::*FnGdbOptionPtr)(const CMIUtilString::VecString_t &vrWords);
64 typedef std::map<CMIUtilString, FnGdbOptionPtr> MapGdbOptionNameToFnGdbOptionPtr_t;
68 bool GetOptionFn(const CMIUtilString &vrGdbOptionName, FnGdbOptionPtr &vrwpFn) const;
69 bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
70 bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
71 bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
72 bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
73 bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
77 const static MapGdbOptionNameToFnGdbOptionPtr_t ms_mapGdbOptionNameToFnGdbOptionPtr;
79 const CMIUtilString m_constStrArgNamedGdbOption;
80 bool m_bGdbOptionRecognised; // True = This command has a function with a name that matches the Print argument, false = not found
81 bool m_bGdbOptionFnSuccessful; // True = The print function completed its task ok, false = function failed for some reason
82 bool m_bGbbOptionFnHasError; // True = The option function has an error condition (not the command!), false = option function ok.
83 CMIUtilString m_strGdbOptionName;
84 CMIUtilString m_strGdbOptionFnError;