blob: c88f9976ef65961b6112add5dbe7bdd5dcf9146f [file] [log] [blame]
Ilia Ke771b592015-03-23 20:46:10 +00001//===-- MICmdCmdGdbSet.h ----------------------------------------*- C++ -*-===//
Deepak Panickal877569c2014-06-24 16:35:50 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Deepak Panickal877569c2014-06-24 16:35:50 +00006//
7//===----------------------------------------------------------------------===//
8
Zachary Turner1d6af022014-11-17 18:06:21 +00009// Overview: CMICmdCmdGdbSet interface.
Deepak Panickal877569c2014-06-24 16:35:50 +000010//
Kate Stoneb9c1b512016-09-06 20:57:50 +000011// To implement new MI commands, derive a new command class from
12// the command base
13// class. To enable the new command for interpretation add the new
14// command class
Zachary Turner1d6af022014-11-17 18:06:21 +000015// to the command factory. The files of relevance are:
16// MICmdCommands.cpp
17// MICmdBase.h / .cpp
18// MICmdCmd.h / .cpp
Kate Stoneb9c1b512016-09-06 20:57:50 +000019// For an introduction to adding a new command see
20// CMICmdCmdSupportInfoMiCmdQuery
Zachary Turner1d6af022014-11-17 18:06:21 +000021// command class as an example.
Deepak Panickal877569c2014-06-24 16:35:50 +000022
23#pragma once
24
25// In-house headers:
26#include "MICmdBase.h"
27
Kate Stoneb9c1b512016-09-06 20:57:50 +000028//++
29//============================================================================
Zachary Turner1d6af022014-11-17 18:06:21 +000030// Details: MI command class. MI commands derived from the command base class.
31// *this class implements MI command "gdb-set".
Kate Stoneb9c1b512016-09-06 20:57:50 +000032// This command does not follow the MI documentation exactly. While
33// *this
Zachary Turner1d6af022014-11-17 18:06:21 +000034// command is implemented it does not do anything with the gdb-set
35// variable past in.
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
Kate Stoneb9c1b512016-09-06 20:57:50 +000039// *this class. Should the request function become more complicated
40// then
Zachary Turner1d6af022014-11-17 18:06:21 +000041// that request should really reside in a command type class. Then this
Kate Stoneb9c1b512016-09-06 20:57:50 +000042// class instantiates a request info command for a matching request.
43// The
Zachary Turner1d6af022014-11-17 18:06:21 +000044// design/code of *this class then does not then become bloated. Use a
45// lightweight version of the current MI command system.
Deepak Panickal877569c2014-06-24 16:35:50 +000046//--
Kate Stoneb9c1b512016-09-06 20:57:50 +000047class CMICmdCmdGdbSet : public CMICmdBase {
48 // Statics:
49public:
50 // Required by the CMICmdFactory when registering *this command
51 static CMICmdBase *CreateSelf();
Deepak Panickal877569c2014-06-24 16:35:50 +000052
Kate Stoneb9c1b512016-09-06 20:57:50 +000053 // Methods:
54public:
55 /* ctor */ CMICmdCmdGdbSet();
Deepak Panickal877569c2014-06-24 16:35:50 +000056
Kate Stoneb9c1b512016-09-06 20:57:50 +000057 // Overridden:
58public:
59 // From CMICmdInvoker::ICmd
60 bool Execute() override;
61 bool Acknowledge() override;
62 bool ParseArgs() override;
63 // From CMICmnBase
64 /* dtor */ ~CMICmdCmdGdbSet() override;
Deepak Panickal877569c2014-06-24 16:35:50 +000065
Kate Stoneb9c1b512016-09-06 20:57:50 +000066 // Typedefs:
67private:
68 typedef bool (CMICmdCmdGdbSet::*FnGdbOptionPtr)(
69 const CMIUtilString::VecString_t &vrWords);
70 typedef std::map<CMIUtilString, FnGdbOptionPtr>
71 MapGdbOptionNameToFnGdbOptionPtr_t;
Deepak Panickal877569c2014-06-24 16:35:50 +000072
Kate Stoneb9c1b512016-09-06 20:57:50 +000073 // Methods:
74private:
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);
Hafiz Abid Qadeer5e9bfc62017-01-05 13:23:47 +000081 bool OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords);
Marc-Andre Laperled8e14a52018-10-30 03:10:41 +000082 bool OptionFnBreakpoint(const CMIUtilString::VecString_t &vrWords);
Kate Stoneb9c1b512016-09-06 20:57:50 +000083 bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
Deepak Panickal877569c2014-06-24 16:35:50 +000084
Kate Stoneb9c1b512016-09-06 20:57:50 +000085 // Attributes:
86private:
87 const static MapGdbOptionNameToFnGdbOptionPtr_t
88 ms_mapGdbOptionNameToFnGdbOptionPtr;
89 //
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
93 // found
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
98 // function ok.
99 CMIUtilString m_strGdbOptionName;
100 CMIUtilString m_strGdbOptionFnError;
Zachary Turner1d6af022014-11-17 18:06:21 +0000101};