1 //===-- MICmdCmdGdbSet.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: CMICmdCmdGdbSet interface.
11 // To implement new MI commands, derive a new command class from
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.
26 #include "MICmdBase.h"
29 //============================================================================
30 // Details: MI command class. MI commands derived from the command base class.
31 // *this class implements MI command "gdb-set".
32 // This command does not follow the MI documentation exactly. While
34 // command is implemented it does not do anything with the gdb-set
36 // The design of matching the info request to a request action (or
37 // command) is very simple. The request function which carries out
38 // the task of information gathering and printing to stdout is part of
39 // *this class. Should the request function become more complicated
41 // that request should really reside in a command type class. Then this
42 // class instantiates a request info command for a matching request.
44 // design/code of *this class then does not then become bloated. Use a
45 // lightweight version of the current MI command system.
47 class CMICmdCmdGdbSet : public CMICmdBase {
50 // Required by the CMICmdFactory when registering *this command
51 static CMICmdBase *CreateSelf();
55 /* ctor */ CMICmdCmdGdbSet();
59 // From CMICmdInvoker::ICmd
60 bool Execute() override;
61 bool Acknowledge() override;
62 bool ParseArgs() override;
64 /* dtor */ ~CMICmdCmdGdbSet() override;
68 typedef bool (CMICmdCmdGdbSet::*FnGdbOptionPtr)(
69 const CMIUtilString::VecString_t &vrWords);
70 typedef std::map<CMIUtilString, FnGdbOptionPtr>
71 MapGdbOptionNameToFnGdbOptionPtr_t;
75 bool GetOptionFn(const CMIUtilString &vrGdbOptionName,
76 FnGdbOptionPtr &vrwpFn) const;
77 bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
78 bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
79 bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
80 bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
81 bool OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords);
82 bool OptionFnBreakpoint(const CMIUtilString::VecString_t &vrWords);
83 bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
87 const static MapGdbOptionNameToFnGdbOptionPtr_t
88 ms_mapGdbOptionNameToFnGdbOptionPtr;
90 const CMIUtilString m_constStrArgNamedGdbOption;
91 bool m_bGdbOptionRecognised; // True = This command has a function with a name
92 // that matches the Print argument, false = not
94 bool m_bGdbOptionFnSuccessful; // True = The print function completed its task
95 // ok, false = function failed for some reason
96 bool m_bGbbOptionFnHasError; // True = The option function has an error
97 // condition (not the command!), false = option
99 CMIUtilString m_strGdbOptionName;
100 CMIUtilString m_strGdbOptionFnError;