]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/tools/lldb-mi/MICmnLLDBUtilSBValue.h
MFC r355940:
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / tools / lldb-mi / MICmnLLDBUtilSBValue.h
1 //===-- MICmnLLDBUtilSBValue.h ----------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #pragma once
10
11 // Third Party Headers:
12 #include "lldb/API/SBValue.h"
13
14 // In-house headers:
15 #include "MICmnMIValueTuple.h"
16 #include "MIDataTypes.h"
17
18 // Declarations:
19 class CMIUtilString;
20
21 //++
22 //============================================================================
23 // Details: Utility helper class to lldb::SBValue. Using a lldb::SBValue extract
24 //          value object information to help form verbose debug information.
25 //--
26 class CMICmnLLDBUtilSBValue {
27   // Methods:
28 public:
29   /* ctor */ CMICmnLLDBUtilSBValue(const lldb::SBValue &vrValue,
30                                    const bool vbHandleCharType = false,
31                                    const bool vbHandleArrayType = true);
32   /* dtor */ ~CMICmnLLDBUtilSBValue();
33   //
34   CMIUtilString GetName() const;
35   CMIUtilString GetValue(const bool vbExpandAggregates = false) const;
36   CMIUtilString GetTypeName() const;
37   CMIUtilString GetTypeNameDisplay() const;
38   bool IsCharType() const;
39   bool IsFirstChildCharType() const;
40   bool IsPointeeCharType() const;
41   bool IsIntegerType() const;
42   bool IsPointerType() const;
43   bool IsArrayType() const;
44   bool IsLLDBVariable() const;
45   bool IsNameUnknown() const;
46   bool IsValueUnknown() const;
47   bool IsValid() const;
48   bool HasName() const;
49
50   // Methods:
51 private:
52   template <typename charT>
53   CMIUtilString
54   ReadCStringFromHostMemory(lldb::SBValue &vrValue,
55                             const MIuint vnMaxLen = UINT32_MAX) const;
56   bool GetSimpleValue(const bool vbHandleArrayType,
57                       CMIUtilString &vrValue) const;
58   bool GetCompositeValue(const bool vbPrintFieldNames,
59                          CMICmnMIValueTuple &vwrMiValueTuple,
60                          const MIuint vnDepth = 1) const;
61   CMIUtilString
62   GetValueSummary(bool valueOnly,
63                   const CMIUtilString &failVal = CMIUtilString()) const;
64
65   // Statics:
66 private:
67   static bool IsCharBasicType(lldb::BasicType eType);
68
69   // Attributes:
70 private:
71   lldb::SBValue &m_rValue;
72   bool m_bValidSBValue; // True = SBValue is a valid object, false = not valid.
73   bool m_bHandleCharType;  // True = Yes return text molding to char type, false
74                            // = just return data.
75   bool m_bHandleArrayType; // True = Yes return special stub for array type,
76                            // false = just return data.
77 };