LLDB mainline
SBStructuredData.h
Go to the documentation of this file.
1//===-- SBStructuredData.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#ifndef LLDB_API_SBSTRUCTUREDDATA_H
10#define LLDB_API_SBSTRUCTUREDDATA_H
11
13#include "lldb/API/SBDefines.h"
14#include "lldb/API/SBModule.h"
16
17namespace lldb_private {
18namespace python {
19class SWIGBridge;
20}
21namespace lua {
22class SWIGBridge;
23}
24} // namespace lldb_private
25
26namespace lldb {
27
29public:
31
33
35 const lldb::SBDebugger &debugger);
36
38
40
41 explicit operator bool() const;
42
43 bool IsValid() const;
44
46
47 lldb::SBError SetFromJSON(const char *json);
48
49 void Clear();
50
52
54
55 /// Return the type of data in this data structure
57
58 /// Return the size (i.e. number of elements) in this data structure
59 /// if it is an array or dictionary type. For other types, 0 will be
60 // returned.
61 size_t GetSize() const;
62
63 /// Fill keys with the keys in this object and return true if this data
64 /// structure is a dictionary. Returns false otherwise.
65 bool GetKeys(lldb::SBStringList &keys) const;
66
67 /// Return the value corresponding to a key if this data structure
68 /// is a dictionary type.
69 lldb::SBStructuredData GetValueForKey(const char *key) const;
70
71 /// Return the value corresponding to an index if this data structure
72 /// is array.
73 lldb::SBStructuredData GetItemAtIndex(size_t idx) const;
74
75 /// Return the integer value if this data structure is an integer type.
76 uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0) const;
77 /// Return the integer value if this data structure is an integer type.
78 int64_t GetSignedIntegerValue(int64_t fail_value = 0) const;
79
81 "Specify if the value is signed or unsigned",
82 "uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0)")
83 uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
84
85 /// Return the floating point value if this data structure is a floating
86 /// type.
87 double GetFloatValue(double fail_value = 0.0) const;
88
89 /// Return the boolean value if this data structure is a boolean type.
90 bool GetBooleanValue(bool fail_value = false) const;
91
92 /// Provides the string value if this data structure is a string type.
93 ///
94 /// \param[out] dst
95 /// pointer where the string value will be written. In case it is null,
96 /// nothing will be written at \a dst.
97 ///
98 /// \param[in] dst_len
99 /// max number of characters that can be written at \a dst. In case it is
100 /// zero, nothing will be written at \a dst. If this length is not enough
101 /// to write the complete string value, (\a dst_len - 1) bytes of the
102 /// string value will be written at \a dst followed by a null character.
103 ///
104 /// \return
105 /// Returns the byte size needed to completely write the string value at
106 /// \a dst in all cases.
107 size_t GetStringValue(char *dst, size_t dst_len) const;
108
109 /// Return the generic pointer if this data structure is a generic type.
111
112protected:
113 friend class SBAttachInfo;
115 friend class SBLaunchInfo;
116 friend class SBDebugger;
117 friend class SBFrame;
118 friend class SBTarget;
119 friend class SBProcess;
120 friend class SBThread;
121 friend class SBThreadPlan;
122 friend class SBBreakpoint;
124 friend class SBBreakpointName;
125 friend class SBTrace;
126 friend class lldb_private::python::SWIGBridge;
127 friend class lldb_private::lua::SWIGBridge;
129
130 SBStructuredData(const lldb_private::StructuredDataImpl &impl);
131
132 SBStructuredData(const lldb::EventSP &event_sp);
133
135};
136} // namespace lldb
137
138#endif // LLDB_API_SBSTRUCTUREDDATA_H
lldb::SBStructuredData GetItemAtIndex(size_t idx) const
Return the value corresponding to an index if this data structure is array.
lldb::SBStructuredData & operator=(const lldb::SBStructuredData &rhs)
int64_t GetSignedIntegerValue(int64_t fail_value=0) const
Return the integer value if this data structure is an integer type.
lldb::SBError GetDescription(lldb::SBStream &stream) const
friend class lldb_private::python::SWIGBridge
size_t GetStringValue(char *dst, size_t dst_len) const
Provides the string value if this data structure is a string type.
lldb::SBScriptObject GetGenericValue() const
Return the generic pointer if this data structure is a generic type.
bool GetBooleanValue(bool fail_value=false) const
Return the boolean value if this data structure is a boolean type.
StructuredDataImplUP m_impl_up
LLDB_DEPRECATED_FIXME("Specify if the value is signed or unsigned", "uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0)") uint64_t GetIntegerValue(uint64_t fail_value=0) const
lldb::StructuredDataType GetType() const
Return the type of data in this data structure.
uint64_t GetUnsignedIntegerValue(uint64_t fail_value=0) const
Return the integer value if this data structure is an integer type.
size_t GetSize() const
Return the size (i.e.
bool GetKeys(lldb::SBStringList &keys) const
Fill keys with the keys in this object and return true if this data structure is a dictionary.
lldb::SBError GetAsJSON(lldb::SBStream &stream) const
lldb::SBStructuredData GetValueForKey(const char *key) const
Return the value corresponding to a key if this data structure is a dictionary type.
lldb::SBError SetFromJSON(lldb::SBStream &stream)
double GetFloatValue(double fail_value=0.0) const
Return the floating point value if this data structure is a floating type.
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Event > EventSP
Definition: lldb-forward.h:345
std::unique_ptr< lldb_private::StructuredDataImpl > StructuredDataImplUP
Definition: lldb-forward.h:436