33 tm *tm_date = localtime(&epoch);
36 std::string buffer(1024, 0);
37 if (strftime(&buffer[0], 1023,
"%Z", tm_date) == 0)
39 stream.
Printf(
"%04d-%02d-%02d %02d:%02d:%02d %s", tm_date->tm_year + 1900,
40 tm_date->tm_mon + 1, tm_date->tm_mday, tm_date->tm_hour,
41 tm_date->tm_min, tm_date->tm_sec, buffer.c_str());
61 if (!descriptor.get() || !descriptor->IsValid())
64 uint32_t ptr_size = process_sp->GetAddressByteSize();
73 bool is_type_ok =
false;
74 if (descriptor->IsCFType()) {
78 static ConstString g_conststruct__CFBag(
"const struct __CFBag");
80 if (type_name == g_CFBag || type_name == g_conststruct__CFBag) {
89 count = process_sp->ReadUnsignedIntegerFromMemory(offset, 4, 0,
error);
95 std::string prefix, suffix;
97 if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
104 stream.
Printf(
"%s\"%u value%s\"%s", prefix.c_str(), count,
105 (count == 1 ?
"" :
"s"), suffix.c_str());
123 if (!descriptor.get() || !descriptor->IsValid())
126 uint32_t ptr_size = process_sp->GetAddressByteSize();
135 bool is_type_ok =
false;
136 if (descriptor->IsCFType()) {
138 if (type_name ==
"__CFMutableBitVector" || type_name ==
"__CFBitVector" ||
139 type_name ==
"CFMutableBitVectorRef" || type_name ==
"CFBitVectorRef") {
149 count = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + 2 * ptr_size,
153 uint64_t num_bytes = count / 8 + ((count & 7) ? 1 : 0);
154 addr_t data_ptr = process_sp->ReadPointerFromMemory(
155 valobj_addr + 2 * ptr_size + 2 * ptr_size,
error);
159 if (num_bytes > 1024)
163 process_sp->ReadMemory(data_ptr, buffer_sp->GetBytes(), num_bytes,
error);
164 if (
error.Fail() || num_bytes == 0)
166 uint8_t *bytes = buffer_sp->GetBytes();
167 for (uint64_t byte_idx = 0; byte_idx < num_bytes - 1; byte_idx++) {
168 uint8_t
byte = bytes[byte_idx];
169 bool bit0 = (
byte & 1) == 1;
170 bool bit1 = (
byte & 2) == 2;
171 bool bit2 = (
byte & 4) == 4;
172 bool bit3 = (
byte & 8) == 8;
173 bool bit4 = (
byte & 16) == 16;
174 bool bit5 = (
byte & 32) == 32;
175 bool bit6 = (
byte & 64) == 64;
176 bool bit7 = (
byte & 128) == 128;
177 stream.
Printf(
"%c%c%c%c %c%c%c%c ", (bit7 ?
'1' :
'0'), (bit6 ?
'1' :
'0'),
178 (bit5 ?
'1' :
'0'), (bit4 ?
'1' :
'0'), (bit3 ?
'1' :
'0'),
179 (bit2 ?
'1' :
'0'), (bit1 ?
'1' :
'0'), (bit0 ?
'1' :
'0'));
184 uint8_t
byte = bytes[num_bytes - 1];
185 bool bit0 = (
byte & 1) == 1;
186 bool bit1 = (
byte & 2) == 2;
187 bool bit2 = (
byte & 4) == 4;
188 bool bit3 = (
byte & 8) == 8;
189 bool bit4 = (
byte & 16) == 16;
190 bool bit5 = (
byte & 32) == 32;
191 bool bit6 = (
byte & 64) == 64;
192 bool bit7 = (
byte & 128) == 128;
194 stream.
Printf(
"%c", bit7 ?
'1' :
'0');
198 stream.
Printf(
"%c", bit6 ?
'1' :
'0');
202 stream.
Printf(
"%c", bit5 ?
'1' :
'0');
206 stream.
Printf(
"%c", bit4 ?
'1' :
'0');
210 stream.
Printf(
"%c", bit3 ?
'1' :
'0');
214 stream.
Printf(
"%c", bit2 ?
'1' :
'0');
218 stream.
Printf(
"%c", bit1 ?
'1' :
'0');
222 stream.
Printf(
"%c", bit0 ?
'1' :
'0');
243 if (!descriptor.get() || !descriptor->IsValid())
246 uint32_t ptr_size = process_sp->GetAddressByteSize();
257 if (descriptor->IsCFType()) {
260 static ConstString g_CFBinaryHeap(
"__CFBinaryHeap");
262 "const struct __CFBinaryHeap");
263 static ConstString g_CFBinaryHeapRef(
"CFBinaryHeapRef");
265 if (type_name == g_CFBinaryHeap ||
266 type_name == g_conststruct__CFBinaryHeap ||
267 type_name == g_CFBinaryHeapRef) {
276 count = process_sp->ReadUnsignedIntegerFromMemory(offset, 4, 0,
error);
282 std::string prefix, suffix;
284 if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
291 stream.
Printf(
"%s\"%u item%s\"%s", prefix.c_str(), count,
292 (count == 1 ?
"" :
"s"), suffix.c_str());
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 bool IsPointerType()
virtual int64_t GetValueAsSigned(int64_t fail_value, bool *success=nullptr)
A class that represents a running process on the host machine.