LLDB mainline
Value.cpp
Go to the documentation of this file.
1//===-- Value.cpp ---------------------------------------------------------===//
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#include "lldb/Core/Value.h"
10
11#include "lldb/Core/Address.h"
12#include "lldb/Core/Module.h"
16#include "lldb/Symbol/Type.h"
19#include "lldb/Target/Process.h"
21#include "lldb/Target/Target.h"
25#include "lldb/Utility/Endian.h"
28#include "lldb/Utility/Log.h"
29#include "lldb/Utility/State.h"
30#include "lldb/Utility/Stream.h"
31#include "lldb/lldb-defines.h"
32#include "lldb/lldb-forward.h"
33#include "lldb/lldb-types.h"
34
35#include <memory>
36#include <optional>
37#include <string>
38
39#include <cinttypes>
40
41using namespace lldb;
42using namespace lldb_private;
43
45
46Value::Value(const Scalar &scalar)
47 : m_value(scalar), m_compiler_type(), m_data_buffer() {}
48
49Value::Value(const void *bytes, int len)
52 SetBytes(bytes, len);
53}
54
59 const uintptr_t rhs_value =
61 if ((rhs_value != 0) &&
62 (rhs_value == (uintptr_t)v.m_data_buffer.GetBytes())) {
63 m_data_buffer.CopyData(v.m_data_buffer.GetBytes(),
64 v.m_data_buffer.GetByteSize());
65
66 m_value = (uintptr_t)m_data_buffer.GetBytes();
67 }
68}
69
71 if (this != &rhs) {
72 m_value = rhs.m_value;
74 m_context = rhs.m_context;
77 const uintptr_t rhs_value =
79 if ((rhs_value != 0) &&
80 (rhs_value == (uintptr_t)rhs.m_data_buffer.GetBytes())) {
83
84 m_value = (uintptr_t)m_data_buffer.GetBytes();
85 }
86 }
87 return *this;
88}
89
90void Value::SetBytes(const void *bytes, int len) {
92 m_data_buffer.CopyData(bytes, len);
93 m_value = (uintptr_t)m_data_buffer.GetBytes();
94}
95
96void Value::AppendBytes(const void *bytes, int len) {
98 m_data_buffer.AppendData(bytes, len);
99 m_value = (uintptr_t)m_data_buffer.GetBytes();
100}
101
102void Value::Dump(Stream *strm) {
103 if (!strm)
104 return;
105 m_value.GetValue(*strm, true);
106 strm->Printf(", value_type = %s, context = %p, context_type = %s",
109}
110
112
114 switch (m_value_type) {
117 break;
119 return eAddressTypeLoad;
121 return eAddressTypeFile;
123 return eAddressTypeHost;
124 }
125 return eAddressTypeInvalid;
126}
127
129 switch (address_type) {
130 case eAddressTypeFile:
132 case eAddressTypeLoad:
134 case eAddressTypeHost:
138 }
139 llvm_unreachable("Unexpected address type!");
140}
141
144 return static_cast<RegisterInfo *>(m_context);
145 return nullptr;
146}
147
150 return static_cast<Type *>(m_context);
151 return nullptr;
152}
153
155 if (this == &rhs)
156 return 0;
157
158 size_t curr_size = m_data_buffer.GetByteSize();
160 switch (rhs.GetValueType()) {
162 return 0;
163 case ValueType::Scalar: {
164 const size_t scalar_size = rhs.m_value.GetByteSize();
165 if (scalar_size > 0) {
166 const size_t new_size = curr_size + scalar_size;
167 if (ResizeData(new_size) == new_size) {
168 rhs.m_value.GetAsMemoryData(m_data_buffer.GetBytes() + curr_size,
169 scalar_size, endian::InlHostByteOrder(),
170 error);
171 return scalar_size;
172 }
173 }
174 } break;
178 const uint8_t *src = rhs.GetBuffer().GetBytes();
179 const size_t src_len = rhs.GetBuffer().GetByteSize();
180 if (src && src_len > 0) {
181 const size_t new_size = curr_size + src_len;
182 if (ResizeData(new_size) == new_size) {
183 ::memcpy(m_data_buffer.GetBytes() + curr_size, src, src_len);
184 return src_len;
185 }
186 }
187 } break;
188 }
189 return 0;
190}
191
192size_t Value::ResizeData(size_t len) {
194 m_data_buffer.SetByteSize(len);
195 m_value = (uintptr_t)m_data_buffer.GetBytes();
196 return m_data_buffer.GetByteSize();
197}
198
200 switch (m_context_type) {
202 case ContextType::RegisterInfo: // RegisterInfo *
203 case ContextType::LLDBType: // Type *
204 break;
205
206 case ContextType::Variable: // Variable *
207 ResolveValue(exe_ctx);
208 return true;
209 }
210 return false;
211}
212
213uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
214 switch (m_context_type) {
215 case ContextType::RegisterInfo: // RegisterInfo *
216 if (GetRegisterInfo()) {
217 if (error_ptr)
218 error_ptr->Clear();
219 return GetRegisterInfo()->byte_size;
220 }
221 break;
222
224 case ContextType::LLDBType: // Type *
225 case ContextType::Variable: // Variable *
226 {
227 auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
228 auto size_or_err = GetCompilerType().GetByteSize(scope);
229 if (!size_or_err) {
230 if (error_ptr && error_ptr->Success())
231 *error_ptr = Status::FromError(size_or_err.takeError());
232 else
233 LLDB_LOG_ERRORV(GetLog(LLDBLog::Types), size_or_err.takeError(), "{0}");
234 } else {
235 if (error_ptr)
236 error_ptr->Clear();
237 return *size_or_err;
238 }
239 break;
240 }
241 }
242 if (error_ptr && error_ptr->Success())
243 *error_ptr = Status::FromErrorString("Unable to determine byte size.");
244 return 0;
245}
246
248 if (!m_compiler_type.IsValid()) {
249 switch (m_context_type) {
251 break;
252
254 break; // TODO: Eventually convert into a compiler type?
255
257 Type *lldb_type = GetType();
258 if (lldb_type)
260 } break;
261
263 Variable *variable = GetVariable();
264 if (variable) {
265 Type *variable_type = variable->GetType();
266 if (variable_type)
267 m_compiler_type = variable_type->GetForwardCompilerType();
268 }
269 } break;
270 }
271 }
272
273 return m_compiler_type;
274}
275
276void Value::SetCompilerType(const CompilerType &compiler_type) {
277 m_compiler_type = compiler_type;
278}
279
281 switch (m_context_type) {
283 if (GetRegisterInfo())
284 return GetRegisterInfo()->format;
285 break;
286
290 const CompilerType &ast_type = GetCompilerType();
291 if (ast_type.IsValid())
292 return ast_type.GetFormat();
293 } break;
294 }
295
296 // Return a good default in case we can't figure anything out
297 return eFormatHex;
298}
299
301 switch (m_value_type) {
303 return false;
305 if (m_value.GetData(data))
306 return true;
307 break;
308
312 if (m_data_buffer.GetByteSize()) {
313 data.SetData(m_data_buffer.GetBytes(), m_data_buffer.GetByteSize(),
314 data.GetByteOrder());
315 return true;
316 }
317 break;
318 }
319
320 return false;
321}
322
324 Module *module) {
325 data.Clear();
326
329 AddressType address_type = eAddressTypeFile;
330 Address file_so_addr;
331 const CompilerType &ast_type = GetCompilerType();
332 std::optional<uint64_t> type_size =
333 llvm::expectedToOptional(ast_type.GetByteSize(
334 exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr));
335 // Nothing to be done for a zero-sized type.
336 if (type_size && *type_size == 0)
337 return error;
338
339 switch (m_value_type) {
341 error = Status::FromErrorString("invalid value");
342 break;
343 case ValueType::Scalar: {
345 if (ast_type.IsValid())
346 data.SetAddressByteSize(ast_type.GetPointerByteSize());
347 else
348 data.SetAddressByteSize(sizeof(void *));
349
350 if (!type_size)
351 return Status::FromErrorString("type does not have a size");
352
353 uint32_t result_byte_size = *type_size;
354 if (m_value.GetData(data, result_byte_size))
355 return error; // Success;
356
357 error = Status::FromErrorString("extracting data from value failed");
358 break;
359 }
361 if (exe_ctx == nullptr) {
363 "can't read load address (no execution context)");
364 } else {
365 Process *process = exe_ctx->GetProcessPtr();
366 if (process == nullptr || !process->IsAlive()) {
367 Target *target = exe_ctx->GetTargetPtr();
368 if (target) {
369 // Allow expressions to run and evaluate things when the target has
370 // memory sections loaded. This allows you to use "target modules
371 // load" to load your executable and any shared libraries, then
372 // execute commands where you can look at types in data sections.
373 if (target->HasLoadedSections()) {
374 address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
375 if (target->ResolveLoadAddress(address, file_so_addr)) {
376 address_type = eAddressTypeLoad;
377 data.SetByteOrder(target->GetArchitecture().GetByteOrder());
380 } else
381 address = LLDB_INVALID_ADDRESS;
382 }
383 } else {
385 "can't read load address (invalid process)");
386 }
387 } else {
388 address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
389 address_type = eAddressTypeLoad;
390 data.SetByteOrder(
391 process->GetTarget().GetArchitecture().GetByteOrder());
394 }
395 }
396 break;
397
399 if (exe_ctx == nullptr) {
401 "can't read file address (no execution context)");
402 } else if (exe_ctx->GetTargetPtr() == nullptr) {
403 error =
404 Status::FromErrorString("can't read file address (invalid target)");
405 } else {
406 address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
407 if (address == LLDB_INVALID_ADDRESS) {
408 error = Status::FromErrorString("invalid file address");
409 } else {
410 if (module == nullptr) {
411 // The only thing we can currently lock down to a module so that we
412 // can resolve a file address, is a variable.
413 Variable *variable = GetVariable();
414 if (variable) {
415 SymbolContext var_sc;
416 variable->CalculateSymbolContext(&var_sc);
417 module = var_sc.module_sp.get();
418 }
419 }
420
421 if (module) {
422 bool resolved = false;
423 ObjectFile *objfile = module->GetObjectFile();
424 if (objfile) {
425 Address so_addr(address, objfile->GetSectionList());
426 addr_t load_address =
427 so_addr.GetLoadAddress(exe_ctx->GetTargetPtr());
428 bool process_launched_and_stopped =
429 exe_ctx->GetProcessPtr()
431 true /* must_exist */)
432 : false;
433 // Don't use the load address if the process has exited.
434 if (load_address != LLDB_INVALID_ADDRESS &&
435 process_launched_and_stopped) {
436 resolved = true;
437 address = load_address;
438 address_type = eAddressTypeLoad;
439 data.SetByteOrder(
441 data.SetAddressByteSize(exe_ctx->GetTargetRef()
444 } else {
445 if (so_addr.IsSectionOffset()) {
446 resolved = true;
447 file_so_addr = so_addr;
448 data.SetByteOrder(objfile->GetByteOrder());
449 data.SetAddressByteSize(objfile->GetAddressByteSize());
450 }
451 }
452 }
453 if (!resolved) {
454 Variable *variable = GetVariable();
455
456 if (module) {
457 if (variable)
459 "unable to resolve the module for file address 0x%" PRIx64
460 " for variable '%s' in %s",
461 address, variable->GetName().AsCString(""),
462 module->GetFileSpec().GetPath().c_str());
463 else
465 "unable to resolve the module for file address 0x%" PRIx64
466 " in %s",
467 address, module->GetFileSpec().GetPath().c_str());
468 } else {
469 if (variable)
471 "unable to resolve the module for file address 0x%" PRIx64
472 " for variable '%s'",
473 address, variable->GetName().AsCString(""));
474 else
476 "unable to resolve the module for file address 0x%" PRIx64,
477 address);
478 }
479 }
480 } else {
481 // Can't convert a file address to anything valid without more
482 // context (which Module it came from)
484 "can't read memory from file address without more context");
485 }
486 }
487 }
488 break;
489
491 address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
492 address_type = eAddressTypeHost;
493 if (exe_ctx) {
494 if (Target *target = exe_ctx->GetTargetPtr()) {
495 // Registers are always stored in host endian.
498 : target->GetArchitecture().GetByteOrder());
499 data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
500 break;
501 }
502 }
503 // fallback to host settings
505 data.SetAddressByteSize(sizeof(void *));
506 break;
507 }
508
509 // Bail if we encountered any errors
510 if (error.Fail())
511 return error;
512
513 if (address == LLDB_INVALID_ADDRESS) {
515 "invalid %s address",
516 address_type == eAddressTypeHost ? "host" : "load");
517 return error;
518 }
519
520 // If we got here, we need to read the value from memory.
521 size_t byte_size = GetValueByteSize(&error, exe_ctx);
522
523 // Bail if we encountered any errors getting the byte size.
524 if (error.Fail())
525 return error;
526
527 // No memory to read for zero-sized types.
528 if (byte_size == 0)
529 return error;
530
531 // Make sure we have enough room within "data", and if we don't make
532 // something large enough that does
533 if (!data.ValidOffsetForDataOfSize(0, byte_size)) {
534 auto data_sp = std::make_shared<DataBufferHeap>(byte_size, '\0');
535 data.SetData(data_sp);
536 }
537
538 uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
539 if (dst != nullptr) {
540 if (address_type == eAddressTypeHost) {
541 // The address is an address in this process, so just copy it.
542 if (address == 0) {
543 error =
544 Status::FromErrorString("trying to read from host address of 0.");
545 return error;
546 }
547 memcpy(dst, reinterpret_cast<uint8_t *>(address), byte_size);
548 } else if ((address_type == eAddressTypeLoad) ||
549 (address_type == eAddressTypeFile)) {
550 if (file_so_addr.IsValid()) {
551 const bool force_live_memory = true;
552 if (exe_ctx->GetTargetRef().ReadMemory(file_so_addr, dst, byte_size,
553 error, force_live_memory) !=
554 byte_size) {
556 "read memory from 0x%" PRIx64 " failed", (uint64_t)address);
557 }
558 } else {
559 // The execution context might have a NULL process, but it might have a
560 // valid process in the exe_ctx->target, so use the
561 // ExecutionContext::GetProcess accessor to ensure we get the process
562 // if there is one.
563 Process *process = exe_ctx->GetProcessPtr();
564
565 if (process) {
566 const size_t bytes_read =
567 process->ReadMemory(address, dst, byte_size, error);
568 if (bytes_read != byte_size)
570 "read memory from 0x%" PRIx64 " failed (%u of %u bytes read)",
571 (uint64_t)address, (uint32_t)bytes_read, (uint32_t)byte_size);
572 } else {
574 "read memory from 0x%" PRIx64 " failed (invalid process)",
575 (uint64_t)address);
576 }
577 }
578 } else {
580 "unsupported AddressType value (%i)", address_type);
581 }
582 } else {
583 error = Status::FromErrorString("out of memory");
584 }
585
586 return error;
587}
588
590 const CompilerType &compiler_type = GetCompilerType();
591 if (compiler_type.IsValid()) {
592 switch (m_value_type) {
594 case ValueType::Scalar: // raw scalar value
595 break;
596
598 case ValueType::LoadAddress: // load address value
599 case ValueType::HostAddress: // host address value (for memory in the process
600 // that is using liblldb)
601 {
602 DataExtractor data;
603 lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS);
604 Status error(GetValueAsData(exe_ctx, data, module));
605 if (error.Success()) {
606 Scalar scalar;
607 if (compiler_type.GetValueAsScalar(
608 data, 0, data.GetByteSize(), scalar,
609 exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)) {
610 m_value = scalar;
612 } else {
613 if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
614 m_value.Clear();
616 }
617 }
618 } else {
619 if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
620 m_value.Clear();
622 }
623 }
624 } break;
625 }
626 }
627 return m_value;
628}
629
632 return static_cast<Variable *>(m_context);
633 return nullptr;
634}
635
637 m_value.Clear();
638 m_compiler_type.Clear();
640 m_context = nullptr;
642 m_data_buffer.Clear();
643}
644
646 switch (value_type) {
648 return "invalid";
650 return "scalar";
652 return "file address";
654 return "load address";
656 return "host address";
657 };
658 llvm_unreachable("enum cases exhausted.");
659}
660
662 switch (context_type) {
664 return "invalid";
666 return "RegisterInfo *";
668 return "Type *";
670 return "Variable *";
671 };
672 llvm_unreachable("enum cases exhausted.");
673}
674
676 if (!module || !target || (GetValueType() != ValueType::FileAddress))
677 return;
678
680 if (file_addr == LLDB_INVALID_ADDRESS)
681 return;
682
683 Address so_addr;
684 if (!module->ResolveFileAddress(file_addr, so_addr))
685 return;
686 lldb::addr_t load_addr = so_addr.GetLoadAddress(target);
687 if (load_addr == LLDB_INVALID_ADDRESS)
688 return;
689
691 GetScalar() = load_addr;
692}
693
694void ValueList::PushValue(const Value &value) { m_values.push_back(value); }
695
696size_t ValueList::GetSize() { return m_values.size(); }
697
699 if (idx < GetSize()) {
700 return &(m_values[idx]);
701 } else
702 return nullptr;
703}
704
705void ValueList::Clear() { m_values.clear(); }
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG_ERRORV(log, error,...)
Definition Log.h:408
A section + offset based address class.
Definition Address.h:62
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition Address.cpp:301
bool IsValid() const
Check if the object state is valid.
Definition Address.h:355
bool IsSectionOffset() const
Check if an address is section offset.
Definition Address.h:342
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition ArchSpec.cpp:685
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition ArchSpec.cpp:732
Generic representation of a type in a programming language.
bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, Scalar &value, ExecutionContextScope *exe_scope) const
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
size_t GetPointerByteSize() const
AST related queries.
lldb::Format GetFormat() const
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
An data extractor class.
const uint8_t * PeekData(lldb::offset_t offset, lldb::offset_t length) const
Peek at a bytes at offset.
bool ValidOffsetForDataOfSize(lldb::offset_t offset, lldb::offset_t length) const
Test the availability of length bytes of data from offset.
void Clear()
Clears the object state.
void SetByteOrder(lldb::ByteOrder byte_order)
Set the byte_order value.
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
lldb::offset_t SetData(const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
Set data with a buffer that is caller owned.
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
void SetAddressByteSize(uint32_t addr_size)
Set the address byte size.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
ExecutionContextScope * GetBestExecutionContextScope() const
Target * GetTargetPtr() const
Returns a pointer to the target object.
Target & GetTargetRef() const
Returns a reference to the target object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:374
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:90
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr)
Definition Module.cpp:447
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition Module.h:454
A plug-in interface definition class for object file parsers.
Definition ObjectFile.h:45
virtual lldb::ByteOrder GetByteOrder() const =0
Gets whether endian swapping should occur when extracting data from this object file.
virtual uint32_t GetAddressByteSize() const =0
Gets the address size in bytes for the current object file.
virtual SectionList * GetSectionList(bool update_module_section_list=true)
Gets the section list for the currently selected architecture (and object for archives).
A plug-in interface definition class for debugging a process.
Definition Process.h:357
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition Process.cpp:1930
lldb::StateType GetState()
Get accessor for the current process state.
Definition Process.cpp:1285
virtual bool IsAlive()
Check if a process is still alive.
Definition Process.cpp:1082
Target & GetTarget()
Get the target object pointer for this module.
Definition Process.h:1270
size_t GetByteSize() const
Definition Scalar.cpp:162
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition Scalar.cpp:365
size_t GetAsMemoryData(void *dst, size_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
Definition Scalar.cpp:802
An error handling class.
Definition Status.h:118
void Clear()
Clear the object state.
Definition Status.cpp:215
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:137
bool Success() const
Test for success condition.
Definition Status.cpp:304
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
Defines a symbol context baton that can be handed other debug core functions.
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
Definition Target.cpp:3285
virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory=false, lldb::addr_t *load_addr_ptr=nullptr, bool *did_read_live_memory=nullptr)
Definition Target.cpp:1993
const ArchSpec & GetArchitecture() const
Definition Target.h:1056
CompilerType GetForwardCompilerType()
Definition Type.cpp:782
void PushValue(const Value &value)
Definition Value.cpp:694
collection m_values
Definition Value.h:205
Value * GetValueAtIndex(size_t idx)
Definition Value.cpp:698
const Scalar & GetScalar() const
See comment on m_scalar to understand what GetScalar returns.
Definition Value.h:113
void AppendBytes(const void *bytes, int len)
Definition Value.cpp:96
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, Module *module)
Definition Value.cpp:323
RegisterInfo * GetRegisterInfo() const
Definition Value.cpp:142
ValueType
Type that describes Value::m_value.
Definition Value.h:41
@ HostAddress
A host address value (for memory in the process that < A is using liblldb).
Definition Value.h:52
@ FileAddress
A file address value.
Definition Value.h:47
@ LoadAddress
A load address value.
Definition Value.h:49
@ Scalar
A raw scalar value.
Definition Value.h:45
void Dump(Stream *strm)
Definition Value.cpp:102
static ValueType GetValueTypeFromAddressType(AddressType address_type)
Definition Value.cpp:128
ContextType m_context_type
Definition Value.h:183
Value & operator=(const Value &rhs)
Definition Value.cpp:70
size_t AppendDataToHostBuffer(const Value &rhs)
Definition Value.cpp:154
ValueType GetValueType() const
Definition Value.cpp:111
void SetCompilerType(const CompilerType &compiler_type)
Definition Value.cpp:276
DataBufferHeap m_data_buffer
Definition Value.h:184
lldb::Format GetValueDefaultFormat()
Definition Value.cpp:280
Scalar & ResolveValue(ExecutionContext *exe_ctx, Module *module=nullptr)
Definition Value.cpp:589
static const char * GetValueTypeAsCString(ValueType context_type)
Definition Value.cpp:645
DataBufferHeap & GetBuffer()
Definition Value.h:122
uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx)
Definition Value.cpp:213
void SetValueType(ValueType value_type)
Definition Value.h:89
CompilerType m_compiler_type
Definition Value.h:180
ContextType
Type that describes Value::m_context.
Definition Value.h:56
@ Variable
lldb_private::Variable *.
Definition Value.h:65
@ RegisterInfo
RegisterInfo * (can be a scalar or a vector register).
Definition Value.h:61
@ LLDBType
lldb_private::Type *.
Definition Value.h:63
ValueType m_value_type
Definition Value.h:182
bool GetData(DataExtractor &data)
Definition Value.cpp:300
AddressType GetValueAddressType() const
Definition Value.cpp:113
const CompilerType & GetCompilerType()
Definition Value.cpp:247
static const char * GetContextTypeAsCString(ContextType context_type)
Definition Value.cpp:661
void ConvertToLoadAddress(Module *module, Target *target)
Convert this value's file address to a load address, if possible.
Definition Value.cpp:675
size_t ResizeData(size_t len)
Definition Value.cpp:192
void SetBytes(const void *bytes, int len)
Definition Value.cpp:90
bool ValueOf(ExecutionContext *exe_ctx)
Definition Value.cpp:199
Scalar m_value
Represents a value, which can be a scalar, a load address, a file address, or a host address.
Definition Value.h:179
Variable * GetVariable()
Definition Value.cpp:630
ConstString GetName() const
Definition Variable.cpp:73
void CalculateSymbolContext(SymbolContext *sc)
Definition Variable.cpp:208
uint8_t * GetBytes()
Get a pointer to the data.
Definition DataBuffer.h:108
#define LLDB_INVALID_ADDRESS
lldb::ByteOrder InlHostByteOrder()
Definition Endian.h:25
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:332
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
Definition State.cpp:89
@ eAddressTypeFile
Address is an address as found in an object or symbol file.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
@ eAddressTypeHost
Address is an address in the process that is running this code.
Format
Display format definitions.
uint64_t addr_t
Definition lldb-types.h:80
uint32_t byte_size
Size in bytes of the register.
lldb::Format format
Default display format.