]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmnLLDBDebugSessionInfoVarObj.h
Update LLDB snapshot to upstream r225923 (git 2b588ecd)
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmnLLDBDebugSessionInfoVarObj.h
1 //===-- MICmnLLDBDebugSessionInfoVarObj.h -----------------------*- C++ -*-===//
2 //
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
10 //++
11 // File:        MICmnLLDBDebugSessionInfoVarObj.h
12 //
13 // Overview:    CMICmnLLDBDebugSessionInfoVarObj interface.
14 //
15 // Environment: Compilers:  Visual C++ 12.
16 //                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 //              Libraries:  See MIReadmetxt.
18 //
19 // Copyright:   None.
20 //--
21
22 #pragma once
23
24 // Third Party Headers:
25 #include <map>
26 #include <lldb/API/SBValue.h>
27
28 // In-house headers:
29 #include "MIUtilString.h"
30
31 //++ ============================================================================
32 // Details: MI debug session variable object. The static functionality in *this
33 //          class manages a map container of *these variable objects.
34 // Gotchas: None.
35 // Authors: Illya Rudkin 24/03/2014.
36 // Changes: None.
37 //--
38 class CMICmnLLDBDebugSessionInfoVarObj
39 {
40     // Enums:
41   public:
42     //++ ----------------------------------------------------------------------
43     // Details: Enumeration of a variable type that is not a composite type
44     //--
45     enum varFormat_e
46     {
47         // CODETAG_SESSIONINFO_VARFORMAT_ENUM
48         // *** Order is import here ***
49         eVarFormat_Invalid = 0,
50         eVarFormat_Binary,
51         eVarFormat_Octal,
52         eVarFormat_Decimal,
53         eVarFormat_Hex,
54         eVarFormat_Natural,
55         eVarFormat_count // Always last one
56     };
57
58     //++ ----------------------------------------------------------------------
59     // Details: Enumeration of a variable type by composite or internal type
60     //--
61     enum varType_e
62     {
63         eVarType_InValid = 0,
64         eVarType_Composite, // i.e. struct
65         eVarType_Internal,  // i.e. int
66         eVarType_count      // Always last one
67     };
68
69     // Statics:
70   public:
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);
82
83     // Methods:
84   public:
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);
93     //
94     CMICmnLLDBDebugSessionInfoVarObj &operator=(const CMICmnLLDBDebugSessionInfoVarObj &vrOther);
95     CMICmnLLDBDebugSessionInfoVarObj &operator=(CMICmnLLDBDebugSessionInfoVarObj &&vrwOther);
96     //
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);
105
106     // Overridden:
107   public:
108     // From CMICmnBase
109     /* dtor */ virtual ~CMICmnLLDBDebugSessionInfoVarObj(void);
110
111     // Typedefs:
112   private:
113     typedef std::map<CMIUtilString, CMICmnLLDBDebugSessionInfoVarObj> MapKeyToVarObj_t;
114     typedef std::pair<CMIUtilString, CMICmnLLDBDebugSessionInfoVarObj> MapPairKeyToVarObj_t;
115
116     // Statics:
117   private:
118     static CMIUtilString GetStringFormatted(const MIuint64 vnValue, const MIchar *vpStrValueNatural, varFormat_e veVarFormat);
119
120     // Methods:
121   private:
122     bool CopyOther(const CMICmnLLDBDebugSessionInfoVarObj &vrOther);
123     bool MoveOther(CMICmnLLDBDebugSessionInfoVarObj &vrwOther);
124
125     // Attributes:
126   private:
127     static const MIchar *ms_aVarFormatStrings[];
128     static const MIchar *ms_aVarFormatChars[];
129     static MapKeyToVarObj_t ms_mapVarIdToVarObj;
130     static MIuint ms_nVarUniqueId;
131     //
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 ***
141 };