1 //===-- MICmnLLDBUtilSBValue.h ----------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
11 // Third Party Headers:
12 #include "lldb/API/SBValue.h"
15 #include "MICmnMIValueTuple.h"
16 #include "MIDataTypes.h"
22 //============================================================================
23 // Details: Utility helper class to lldb::SBValue. Using a lldb::SBValue extract
24 // value object information to help form verbose debug information.
26 class CMICmnLLDBUtilSBValue {
29 /* ctor */ CMICmnLLDBUtilSBValue(const lldb::SBValue &vrValue,
30 const bool vbHandleCharType = false,
31 const bool vbHandleArrayType = true);
32 /* dtor */ ~CMICmnLLDBUtilSBValue();
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;
52 template <typename charT>
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;
62 GetValueSummary(bool valueOnly,
63 const CMIUtilString &failVal = CMIUtilString()) const;
67 static bool IsCharBasicType(lldb::BasicType eType);
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.