1 //===-- MICmnLLDBDebugSessionInfoVarObj.h -----------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 // File: MICmnLLDBDebugSessionInfoVarObj.h
13 // Overview: CMICmnLLDBDebugSessionInfoVarObj interface.
15 // Environment: Compilers: Visual C++ 12.
16 // gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 // Libraries: See MIReadmetxt.
24 // Third Party Headers:
26 #include <lldb/API/SBValue.h>
29 #include "MIUtilString.h"
31 //++ ============================================================================
32 // Details: MI debug session variable object. The static functionality in *this
33 // class manages a map container of *these variable objects.
35 // Authors: Illya Rudkin 24/03/2014.
38 class CMICmnLLDBDebugSessionInfoVarObj
42 //++ ----------------------------------------------------------------------
43 // Details: Enumeration of a variable type that is not a composite type
47 // CODETAG_SESSIONINFO_VARFORMAT_ENUM
48 // *** Order is import here ***
49 eVarFormat_Invalid = 0,
55 eVarFormat_count // Always last one
58 //++ ----------------------------------------------------------------------
59 // Details: Enumeration of a variable type by composite or internal type
64 eVarType_Composite, // i.e. struct
65 eVarType_Internal, // i.e. int
66 eVarType_count // Always last one
71 static varFormat_e GetVarFormatForString(const CMIUtilString &vrStrFormat);
72 static varFormat_e GetVarFormatForChar(const MIchar &vrcFormat);
73 static CMIUtilString GetValueStringFormatted(const lldb::SBValue &vrValue, const varFormat_e veVarFormat);
74 static void VarObjAdd(const CMICmnLLDBDebugSessionInfoVarObj &vrVarObj);
75 static void VarObjDelete(const CMIUtilString &vrVarName);
76 static bool VarObjGet(const CMIUtilString &vrVarName, CMICmnLLDBDebugSessionInfoVarObj &vrwVarObj);
77 static void VarObjUpdate(const CMICmnLLDBDebugSessionInfoVarObj &vrVarObj);
78 static void VarObjIdInc(void);
79 static MIuint VarObjIdGet(void);
80 static void VarObjIdResetToZero(void);
81 static void VarObjClear(void);
85 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(void);
86 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(const CMIUtilString &vrStrNameReal, const CMIUtilString &vrStrName,
87 const lldb::SBValue &vrValue);
88 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(const CMIUtilString &vrStrNameReal, const CMIUtilString &vrStrName,
89 const lldb::SBValue &vrValue, const CMIUtilString &vrStrVarObjParentName);
90 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(const CMICmnLLDBDebugSessionInfoVarObj &vrOther);
91 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(CMICmnLLDBDebugSessionInfoVarObj &vrOther);
92 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(CMICmnLLDBDebugSessionInfoVarObj &&vrOther);
94 CMICmnLLDBDebugSessionInfoVarObj &operator=(const CMICmnLLDBDebugSessionInfoVarObj &vrOther);
95 CMICmnLLDBDebugSessionInfoVarObj &operator=(CMICmnLLDBDebugSessionInfoVarObj &&vrwOther);
97 const CMIUtilString &GetName(void) const;
98 const CMIUtilString &GetNameReal(void) const;
99 const CMIUtilString &GetValueFormatted(void) const;
100 const lldb::SBValue &GetValue(void) const;
101 varType_e GetType(void) const;
102 bool SetVarFormat(const varFormat_e veVarFormat);
103 const CMIUtilString &GetVarParentName(void) const;
104 void UpdateValue(void);
109 /* dtor */ virtual ~CMICmnLLDBDebugSessionInfoVarObj(void);
113 typedef std::map<CMIUtilString, CMICmnLLDBDebugSessionInfoVarObj> MapKeyToVarObj_t;
114 typedef std::pair<CMIUtilString, CMICmnLLDBDebugSessionInfoVarObj> MapPairKeyToVarObj_t;
118 static CMIUtilString GetStringFormatted(const MIuint64 vnValue, const MIchar *vpStrValueNatural, varFormat_e veVarFormat);
122 bool CopyOther(const CMICmnLLDBDebugSessionInfoVarObj &vrOther);
123 bool MoveOther(CMICmnLLDBDebugSessionInfoVarObj &vrwOther);
127 static const MIchar *ms_aVarFormatStrings[];
128 static const MIchar *ms_aVarFormatChars[];
129 static MapKeyToVarObj_t ms_mapVarIdToVarObj;
130 static MIuint ms_nVarUniqueId;
132 // *** Upate the copy move constructors and assignment operator ***
133 varFormat_e m_eVarFormat;
134 varType_e m_eVarType;
135 CMIUtilString m_strName;
136 lldb::SBValue m_SBValue;
137 CMIUtilString m_strNameReal;
138 CMIUtilString m_strFormattedValue;
139 CMIUtilString m_strVarObjParentName;
140 // *** Upate the copy move constructors and assignment operator ***