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"
27#include "lldb/Utility/State.h"
28#include "lldb/Utility/Stream.h"
29#include "lldb/lldb-defines.h"
30#include "lldb/lldb-forward.h"
31#include "lldb/lldb-types.h"
32
33#include <memory>
34#include <optional>
35#include <string>
36
37#include <cinttypes>
38
39using namespace lldb;
40using namespace lldb_private;
41
42Value::Value() : m_value(), m_compiler_type(), m_data_buffer() {}
43
44Value::Value(const Scalar &scalar)
45 : m_value(scalar), m_compiler_type(), m_data_buffer() {}
46
47Value::Value(const void *bytes, int len)
48 : m_value(), m_compiler_type(), m_value_type(ValueType::HostAddress),
49 m_data_buffer() {
50 SetBytes(bytes, len);
51}
52
54 : m_value(v.m_value), m_compiler_type(v.m_compiler_type),
55 m_context(v.m_context), m_value_type(v.m_value_type),
56 m_context_type(v.m_context_type), m_data_buffer() {
57 const uintptr_t rhs_value =
59 if ((rhs_value != 0) &&
60 (rhs_value == (uintptr_t)v.m_data_buffer.GetBytes())) {
63
64 m_value = (uintptr_t)m_data_buffer.GetBytes();
65 }
66}
67
69 if (this != &rhs) {
70 m_value = rhs.m_value;
72 m_context = rhs.m_context;
75 const uintptr_t rhs_value =
77 if ((rhs_value != 0) &&
78 (rhs_value == (uintptr_t)rhs.m_data_buffer.GetBytes())) {
81
82 m_value = (uintptr_t)m_data_buffer.GetBytes();
83 }
84 }
85 return *this;
86}
87
88void Value::SetBytes(const void *bytes, int len) {
90 m_data_buffer.CopyData(bytes, len);
91 m_value = (uintptr_t)m_data_buffer.GetBytes();
92}
93
94void Value::AppendBytes(const void *bytes, int len) {
96 m_data_buffer.AppendData(bytes, len);
97 m_value = (uintptr_t)m_data_buffer.GetBytes();
98}
99
100void Value::Dump(Stream *strm) {
101 m_value.GetValue(strm, true);
102 strm->Printf(", value_type = %s, context = %p, context_type = %s",
105}
106
108
110 switch (m_value_type) {
113 break;
115 return eAddressTypeLoad;
117 return eAddressTypeFile;
119 return eAddressTypeHost;
120 }
121 return eAddressTypeInvalid;
122}
123
125 switch (address_type) {
126 case eAddressTypeFile:
128 case eAddressTypeLoad:
130 case eAddressTypeHost:
134 }
135 llvm_unreachable("Unexpected address type!");
136}
137
138RegisterInfo *Value::GetRegisterInfo() const {
140 return static_cast<RegisterInfo *>(m_context);
141 return nullptr;
142}
143
146 return static_cast<Type *>(m_context);
147 return nullptr;
148}
149
151 if (this == &rhs)
152 return 0;
153
154 size_t curr_size = m_data_buffer.GetByteSize();
156 switch (rhs.GetValueType()) {
158 return 0;
159 case ValueType::Scalar: {
160 const size_t scalar_size = rhs.m_value.GetByteSize();
161 if (scalar_size > 0) {
162 const size_t new_size = curr_size + scalar_size;
163 if (ResizeData(new_size) == new_size) {
164 rhs.m_value.GetAsMemoryData(m_data_buffer.GetBytes() + curr_size,
165 scalar_size, endian::InlHostByteOrder(),
166 error);
167 return scalar_size;
168 }
169 }
170 } break;
174 const uint8_t *src = rhs.GetBuffer().GetBytes();
175 const size_t src_len = rhs.GetBuffer().GetByteSize();
176 if (src && src_len > 0) {
177 const size_t new_size = curr_size + src_len;
178 if (ResizeData(new_size) == new_size) {
179 ::memcpy(m_data_buffer.GetBytes() + curr_size, src, src_len);
180 return src_len;
181 }
182 }
183 } break;
184 }
185 return 0;
186}
187
188size_t Value::ResizeData(size_t len) {
191 m_value = (uintptr_t)m_data_buffer.GetBytes();
192 return m_data_buffer.GetByteSize();
193}
194
196 switch (m_context_type) {
198 case ContextType::RegisterInfo: // RegisterInfo *
199 case ContextType::LLDBType: // Type *
200 break;
201
202 case ContextType::Variable: // Variable *
203 ResolveValue(exe_ctx);
204 return true;
205 }
206 return false;
207}
208
209uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
210 switch (m_context_type) {
211 case ContextType::RegisterInfo: // RegisterInfo *
212 if (GetRegisterInfo()) {
213 if (error_ptr)
214 error_ptr->Clear();
215 return GetRegisterInfo()->byte_size;
216 }
217 break;
218
220 case ContextType::LLDBType: // Type *
221 case ContextType::Variable: // Variable *
222 {
223 auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
224 if (std::optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
225 if (error_ptr)
226 error_ptr->Clear();
227 return *size;
228 }
229 break;
230 }
231 }
232 if (error_ptr && error_ptr->Success())
233 error_ptr->SetErrorString("Unable to determine byte size.");
234 return 0;
235}
236
238 if (!m_compiler_type.IsValid()) {
239 switch (m_context_type) {
241 break;
242
244 break; // TODO: Eventually convert into a compiler type?
245
247 Type *lldb_type = GetType();
248 if (lldb_type)
250 } break;
251
253 Variable *variable = GetVariable();
254 if (variable) {
255 Type *variable_type = variable->GetType();
256 if (variable_type)
257 m_compiler_type = variable_type->GetForwardCompilerType();
258 }
259 } break;
260 }
261 }
262
263 return m_compiler_type;
264}
265
266void Value::SetCompilerType(const CompilerType &compiler_type) {
267 m_compiler_type = compiler_type;
268}
269
271 switch (m_context_type) {
273 if (GetRegisterInfo())
274 return GetRegisterInfo()->format;
275 break;
276
280 const CompilerType &ast_type = GetCompilerType();
281 if (ast_type.IsValid())
282 return ast_type.GetFormat();
283 } break;
284 }
285
286 // Return a good default in case we can't figure anything out
287 return eFormatHex;
288}
289
291 switch (m_value_type) {
293 return false;
295 if (m_value.GetData(data))
296 return true;
297 break;
298
304 data.GetByteOrder());
305 return true;
306 }
307 break;
308 }
309
310 return false;
311}
312
314 Module *module) {
315 data.Clear();
316
319 AddressType address_type = eAddressTypeFile;
320 Address file_so_addr;
321 const CompilerType &ast_type = GetCompilerType();
322 std::optional<uint64_t> type_size = ast_type.GetByteSize(
323 exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
324 // Nothing to be done for a zero-sized type.
325 if (type_size && *type_size == 0)
326 return error;
327
328 switch (m_value_type) {
330 error.SetErrorString("invalid value");
331 break;
332 case ValueType::Scalar: {
334 if (ast_type.IsValid())
335 data.SetAddressByteSize(ast_type.GetPointerByteSize());
336 else
337 data.SetAddressByteSize(sizeof(void *));
338
339 uint32_t limit_byte_size = UINT32_MAX;
340
341 if (type_size)
342 limit_byte_size = *type_size;
343
344 if (limit_byte_size <= m_value.GetByteSize()) {
345 if (m_value.GetData(data, limit_byte_size))
346 return error; // Success;
347 }
348
349 error.SetErrorString("extracting data from value failed");
350 break;
351 }
353 if (exe_ctx == nullptr) {
354 error.SetErrorString("can't read load address (no execution context)");
355 } else {
356 Process *process = exe_ctx->GetProcessPtr();
357 if (process == nullptr || !process->IsAlive()) {
358 Target *target = exe_ctx->GetTargetPtr();
359 if (target) {
360 // Allow expressions to run and evaluate things when the target has
361 // memory sections loaded. This allows you to use "target modules
362 // load" to load your executable and any shared libraries, then
363 // execute commands where you can look at types in data sections.
364 const SectionLoadList &target_sections = target->GetSectionLoadList();
365 if (!target_sections.IsEmpty()) {
367 if (target_sections.ResolveLoadAddress(address, file_so_addr)) {
368 address_type = eAddressTypeLoad;
369 data.SetByteOrder(target->GetArchitecture().GetByteOrder());
372 } else
373 address = LLDB_INVALID_ADDRESS;
374 }
375 } else {
376 error.SetErrorString("can't read load address (invalid process)");
377 }
378 } else {
380 address_type = eAddressTypeLoad;
381 data.SetByteOrder(
382 process->GetTarget().GetArchitecture().GetByteOrder());
385 }
386 }
387 break;
388
390 if (exe_ctx == nullptr) {
391 error.SetErrorString("can't read file address (no execution context)");
392 } else if (exe_ctx->GetTargetPtr() == nullptr) {
393 error.SetErrorString("can't read file address (invalid target)");
394 } else {
396 if (address == LLDB_INVALID_ADDRESS) {
397 error.SetErrorString("invalid file address");
398 } else {
399 if (module == nullptr) {
400 // The only thing we can currently lock down to a module so that we
401 // can resolve a file address, is a variable.
402 Variable *variable = GetVariable();
403 if (variable) {
404 SymbolContext var_sc;
405 variable->CalculateSymbolContext(&var_sc);
406 module = var_sc.module_sp.get();
407 }
408 }
409
410 if (module) {
411 bool resolved = false;
412 ObjectFile *objfile = module->GetObjectFile();
413 if (objfile) {
414 Address so_addr(address, objfile->GetSectionList());
415 addr_t load_address =
416 so_addr.GetLoadAddress(exe_ctx->GetTargetPtr());
417 bool process_launched_and_stopped =
418 exe_ctx->GetProcessPtr()
420 true /* must_exist */)
421 : false;
422 // Don't use the load address if the process has exited.
423 if (load_address != LLDB_INVALID_ADDRESS &&
424 process_launched_and_stopped) {
425 resolved = true;
426 address = load_address;
427 address_type = eAddressTypeLoad;
428 data.SetByteOrder(
430 data.SetAddressByteSize(exe_ctx->GetTargetRef()
433 } else {
434 if (so_addr.IsSectionOffset()) {
435 resolved = true;
436 file_so_addr = so_addr;
437 data.SetByteOrder(objfile->GetByteOrder());
438 data.SetAddressByteSize(objfile->GetAddressByteSize());
439 }
440 }
441 }
442 if (!resolved) {
443 Variable *variable = GetVariable();
444
445 if (module) {
446 if (variable)
447 error.SetErrorStringWithFormat(
448 "unable to resolve the module for file address 0x%" PRIx64
449 " for variable '%s' in %s",
450 address, variable->GetName().AsCString(""),
451 module->GetFileSpec().GetPath().c_str());
452 else
453 error.SetErrorStringWithFormat(
454 "unable to resolve the module for file address 0x%" PRIx64
455 " in %s",
456 address, module->GetFileSpec().GetPath().c_str());
457 } else {
458 if (variable)
459 error.SetErrorStringWithFormat(
460 "unable to resolve the module for file address 0x%" PRIx64
461 " for variable '%s'",
462 address, variable->GetName().AsCString(""));
463 else
464 error.SetErrorStringWithFormat(
465 "unable to resolve the module for file address 0x%" PRIx64,
466 address);
467 }
468 }
469 } else {
470 // Can't convert a file address to anything valid without more
471 // context (which Module it came from)
472 error.SetErrorString(
473 "can't read memory from file address without more context");
474 }
475 }
476 }
477 break;
478
481 address_type = eAddressTypeHost;
482 if (exe_ctx) {
483 Target *target = exe_ctx->GetTargetPtr();
484 if (target) {
485 data.SetByteOrder(target->GetArchitecture().GetByteOrder());
487 break;
488 }
489 }
490 // fallback to host settings
492 data.SetAddressByteSize(sizeof(void *));
493 break;
494 }
495
496 // Bail if we encountered any errors
497 if (error.Fail())
498 return error;
499
500 if (address == LLDB_INVALID_ADDRESS) {
501 error.SetErrorStringWithFormat("invalid %s address",
502 address_type == eAddressTypeHost ? "host"
503 : "load");
504 return error;
505 }
506
507 // If we got here, we need to read the value from memory.
508 size_t byte_size = GetValueByteSize(&error, exe_ctx);
509
510 // Bail if we encountered any errors getting the byte size.
511 if (error.Fail())
512 return error;
513
514 // No memory to read for zero-sized types.
515 if (byte_size == 0)
516 return error;
517
518 // Make sure we have enough room within "data", and if we don't make
519 // something large enough that does
520 if (!data.ValidOffsetForDataOfSize(0, byte_size)) {
521 auto data_sp = std::make_shared<DataBufferHeap>(byte_size, '\0');
522 data.SetData(data_sp);
523 }
524
525 uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
526 if (dst != nullptr) {
527 if (address_type == eAddressTypeHost) {
528 // The address is an address in this process, so just copy it.
529 if (address == 0) {
530 error.SetErrorString("trying to read from host address of 0.");
531 return error;
532 }
533 memcpy(dst, reinterpret_cast<uint8_t *>(address), byte_size);
534 } else if ((address_type == eAddressTypeLoad) ||
535 (address_type == eAddressTypeFile)) {
536 if (file_so_addr.IsValid()) {
537 const bool force_live_memory = true;
538 if (exe_ctx->GetTargetRef().ReadMemory(file_so_addr, dst, byte_size,
539 error, force_live_memory) !=
540 byte_size) {
541 error.SetErrorStringWithFormat(
542 "read memory from 0x%" PRIx64 " failed", (uint64_t)address);
543 }
544 } else {
545 // The execution context might have a NULL process, but it might have a
546 // valid process in the exe_ctx->target, so use the
547 // ExecutionContext::GetProcess accessor to ensure we get the process
548 // if there is one.
549 Process *process = exe_ctx->GetProcessPtr();
550
551 if (process) {
552 const size_t bytes_read =
553 process->ReadMemory(address, dst, byte_size, error);
554 if (bytes_read != byte_size)
555 error.SetErrorStringWithFormat(
556 "read memory from 0x%" PRIx64 " failed (%u of %u bytes read)",
557 (uint64_t)address, (uint32_t)bytes_read, (uint32_t)byte_size);
558 } else {
559 error.SetErrorStringWithFormat("read memory from 0x%" PRIx64
560 " failed (invalid process)",
561 (uint64_t)address);
562 }
563 }
564 } else {
565 error.SetErrorStringWithFormat("unsupported AddressType value (%i)",
566 address_type);
567 }
568 } else {
569 error.SetErrorString("out of memory");
570 }
571
572 return error;
573}
574
576 const CompilerType &compiler_type = GetCompilerType();
577 if (compiler_type.IsValid()) {
578 switch (m_value_type) {
580 case ValueType::Scalar: // raw scalar value
581 break;
582
584 case ValueType::LoadAddress: // load address value
585 case ValueType::HostAddress: // host address value (for memory in the process
586 // that is using liblldb)
587 {
588 DataExtractor data;
590 Status error(GetValueAsData(exe_ctx, data, nullptr));
591 if (error.Success()) {
592 Scalar scalar;
593 if (compiler_type.GetValueAsScalar(
594 data, 0, data.GetByteSize(), scalar,
595 exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)) {
596 m_value = scalar;
598 } else {
599 if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
600 m_value.Clear();
602 }
603 }
604 } else {
605 if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
606 m_value.Clear();
608 }
609 }
610 } break;
611 }
612 }
613 return m_value;
614}
615
618 return static_cast<Variable *>(m_context);
619 return nullptr;
620}
621
623 m_value.Clear();
626 m_context = nullptr;
629}
630
632 switch (value_type) {
634 return "invalid";
636 return "scalar";
638 return "file address";
640 return "load address";
642 return "host address";
643 };
644 llvm_unreachable("enum cases exhausted.");
645}
646
648 switch (context_type) {
650 return "invalid";
652 return "RegisterInfo *";
654 return "Type *";
656 return "Variable *";
657 };
658 llvm_unreachable("enum cases exhausted.");
659}
660
662 if (!module || !target || (GetValueType() != ValueType::FileAddress))
663 return;
664
666 if (file_addr == LLDB_INVALID_ADDRESS)
667 return;
668
669 Address so_addr;
670 if (!module->ResolveFileAddress(file_addr, so_addr))
671 return;
672 lldb::addr_t load_addr = so_addr.GetLoadAddress(target);
673 if (load_addr == LLDB_INVALID_ADDRESS)
674 return;
675
677 GetScalar() = load_addr;
678}
679
680void ValueList::PushValue(const Value &value) { m_values.push_back(value); }
681
682size_t ValueList::GetSize() { return m_values.size(); }
683
685 if (idx < GetSize()) {
686 return &(m_values[idx]);
687 } else
688 return nullptr;
689}
690
691void ValueList::Clear() { m_values.clear(); }
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
Definition: Address.h:59
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:311
bool IsValid() const
Check if the object state is valid.
Definition: Address.h:345
bool IsSectionOffset() const
Check if an address is section offset.
Definition: Address.h:332
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:691
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition: ArchSpec.cpp:738
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, Scalar &value, ExecutionContextScope *exe_scope) const
std::optional< 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.
Definition: ConstString.h:195
lldb::offset_t GetByteSize() const override
lldb::offset_t SetByteSize(lldb::offset_t byte_size)
Set the number of bytes in the data buffer.
void AppendData(const void *src, uint64_t src_len)
void CopyData(const void *src, lldb::offset_t src_len)
Makes a copy of the src_len bytes in src.
An data extractor class.
Definition: DataExtractor.h:48
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:366
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:88
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
Definition: Module.cpp:1230
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr)
Definition: Module.cpp:440
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition: Module.h:498
A plug-in interface definition class for object file parsers.
Definition: ObjectFile.h:43
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).
Definition: ObjectFile.cpp:588
A plug-in interface definition class for debugging a process.
Definition: Process.h:335
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:1941
lldb::StateType GetState()
Get accessor for the current process state.
Definition: Process.cpp:1312
virtual bool IsAlive()
Check if a process is still alive.
Definition: Process.cpp:1102
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1224
size_t GetByteSize() const
Definition: Scalar.cpp:131
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition: Scalar.cpp:334
size_t GetAsMemoryData(void *dst, size_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
Definition: Scalar.cpp:773
bool GetData(DataExtractor &data, size_t limit_byte_size=UINT32_MAX) const
Definition: Scalar.cpp:84
void GetValue(Stream *s, bool show_type) const
Definition: Scalar.cpp:155
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
An error handling class.
Definition: Status.h:44
void Clear()
Clear the object state.
Definition: Status.cpp:167
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
Definition: Status.cpp:241
bool Success() const
Test for success condition.
Definition: Status.cpp:287
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:107
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
lldb::ModuleSP module_sp
The Module for a given query.
SectionLoadList & GetSectionLoadList()
Definition: Target.h:1109
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)
Definition: Target.cpp:1782
const ArchSpec & GetArchitecture() const
Definition: Target.h:996
CompilerType GetForwardCompilerType()
Definition: Type.cpp:667
void PushValue(const Value &value)
Definition: Value.cpp:680
collection m_values
Definition: Value.h:177
Value * GetValueAtIndex(size_t idx)
Definition: Value.cpp:684
const Scalar & GetScalar() const
Definition: Value.h:112
Type * GetType()
Definition: Value.cpp:144
void AppendBytes(const void *bytes, int len)
Definition: Value.cpp:94
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, Module *module)
Definition: Value.cpp:313
RegisterInfo * GetRegisterInfo() const
Definition: Value.cpp:138
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).
@ FileAddress
A file address value.
@ LoadAddress
A load address value.
@ Scalar
A raw scalar value.
void * m_context
Definition: Value.h:153
void Dump(Stream *strm)
Definition: Value.cpp:100
static ValueType GetValueTypeFromAddressType(AddressType address_type)
Definition: Value.cpp:124
ContextType m_context_type
Definition: Value.h:155
Value & operator=(const Value &rhs)
Definition: Value.cpp:68
size_t AppendDataToHostBuffer(const Value &rhs)
Definition: Value.cpp:150
ValueType GetValueType() const
Definition: Value.cpp:107
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:266
DataBufferHeap m_data_buffer
Definition: Value.h:156
lldb::Format GetValueDefaultFormat()
Definition: Value.cpp:270
static const char * GetValueTypeAsCString(ValueType context_type)
Definition: Value.cpp:631
DataBufferHeap & GetBuffer()
Definition: Value.h:120
Scalar & ResolveValue(ExecutionContext *exe_ctx)
Definition: Value.cpp:575
uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx)
Definition: Value.cpp:209
void SetValueType(ValueType value_type)
Definition: Value.h:89
CompilerType m_compiler_type
Definition: Value.h:152
ContextType
Type that describes Value::m_context.
Definition: Value.h:56
@ Variable
lldb_private::Variable *.
@ RegisterInfo
RegisterInfo * (can be a scalar or a vector register).
@ LLDBType
lldb_private::Type *.
ValueType m_value_type
Definition: Value.h:154
bool GetData(DataExtractor &data)
Definition: Value.cpp:290
AddressType GetValueAddressType() const
Definition: Value.cpp:109
const CompilerType & GetCompilerType()
Definition: Value.cpp:237
static const char * GetContextTypeAsCString(ContextType context_type)
Definition: Value.cpp:647
void ConvertToLoadAddress(Module *module, Target *target)
Convert this value's file address to a load address, if possible.
Definition: Value.cpp:661
size_t ResizeData(size_t len)
Definition: Value.cpp:188
void SetBytes(const void *bytes, int len)
Definition: Value.cpp:88
bool ValueOf(ExecutionContext *exe_ctx)
Definition: Value.cpp:195
Scalar m_value
Definition: Value.h:151
Variable * GetVariable()
Definition: Value.cpp:616
ConstString GetName() const
Definition: Variable.cpp:71
void CalculateSymbolContext(SymbolContext *sc)
Definition: Variable.cpp:206
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb::ByteOrder InlHostByteOrder()
Definition: Endian.h:25
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
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.
Definition: SBAddress.h:15
Format
Display format definitions.
uint64_t addr_t
Definition: lldb-types.h:79