1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2014 Eran Ifrah
// file name : LLDBCommand.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifndef LLDBCOMMAND_H
#define LLDBCOMMAND_H
#include "LLDBBreakpoint.h"
#include "LLDBEnums.h"
#include "LLDBPivot.h"
#include "LLDBSettings.h"
#include "JSON.h"
#include <wx/string.h>
class LLDBCommand
{
protected:
int m_commandType;
wxString m_commandArguments;
wxString m_workingDirectory;
wxString m_executable;
wxString m_redirectTTY;
LLDBBreakpoint::Vec_t m_breakpoints;
int m_interruptReason;
int m_lldbId;
wxStringMap_t m_env;
LLDBSettings m_settings;
int m_frameId;
std::vector<int> m_threadIds;
wxString m_expression;
wxString m_startupCommands;
wxString m_corefile;
int m_processID;
int m_displayFormat;
public:
// Serialization API
JSONItem ToJSON() const;
void FromJSON(const JSONItem& json);
LLDBCommand()
: m_commandType(kCommandInvalid)
, m_interruptReason(kInterruptReasonNone)
, m_lldbId(0)
, m_frameId(0)
, m_processID(wxNOT_FOUND)
, m_displayFormat((int)eLLDBFormat::kFormatDefault)
{
}
LLDBCommand(const wxString& jsonString);
virtual ~LLDBCommand();
void UpdatePaths(const LLDBPivot& pivot);
void SetDisplayFormat(const eLLDBFormat& displayFormat) { this->m_displayFormat = (int)displayFormat; }
eLLDBFormat GetDisplayFormat() const { return static_cast<eLLDBFormat>(m_displayFormat); }
void SetProcessID(int processID) { this->m_processID = processID; }
int GetProcessID() const { return m_processID; }
void SetCorefile(const wxString& corefile) { this->m_corefile = corefile; }
const wxString& GetCorefile() const { return m_corefile; }
void SetStartupCommands(const wxString& startupCommands) { this->m_startupCommands = startupCommands; }
const wxString& GetStartupCommands() const { return m_startupCommands; }
void SetExpression(const wxString& expression) { this->m_expression = expression; }
const wxString& GetExpression() const { return m_expression; }
void FillEnvFromMemory();
/**
* @brief return an environment array
* The environment array is allocated on the heap and should be deleted
* by the caller
*/
char** GetEnvArray() const;
void SetThreadIds(const std::vector<int>& threadIds) { this->m_threadIds = threadIds; }
const std::vector<int>& GetThreadIds() const { return m_threadIds; }
void Clear()
{
m_threadIds.clear();
m_frameId = wxNOT_FOUND;
m_env.clear();
m_commandType = kCommandInvalid;
m_commandArguments.clear();
m_workingDirectory.clear();
m_executable.clear();
m_redirectTTY.clear();
m_breakpoints.clear();
m_interruptReason = kInterruptReasonNone;
m_lldbId = wxNOT_FOUND;
m_expression.Clear();
m_startupCommands.Clear();
m_corefile.Clear();
m_processID = wxNOT_FOUND;
m_displayFormat = (int)eLLDBFormat::kFormatDefault;
}
void SetFrameId(int frameId) { this->m_frameId = frameId; }
int GetFrameId() const { return m_frameId; }
void SetEnv(const wxStringMap_t& env) { this->m_env = env; }
const wxStringMap_t& GetEnv() const { return m_env; }
void SetSettings(const LLDBSettings& settings) { this->m_settings = settings; }
const LLDBSettings& GetSettings() const { return m_settings; }
void SetLldbId(int lldbId) { this->m_lldbId = lldbId; }
int GetLldbId() const { return m_lldbId; }
void SetInterruptReason(int interruptReason) { this->m_interruptReason = interruptReason; }
int GetInterruptReason() const { return m_interruptReason; }
void SetRedirectTTY(const wxString& redirectTTY) { this->m_redirectTTY = redirectTTY; }
const wxString& GetRedirectTTY() const { return m_redirectTTY; }
void SetExecutable(const wxString& executable) { this->m_executable = executable; }
const wxString& GetExecutable() const { return m_executable; }
void SetCommandArguments(const wxString& commandArguments) { this->m_commandArguments = commandArguments; }
void SetCommandType(int commandType) { this->m_commandType = commandType; }
const wxString& GetCommandArguments() const { return m_commandArguments; }
int GetCommandType() const { return m_commandType; }
void SetWorkingDirectory(const wxString& workingDirectory) { this->m_workingDirectory = workingDirectory; }
const wxString& GetWorkingDirectory() const { return m_workingDirectory; }
void SetBreakpoints(const LLDBBreakpoint::Vec_t& breakpoints) { this->m_breakpoints = breakpoints; }
const LLDBBreakpoint::Vec_t& GetBreakpoints() const { return m_breakpoints; }
};
#endif // LLDBCOMMAND_H
|