32 tm *tm_date = localtime(&epoch);
35 std::string buffer(1024, 0);
36 if (strftime(&buffer[0], 1023,
"%Z", tm_date) == 0)
38 stream.
Printf(
"%04d-%02d-%02d %02d:%02d:%02d %s", tm_date->tm_year + 1900,
39 tm_date->tm_mon + 1, tm_date->tm_mday, tm_date->tm_hour,
40 tm_date->tm_min, tm_date->tm_sec, buffer.c_str());
46 static constexpr llvm::StringLiteral g_TypeHint(
"CFBag");
60 if (!descriptor.get() || !descriptor->IsValid())
63 uint32_t ptr_size = process_sp->GetAddressByteSize();
72 bool is_type_ok =
false;
73 if (descriptor->IsCFType()) {
77 static ConstString g_conststruct__CFBag(
"const struct __CFBag");
79 if (type_name == g_CFBag || type_name == g_conststruct__CFBag) {
88 count = process_sp->ReadUnsignedIntegerFromMemory(offset, 4, 0,
error);
94 llvm::StringRef prefix, suffix;
96 std::tie(prefix, suffix) = language->GetFormatterPrefixSuffix(g_TypeHint);
99 stream.
Printf(
"\"%u value%s\"", count, (count == 1 ?
"" :
"s"));
118 if (!descriptor.get() || !descriptor->IsValid())
121 uint32_t ptr_size = process_sp->GetAddressByteSize();
130 bool is_type_ok =
false;
131 if (descriptor->IsCFType()) {
133 if (type_name ==
"__CFMutableBitVector" || type_name ==
"__CFBitVector" ||
134 type_name ==
"CFMutableBitVectorRef" || type_name ==
"CFBitVectorRef") {
144 count = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + 2 * ptr_size,
148 uint64_t num_bytes = count / 8 + ((count & 7) ? 1 : 0);
149 addr_t data_ptr = process_sp->ReadPointerFromMemory(
150 valobj_addr + 2 * ptr_size + 2 * ptr_size,
error);
154 if (num_bytes > 1024)
158 process_sp->ReadMemory(data_ptr, buffer_sp->GetBytes(), num_bytes,
error);
159 if (
error.Fail() || num_bytes == 0)
161 uint8_t *bytes = buffer_sp->GetBytes();
162 for (uint64_t byte_idx = 0; byte_idx < num_bytes - 1; byte_idx++) {
163 uint8_t
byte = bytes[byte_idx];
164 bool bit0 = (
byte & 1) == 1;
165 bool bit1 = (
byte & 2) == 2;
166 bool bit2 = (
byte & 4) == 4;
167 bool bit3 = (
byte & 8) == 8;
168 bool bit4 = (
byte & 16) == 16;
169 bool bit5 = (
byte & 32) == 32;
170 bool bit6 = (
byte & 64) == 64;
171 bool bit7 = (
byte & 128) == 128;
172 stream.
Printf(
"%c%c%c%c %c%c%c%c ", (bit7 ?
'1' :
'0'), (bit6 ?
'1' :
'0'),
173 (bit5 ?
'1' :
'0'), (bit4 ?
'1' :
'0'), (bit3 ?
'1' :
'0'),
174 (bit2 ?
'1' :
'0'), (bit1 ?
'1' :
'0'), (bit0 ?
'1' :
'0'));
179 uint8_t
byte = bytes[num_bytes - 1];
180 bool bit0 = (
byte & 1) == 1;
181 bool bit1 = (
byte & 2) == 2;
182 bool bit2 = (
byte & 4) == 4;
183 bool bit3 = (
byte & 8) == 8;
184 bool bit4 = (
byte & 16) == 16;
185 bool bit5 = (
byte & 32) == 32;
186 bool bit6 = (
byte & 64) == 64;
187 bool bit7 = (
byte & 128) == 128;
189 stream.
Printf(
"%c", bit7 ?
'1' :
'0');
193 stream.
Printf(
"%c", bit6 ?
'1' :
'0');
197 stream.
Printf(
"%c", bit5 ?
'1' :
'0');
201 stream.
Printf(
"%c", bit4 ?
'1' :
'0');
205 stream.
Printf(
"%c", bit3 ?
'1' :
'0');
209 stream.
Printf(
"%c", bit2 ?
'1' :
'0');
213 stream.
Printf(
"%c", bit1 ?
'1' :
'0');
217 stream.
Printf(
"%c", bit0 ?
'1' :
'0');
224 static constexpr llvm::StringLiteral g_TypeHint(
"CFBinaryHeap");
238 if (!descriptor.get() || !descriptor->IsValid())
241 uint32_t ptr_size = process_sp->GetAddressByteSize();
252 if (descriptor->IsCFType()) {
255 static ConstString g_CFBinaryHeap(
"__CFBinaryHeap");
257 "const struct __CFBinaryHeap");
258 static ConstString g_CFBinaryHeapRef(
"CFBinaryHeapRef");
260 if (type_name == g_CFBinaryHeap ||
261 type_name == g_conststruct__CFBinaryHeap ||
262 type_name == g_CFBinaryHeapRef) {
271 count = process_sp->ReadUnsignedIntegerFromMemory(offset, 4, 0,
error);
277 llvm::StringRef prefix, suffix;
279 std::tie(prefix, suffix) = language->GetFormatterPrefixSuffix(g_TypeHint);
282 stream.
Printf(
"\"%u item%s\"", count, (count == 1 ?
"" :
"s"));
static llvm::raw_ostream & error(Stream &strm)
A uniqued constant string class.
A subclass of DataBuffer that stores a data buffer on the heap.
static Language * FindPlugin(lldb::LanguageType language)
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
static ObjCLanguageRuntime * Get(Process &process)
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
lldb::LanguageType GetLanguage() const
lldb::ProcessSP GetProcessSP() const
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
virtual ConstString GetTypeName()
virtual int64_t GetValueAsSigned(int64_t fail_value, bool *success=nullptr)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP