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 // Authors: Illya Rudkin 03/03/2014.
44 class CMICmdCmdGdbSet : public CMICmdBase
48 // Required by the CMICmdFactory when registering *this command
49 static CMICmdBase *CreateSelf(void);
53 /* ctor */ CMICmdCmdGdbSet(void);
57 // From CMICmdInvoker::ICmd
58 bool Execute(void) override;
59 bool Acknowledge(void) override;
60 bool ParseArgs(void) override;
62 /* dtor */ ~CMICmdCmdGdbSet(void) override;
66 typedef bool (CMICmdCmdGdbSet::*FnGdbOptionPtr)(const CMIUtilString::VecString_t &vrWords);
67 typedef std::map<CMIUtilString, FnGdbOptionPtr> MapGdbOptionNameToFnGdbOptionPtr_t;
71 bool GetOptionFn(const CMIUtilString &vrGdbOptionName, FnGdbOptionPtr &vrwpFn) const;
72 bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
73 bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
74 bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
75 bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
76 bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
80 const static MapGdbOptionNameToFnGdbOptionPtr_t ms_mapGdbOptionNameToFnGdbOptionPtr;
82 const CMIUtilString m_constStrArgNamedThreadGrp;
83 const CMIUtilString m_constStrArgNamedGdbOption;
84 bool m_bGdbOptionRecognised; // True = This command has a function with a name that matches the Print argument, false = not found
85 bool m_bGdbOptionFnSuccessful; // True = The print function completed its task ok, false = function failed for some reason
86 bool m_bGbbOptionFnHasError; // True = The option function has an error condition (not the command!), false = option function ok.
87 CMIUtilString m_strGdbOptionName;
88 CMIUtilString m_strGdbOptionFnError;