blob: 98017baf2b906f8bfdfbbff857c785be44cccf04 [file] [log] [blame]
Ilia Ke771b592015-03-23 20:46:10 +00001//===-- MICmdCmdGdbSet.h ----------------------------------------*- C++ -*-===//
Deepak Panickal877569c2014-06-24 16:35:50 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Zachary Turner1d6af022014-11-17 18:06:21 +000010// Overview: CMICmdCmdGdbSet interface.
Deepak Panickal877569c2014-06-24 16:35:50 +000011//
Kate Stoneb9c1b512016-09-06 20:57:50 +000012// To implement new MI commands, derive a new command class from
13// the command base
14// class. To enable the new command for interpretation add the new
15// command class
Zachary Turner1d6af022014-11-17 18:06:21 +000016// to the command factory. The files of relevance are:
17// MICmdCommands.cpp
18// MICmdBase.h / .cpp
19// MICmdCmd.h / .cpp
Kate Stoneb9c1b512016-09-06 20:57:50 +000020// For an introduction to adding a new command see
21// CMICmdCmdSupportInfoMiCmdQuery
Zachary Turner1d6af022014-11-17 18:06:21 +000022// command class as an example.
Deepak Panickal877569c2014-06-24 16:35:50 +000023
24#pragma once
25
26// In-house headers:
27#include "MICmdBase.h"
28
Kate Stoneb9c1b512016-09-06 20:57:50 +000029//++
30//============================================================================
Zachary Turner1d6af022014-11-17 18:06:21 +000031// Details: MI command class. MI commands derived from the command base class.
32// *this class implements MI command "gdb-set".
Kate Stoneb9c1b512016-09-06 20:57:50 +000033// This command does not follow the MI documentation exactly. While
34// *this
Zachary Turner1d6af022014-11-17 18:06:21 +000035// command is implemented it does not do anything with the gdb-set
36// variable past in.
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
Kate Stoneb9c1b512016-09-06 20:57:50 +000040// *this class. Should the request function become more complicated
41// then
Zachary Turner1d6af022014-11-17 18:06:21 +000042// that request should really reside in a command type class. Then this
Kate Stoneb9c1b512016-09-06 20:57:50 +000043// class instantiates a request info command for a matching request.
44// The
Zachary Turner1d6af022014-11-17 18:06:21 +000045// design/code of *this class then does not then become bloated. Use a
46// lightweight version of the current MI command system.
Deepak Panickal877569c2014-06-24 16:35:50 +000047//--
Kate Stoneb9c1b512016-09-06 20:57:50 +000048class CMICmdCmdGdbSet : public CMICmdBase {
49 // Statics:
50public:
51 // Required by the CMICmdFactory when registering *this command
52 static CMICmdBase *CreateSelf();
Deepak Panickal877569c2014-06-24 16:35:50 +000053
Kate Stoneb9c1b512016-09-06 20:57:50 +000054 // Methods:
55public:
56 /* ctor */ CMICmdCmdGdbSet();
Deepak Panickal877569c2014-06-24 16:35:50 +000057
Kate Stoneb9c1b512016-09-06 20:57:50 +000058 // Overridden:
59public:
60 // From CMICmdInvoker::ICmd
61 bool Execute() override;
62 bool Acknowledge() override;
63 bool ParseArgs() override;
64 // From CMICmnBase
65 /* dtor */ ~CMICmdCmdGdbSet() override;
Deepak Panickal877569c2014-06-24 16:35:50 +000066
Kate Stoneb9c1b512016-09-06 20:57:50 +000067 // Typedefs:
68private:
69 typedef bool (CMICmdCmdGdbSet::*FnGdbOptionPtr)(
70 const CMIUtilString::VecString_t &vrWords);
71 typedef std::map<CMIUtilString, FnGdbOptionPtr>
72 MapGdbOptionNameToFnGdbOptionPtr_t;
Deepak Panickal877569c2014-06-24 16:35:50 +000073
Kate Stoneb9c1b512016-09-06 20:57:50 +000074 // Methods:
75private:
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 OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
81 bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
82 bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
Deepak Panickal877569c2014-06-24 16:35:50 +000083
Kate Stoneb9c1b512016-09-06 20:57:50 +000084 // Attributes:
85private:
86 const static MapGdbOptionNameToFnGdbOptionPtr_t
87 ms_mapGdbOptionNameToFnGdbOptionPtr;
88 //
89 const CMIUtilString m_constStrArgNamedGdbOption;
90 bool m_bGdbOptionRecognised; // True = This command has a function with a name
91 // that matches the Print argument, false = not
92 // found
93 bool m_bGdbOptionFnSuccessful; // True = The print function completed its task
94 // ok, false = function failed for some reason
95 bool m_bGbbOptionFnHasError; // True = The option function has an error
96 // condition (not the command!), false = option
97 // function ok.
98 CMIUtilString m_strGdbOptionName;
99 CMIUtilString m_strGdbOptionFnError;
Zachary Turner1d6af022014-11-17 18:06:21 +0000100};