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 //===----------------------------------------------------------------------===//
12 // Third Party Headers:
13 #include "lldb/API/SBValue.h"
17 #include "MIUtilString.h"
20 //============================================================================
21 // Details: MI debug session variable object. The static functionality in *this
22 // class manages a map container of *these variable objects.
24 class CMICmnLLDBDebugSessionInfoVarObj {
27 //++ ----------------------------------------------------------------------
28 // Details: Enumeration of a variable type that is not a composite type
31 // CODETAG_SESSIONINFO_VARFORMAT_ENUM
32 // *** Order is import here ***
33 eVarFormat_Invalid = 0,
39 eVarFormat_count // Always last one
42 //++ ----------------------------------------------------------------------
43 // Details: Enumeration of a variable type by composite or internal type
47 eVarType_Composite, // i.e. struct
48 eVarType_Internal, // i.e. int
49 eVarType_count // Always last one
54 static varFormat_e GetVarFormatForString(const CMIUtilString &vrStrFormat);
55 static varFormat_e GetVarFormatForChar(char vcFormat);
56 static CMIUtilString GetValueStringFormatted(const lldb::SBValue &vrValue,
57 const varFormat_e veVarFormat);
58 static void VarObjAdd(const CMICmnLLDBDebugSessionInfoVarObj &vrVarObj);
59 static void VarObjDelete(const CMIUtilString &vrVarName);
60 static bool VarObjGet(const CMIUtilString &vrVarName,
61 CMICmnLLDBDebugSessionInfoVarObj &vrwVarObj);
62 static void VarObjUpdate(const CMICmnLLDBDebugSessionInfoVarObj &vrVarObj);
63 static void VarObjIdInc();
64 static MIuint VarObjIdGet();
65 static void VarObjIdResetToZero();
66 static void VarObjClear();
67 static void VarObjSetFormat(varFormat_e eDefaultFormat);
71 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj();
72 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(
73 const CMIUtilString &vrStrNameReal, const CMIUtilString &vrStrName,
74 const lldb::SBValue &vrValue);
75 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(
76 const CMIUtilString &vrStrNameReal, const CMIUtilString &vrStrName,
77 const lldb::SBValue &vrValue, const CMIUtilString &vrStrVarObjParentName);
78 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(
79 const CMICmnLLDBDebugSessionInfoVarObj &vrOther);
80 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(
81 CMICmnLLDBDebugSessionInfoVarObj &vrOther);
82 /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(
83 CMICmnLLDBDebugSessionInfoVarObj &&vrOther);
85 CMICmnLLDBDebugSessionInfoVarObj &
86 operator=(const CMICmnLLDBDebugSessionInfoVarObj &vrOther);
87 CMICmnLLDBDebugSessionInfoVarObj &
88 operator=(CMICmnLLDBDebugSessionInfoVarObj &&vrwOther);
90 const CMIUtilString &GetName() const;
91 const CMIUtilString &GetNameReal() const;
92 const CMIUtilString &GetValueFormatted() const;
93 lldb::SBValue &GetValue();
94 const lldb::SBValue &GetValue() const;
95 varType_e GetType() const;
96 bool SetVarFormat(const varFormat_e veVarFormat);
97 const CMIUtilString &GetVarParentName() const;
103 /* dtor */ virtual ~CMICmnLLDBDebugSessionInfoVarObj();
107 typedef std::map<CMIUtilString, CMICmnLLDBDebugSessionInfoVarObj>
109 typedef std::pair<CMIUtilString, CMICmnLLDBDebugSessionInfoVarObj>
110 MapPairKeyToVarObj_t;
114 static CMIUtilString GetStringFormatted(const MIuint64 vnValue,
115 const char *vpStrValueNatural,
116 varFormat_e veVarFormat);
120 bool CopyOther(const CMICmnLLDBDebugSessionInfoVarObj &vrOther);
121 bool MoveOther(CMICmnLLDBDebugSessionInfoVarObj &vrwOther);
125 static const char *ms_aVarFormatStrings[];
126 static const char *ms_aVarFormatChars[];
127 static MapKeyToVarObj_t ms_mapVarIdToVarObj;
128 static MIuint ms_nVarUniqueId;
129 static varFormat_e ms_eDefaultFormat; // overrides "natural" format
131 // *** Update the copy move constructors and assignment operator ***
132 varFormat_e m_eVarFormat;
133 varType_e m_eVarType;
134 CMIUtilString m_strName;
135 lldb::SBValue m_SBValue;
136 CMIUtilString m_strNameReal;
137 CMIUtilString m_strFormattedValue;
138 CMIUtilString m_strVarObjParentName;
139 // *** Update the copy move constructors and assignment operator ***