LLDB API Documentation

SBData.h
Go to the documentation of this file.
1 //===-- SBData.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 #ifndef LLDB_SBData_h_
11 #define LLDB_SBData_h_
12 
13 #include "lldb/API/SBDefines.h"
14 
15 namespace lldb {
16 
17 class LLDB_API SBData {
18 public:
19  SBData();
20 
21  SBData(const SBData &rhs);
22 
23  const SBData &operator=(const SBData &rhs);
24 
25  ~SBData();
26 
27  uint8_t GetAddressByteSize();
28 
29  void SetAddressByteSize(uint8_t addr_byte_size);
30 
31  void Clear();
32 
33  bool IsValid();
34 
35  size_t GetByteSize();
36 
37  lldb::ByteOrder GetByteOrder();
38 
39  void SetByteOrder(lldb::ByteOrder endian);
40 
41  float GetFloat(lldb::SBError &error, lldb::offset_t offset);
42 
43  double GetDouble(lldb::SBError &error, lldb::offset_t offset);
44 
45  long double GetLongDouble(lldb::SBError &error, lldb::offset_t offset);
46 
47  lldb::addr_t GetAddress(lldb::SBError &error, lldb::offset_t offset);
48 
49  uint8_t GetUnsignedInt8(lldb::SBError &error, lldb::offset_t offset);
50 
51  uint16_t GetUnsignedInt16(lldb::SBError &error, lldb::offset_t offset);
52 
53  uint32_t GetUnsignedInt32(lldb::SBError &error, lldb::offset_t offset);
54 
55  uint64_t GetUnsignedInt64(lldb::SBError &error, lldb::offset_t offset);
56 
57  int8_t GetSignedInt8(lldb::SBError &error, lldb::offset_t offset);
58 
59  int16_t GetSignedInt16(lldb::SBError &error, lldb::offset_t offset);
60 
61  int32_t GetSignedInt32(lldb::SBError &error, lldb::offset_t offset);
62 
63  int64_t GetSignedInt64(lldb::SBError &error, lldb::offset_t offset);
64 
65  const char *GetString(lldb::SBError &error, lldb::offset_t offset);
66 
67  size_t ReadRawData(lldb::SBError &error, lldb::offset_t offset, void *buf,
68  size_t size);
69 
70  bool GetDescription(lldb::SBStream &description,
71  lldb::addr_t base_addr = LLDB_INVALID_ADDRESS);
72 
73  // it would be nice to have SetData(SBError, const void*, size_t) when
74  // endianness and address size can be
75  // inferred from the existing DataExtractor, but having two SetData()
76  // signatures triggers a SWIG bug where
77  // the typemap isn't applied before resolving the overload, and thus the right
78  // function never gets called
79  void SetData(lldb::SBError &error, const void *buf, size_t size,
80  lldb::ByteOrder endian, uint8_t addr_size);
81 
82  // see SetData() for why we don't have Append(const void* buf, size_t size)
83  bool Append(const SBData &rhs);
84 
85  static lldb::SBData CreateDataFromCString(lldb::ByteOrder endian,
86  uint32_t addr_byte_size,
87  const char *data);
88 
89  // in the following CreateData*() and SetData*() prototypes, the two
90  // parameters array and array_len
91  // should not be renamed or rearranged, because doing so will break the SWIG
92  // typemap
93  static lldb::SBData CreateDataFromUInt64Array(lldb::ByteOrder endian,
94  uint32_t addr_byte_size,
95  uint64_t *array,
96  size_t array_len);
97 
98  static lldb::SBData CreateDataFromUInt32Array(lldb::ByteOrder endian,
99  uint32_t addr_byte_size,
100  uint32_t *array,
101  size_t array_len);
102 
103  static lldb::SBData CreateDataFromSInt64Array(lldb::ByteOrder endian,
104  uint32_t addr_byte_size,
105  int64_t *array,
106  size_t array_len);
107 
108  static lldb::SBData CreateDataFromSInt32Array(lldb::ByteOrder endian,
109  uint32_t addr_byte_size,
110  int32_t *array,
111  size_t array_len);
112 
113  static lldb::SBData CreateDataFromDoubleArray(lldb::ByteOrder endian,
114  uint32_t addr_byte_size,
115  double *array,
116  size_t array_len);
117 
118  bool SetDataFromCString(const char *data);
119 
120  bool SetDataFromUInt64Array(uint64_t *array, size_t array_len);
121 
122  bool SetDataFromUInt32Array(uint32_t *array, size_t array_len);
123 
124  bool SetDataFromSInt64Array(int64_t *array, size_t array_len);
125 
126  bool SetDataFromSInt32Array(int32_t *array, size_t array_len);
127 
128  bool SetDataFromDoubleArray(double *array, size_t array_len);
129 
130 protected:
131  // Mimic shared pointer...
132  lldb_private::DataExtractor *get() const;
133 
134  lldb_private::DataExtractor *operator->() const;
135 
136  lldb::DataExtractorSP &operator*();
137 
138  const lldb::DataExtractorSP &operator*() const;
139 
140  SBData(const lldb::DataExtractorSP &data_sp);
141 
142  void SetOpaque(const lldb::DataExtractorSP &data_sp);
143 
144 private:
145  friend class SBInstruction;
146  friend class SBProcess;
147  friend class SBSection;
148  friend class SBTarget;
149  friend class SBValue;
150 
151  lldb::DataExtractorSP m_opaque_sp;
152 };
153 
154 } // namespace lldb
155 
156 #endif // LLDB_SBData_h_
class LLDB_API SBData
Definition: SBDefines.h:43