2015-07-21 21:09:39 +08:00
|
|
|
//===-- MICmdCmdGdbInfo.h ---------------------------------------*- C++ -*-===//
|
2014-06-25 00:35:50 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
// Overview: CMICmdCmdGdbInfo interface.
|
2014-06-25 00:35:50 +08:00
|
|
|
//
|
2016-09-07 04:57:50 +08:00
|
|
|
// To implement new MI commands derive a new command class from the
|
|
|
|
// command base
|
|
|
|
// class. To enable the new command for interpretation add the new
|
|
|
|
// command class
|
2014-11-18 02:06:21 +08:00
|
|
|
// to the command factory. The files of relevance are:
|
|
|
|
// MICmdCommands.cpp
|
|
|
|
// MICmdBase.h / .cpp
|
|
|
|
// MICmdCmd.h / .cpp
|
2016-09-07 04:57:50 +08:00
|
|
|
// For an introduction to adding a new command see
|
|
|
|
// CMICmdCmdSupportInfoMiCmdQuery
|
2014-11-18 02:06:21 +08:00
|
|
|
// command class as an example.
|
2014-06-25 00:35:50 +08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Third party headers:
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
// In-house headers:
|
|
|
|
#include "MICmdBase.h"
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//++
|
|
|
|
//============================================================================
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: MI command class. MI commands derived from the command base class.
|
|
|
|
// *this class implements GDB command "info".
|
|
|
|
// The design of matching the info request to a request action (or
|
|
|
|
// command) is very simple. The request function which carries out
|
|
|
|
// the task of information gathering and printing to stdout is part of
|
2016-09-07 04:57:50 +08:00
|
|
|
// *this class. Should the request function become more complicated
|
|
|
|
// then
|
2014-11-18 02:06:21 +08:00
|
|
|
// that request should really reside in a command type class. Then this
|
2016-09-07 04:57:50 +08:00
|
|
|
// class instantiates a request info command for a matching request.
|
|
|
|
// The
|
2014-11-18 02:06:21 +08:00
|
|
|
// design/code of *this class then does not then become bloated. Use a
|
|
|
|
// lightweight version of the current MI command system.
|
2014-06-25 00:35:50 +08:00
|
|
|
//--
|
2016-09-07 04:57:50 +08:00
|
|
|
class CMICmdCmdGdbInfo : public CMICmdBase {
|
|
|
|
// Statics:
|
|
|
|
public:
|
|
|
|
// Required by the CMICmdFactory when registering *this command
|
|
|
|
static CMICmdBase *CreateSelf();
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Methods:
|
|
|
|
public:
|
|
|
|
/* ctor */ CMICmdCmdGdbInfo();
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Overridden:
|
|
|
|
public:
|
|
|
|
// From CMICmdInvoker::ICmd
|
|
|
|
bool Execute() override;
|
|
|
|
bool Acknowledge() override;
|
|
|
|
bool ParseArgs() override;
|
|
|
|
// From CMICmnBase
|
|
|
|
/* dtor */ ~CMICmdCmdGdbInfo() override;
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Typedefs:
|
|
|
|
private:
|
|
|
|
typedef bool (CMICmdCmdGdbInfo::*FnPrintPtr)();
|
|
|
|
typedef std::map<CMIUtilString, FnPrintPtr> MapPrintFnNameToPrintFn_t;
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Methods:
|
|
|
|
private:
|
|
|
|
bool GetPrintFn(const CMIUtilString &vrPrintFnName, FnPrintPtr &vrwpFn) const;
|
|
|
|
bool PrintFnSharedLibrary();
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Attributes:
|
|
|
|
private:
|
|
|
|
const static MapPrintFnNameToPrintFn_t ms_mapPrintFnNameToPrintFn;
|
|
|
|
//
|
|
|
|
const CMIUtilString m_constStrArgNamedPrint;
|
|
|
|
bool m_bPrintFnRecognised; // True = This command has a function with a name
|
|
|
|
// that matches the Print argument, false = not
|
|
|
|
// found
|
|
|
|
bool m_bPrintFnSuccessful; // True = The print function completed its task ok,
|
|
|
|
// false = function failed for some reason
|
|
|
|
CMIUtilString m_strPrintFnName;
|
|
|
|
CMIUtilString m_strPrintFnError;
|
2014-11-18 02:06:21 +08:00
|
|
|
};
|