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 if (!strm)
102 return;
103 m_value.GetValue(*strm, true);
104 strm->Printf(", value_type = %s, context = %p, context_type = %s",
107}
108
110
112 switch (m_value_type) {
115 break;
117 return eAddressTypeLoad;
119 return eAddressTypeFile;
121 return eAddressTypeHost;
122 }
123 return eAddressTypeInvalid;
124}
125
127 switch (address_type) {
128 case eAddressTypeFile:
130 case eAddressTypeLoad:
132 case eAddressTypeHost:
136 }
137 llvm_unreachable("Unexpected address type!");
138}
139
142 return static_cast<RegisterInfo *>(m_context);
143 return nullptr;
144}
145
148 return static_cast<Type *>(m_context);
149 return nullptr;
150}
151
153 if (this == &rhs)
154 return 0;
155
156 size_t curr_size = m_data_buffer.GetByteSize();
158 switch (rhs.GetValueType()) {
160 return 0;
161 case ValueType::Scalar: {
162 const size_t scalar_size = rhs.m_value.GetByteSize();
163 if (scalar_size > 0) {
164 const size_t new_size = curr_size + scalar_size;
165 if (ResizeData(new_size) == new_size) {
167 scalar_size, endian::InlHostByteOrder(),
168 error);
169 return scalar_size;
170 }
171 }
172 } break;
176 const uint8_t *src = rhs.GetBuffer().GetBytes();
177 const size_t src_len = rhs.GetBuffer().GetByteSize();
178 if (src && src_len > 0) {
179 const size_t new_size = curr_size + src_len;
180 if (ResizeData(new_size) == new_size) {
181 ::memcpy(m_data_buffer.GetBytes() + curr_size, src, src_len);
182 return src_len;
183 }
184 }
185 } break;
186 }
187 return 0;
188}
189
190size_t Value::ResizeData(size_t len) {
193 m_value = (uintptr_t)m_data_buffer.GetBytes();
194 return m_data_buffer.GetByteSize();
195}
196
198 switch (m_context_type) {
200 case ContextType::RegisterInfo: // RegisterInfo *
201 case ContextType::LLDBType: // Type *
202 break;
203
204 case ContextType::Variable: // Variable *
205 ResolveValue(exe_ctx);
206 return true;
207 }
208 return false;
209}
210
211uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
212 switch (m_context_type) {
213 case ContextType::RegisterInfo: // RegisterInfo *
214 if (GetRegisterInfo()) {
215 if (error_ptr)
216 error_ptr->Clear();
217 return GetRegisterInfo()->byte_size;
218 }
219 break;
220
222 case ContextType::LLDBType: // Type *
223 case ContextType::Variable: // Variable *
224 {
225 auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
226 if (std::optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
227 if (error_ptr)
228 error_ptr->Clear();
229 return *size;
230 }
231 break;
232 }
233 }
234 if (error_ptr && error_ptr->Success())
235 *error_ptr = Status::FromErrorString("Unable to determine byte size.");
236 return 0;
237}
238
240 if (!m_compiler_type.IsValid()) {
241 switch (m_context_type) {
243 break;
244
246 break; // TODO: Eventually convert into a compiler type?
247
249 Type *lldb_type = GetType();
250 if (lldb_type)
252 } break;
253
255 Variable *variable = GetVariable();
256 if (variable) {
257 Type *variable_type = variable->GetType();
258 if (variable_type)
259 m_compiler_type = variable_type->GetForwardCompilerType();
260 }
261 } break;
262 }
263 }
264
265 return m_compiler_type;
266}
267
268void Value::SetCompilerType(const CompilerType &compiler_type) {
269 m_compiler_type = compiler_type;
270}
271
273 switch (m_context_type) {
275 if (GetRegisterInfo())
276 return GetRegisterInfo()->format;
277 break;
278
282 const CompilerType &ast_type = GetCompilerType();
283 if (ast_type.IsValid())
284 return ast_type.GetFormat();
285 } break;
286 }
287
288 // Return a good default in case we can't figure anything out
289 return eFormatHex;
290}
291
293 switch (m_value_type) {
295 return false;
297 if (m_value.GetData(data))
298 return true;
299 break;
300
306 data.GetByteOrder());
307 return true;
308 }
309 break;
310 }
311
312 return false;
313}
314
316 Module *module) {
317 data.Clear();
318
321 AddressType address_type = eAddressTypeFile;
322 Address file_so_addr;
323 const CompilerType &ast_type = GetCompilerType();
324 std::optional<uint64_t> type_size = ast_type.GetByteSize(
325 exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
326 // Nothing to be done for a zero-sized type.
327 if (type_size && *type_size == 0)
328 return error;
329
330 switch (m_value_type) {
332 error = Status::FromErrorString("invalid value");
333 break;
334 case ValueType::Scalar: {
336 if (ast_type.IsValid())
337 data.SetAddressByteSize(ast_type.GetPointerByteSize());
338 else
339 data.SetAddressByteSize(sizeof(void *));
340
341 uint32_t limit_byte_size = UINT32_MAX;
342
343 if (type_size)
344 limit_byte_size = *type_size;
345
346 if (limit_byte_size <= m_value.GetByteSize()) {
347 if (m_value.GetData(data, limit_byte_size))
348 return error; // Success;
349 }
350
351 error = Status::FromErrorString("extracting data from value failed");
352 break;
353 }
355 if (exe_ctx == nullptr) {
357 "can't read load address (no execution context)");
358 } else {
359 Process *process = exe_ctx->GetProcessPtr();
360 if (process == nullptr || !process->IsAlive()) {
361 Target *target = exe_ctx->GetTargetPtr();
362 if (target) {
363 // Allow expressions to run and evaluate things when the target has
364 // memory sections loaded. This allows you to use "target modules
365 // load" to load your executable and any shared libraries, then
366 // execute commands where you can look at types in data sections.
367 const SectionLoadList &target_sections = target->GetSectionLoadList();
368 if (!target_sections.IsEmpty()) {
370 if (target_sections.ResolveLoadAddress(address, file_so_addr)) {
371 address_type = eAddressTypeLoad;
372 data.SetByteOrder(target->GetArchitecture().GetByteOrder());
375 } else
376 address = LLDB_INVALID_ADDRESS;
377 }
378 } else {
380 "can't read load address (invalid process)");
381 }
382 } else {
384 address_type = eAddressTypeLoad;
385 data.SetByteOrder(
386 process->GetTarget().GetArchitecture().GetByteOrder());
389 }
390 }
391 break;
392
394 if (exe_ctx == nullptr) {
396 "can't read file address (no execution context)");
397 } else if (exe_ctx->GetTargetPtr() == nullptr) {
398 error =
399 Status::FromErrorString("can't read file address (invalid target)");
400 } else {
402 if (address == LLDB_INVALID_ADDRESS) {
403 error = Status::FromErrorString("invalid file address");
404 } else {
405 if (module == nullptr) {
406 // The only thing we can currently lock down to a module so that we
407 // can resolve a file address, is a variable.
408 Variable *variable = GetVariable();
409 if (variable) {
410 SymbolContext var_sc;
411 variable->CalculateSymbolContext(&var_sc);
412 module = var_sc.module_sp.get();
413 }
414 }
415
416 if (module) {
417 bool resolved = false;
418 ObjectFile *objfile = module->GetObjectFile();
419 if (objfile) {
420 Address so_addr(address, objfile->GetSectionList());
421 addr_t load_address =
422 so_addr.GetLoadAddress(exe_ctx->GetTargetPtr());
423 bool process_launched_and_stopped =
424 exe_ctx->GetProcessPtr()
426 true /* must_exist */)
427 : false;
428 // Don't use the load address if the process has exited.
429 if (load_address != LLDB_INVALID_ADDRESS &&
430 process_launched_and_stopped) {
431 resolved = true;
432 address = load_address;
433 address_type = eAddressTypeLoad;
434 data.SetByteOrder(
436 data.SetAddressByteSize(exe_ctx->GetTargetRef()
439 } else {
440 if (so_addr.IsSectionOffset()) {
441 resolved = true;
442 file_so_addr = so_addr;
443 data.SetByteOrder(objfile->GetByteOrder());
444 data.SetAddressByteSize(objfile->GetAddressByteSize());
445 }
446 }
447 }
448 if (!resolved) {
449 Variable *variable = GetVariable();
450
451 if (module) {
452 if (variable)
454 "unable to resolve the module for file address 0x%" PRIx64
455 " for variable '%s' in %s",
456 address, variable->GetName().AsCString(""),
457 module->GetFileSpec().GetPath().c_str());
458 else
460 "unable to resolve the module for file address 0x%" PRIx64
461 " in %s",
462 address, module->GetFileSpec().GetPath().c_str());
463 } else {
464 if (variable)
466 "unable to resolve the module for file address 0x%" PRIx64
467 " for variable '%s'",
468 address, variable->GetName().AsCString(""));
469 else
471 "unable to resolve the module for file address 0x%" PRIx64,
472 address);
473 }
474 }
475 } else {
476 // Can't convert a file address to anything valid without more
477 // context (which Module it came from)
479 "can't read memory from file address without more context");
480 }
481 }
482 }
483 break;
484
487 address_type = eAddressTypeHost;
488 if (exe_ctx) {
489 Target *target = exe_ctx->GetTargetPtr();
490 if (target) {
491 data.SetByteOrder(target->GetArchitecture().GetByteOrder());
493 break;
494 }
495 }
496 // fallback to host settings
498 data.SetAddressByteSize(sizeof(void *));
499 break;
500 }
501
502 // Bail if we encountered any errors
503 if (error.Fail())
504 return error;
505
506 if (address == LLDB_INVALID_ADDRESS) {
508 "invalid %s address",
509 address_type == eAddressTypeHost ? "host" : "load");
510 return error;
511 }
512
513 // If we got here, we need to read the value from memory.
514 size_t byte_size = GetValueByteSize(&error, exe_ctx);
515
516 // Bail if we encountered any errors getting the byte size.
517 if (error.Fail())
518 return error;
519
520 // No memory to read for zero-sized types.
521 if (byte_size == 0)
522 return error;
523
524 // Make sure we have enough room within "data", and if we don't make
525 // something large enough that does
526 if (!data.ValidOffsetForDataOfSize(0, byte_size)) {
527 auto data_sp = std::make_shared<DataBufferHeap>(byte_size, '\0');
528 data.SetData(data_sp);
529 }
530
531 uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
532 if (dst != nullptr) {
533 if (address_type == eAddressTypeHost) {
534 // The address is an address in this process, so just copy it.
535 if (address == 0) {
536 error =
537 Status::FromErrorString("trying to read from host address of 0.");
538 return error;
539 }
540 memcpy(dst, reinterpret_cast<uint8_t *>(address), byte_size);
541 } else if ((address_type == eAddressTypeLoad) ||
542 (address_type == eAddressTypeFile)) {
543 if (file_so_addr.IsValid()) {
544 const bool force_live_memory = true;
545 if (exe_ctx->GetTargetRef().ReadMemory(file_so_addr, dst, byte_size,
546 error, force_live_memory) !=
547 byte_size) {
549 "read memory from 0x%" PRIx64 " failed", (uint64_t)address);
550 }
551 } else {
552 // The execution context might have a NULL process, but it might have a
553 // valid process in the exe_ctx->target, so use the
554 // ExecutionContext::GetProcess accessor to ensure we get the process
555 // if there is one.
556 Process *process = exe_ctx->GetProcessPtr();
557
558 if (process) {
559 const size_t bytes_read =
560 process->ReadMemory(address, dst, byte_size, error);
561 if (bytes_read != byte_size)
563 "read memory from 0x%" PRIx64 " failed (%u of %u bytes read)",
564 (uint64_t)address, (uint32_t)bytes_read, (uint32_t)byte_size);
565 } else {
567 "read memory from 0x%" PRIx64 " failed (invalid process)",
568 (uint64_t)address);
569 }
570 }
571 } else {
573 "unsupported AddressType value (%i)", address_type);
574 }
575 } else {
576 error = Status::FromErrorString("out of memory");
577 }
578
579 return error;
580}
581
583 const CompilerType &compiler_type = GetCompilerType();
584 if (compiler_type.IsValid()) {
585 switch (m_value_type) {
587 case ValueType::Scalar: // raw scalar value
588 break;
589
591 case ValueType::LoadAddress: // load address value
592 case ValueType::HostAddress: // host address value (for memory in the process
593 // that is using liblldb)
594 {
595 DataExtractor data;
597 Status error(GetValueAsData(exe_ctx, data, module));
598 if (error.Success()) {
599 Scalar scalar;
600 if (compiler_type.GetValueAsScalar(
601 data, 0, data.GetByteSize(), scalar,
602 exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)) {
603 m_value = scalar;
605 } else {
606 if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
607 m_value.Clear();
609 }
610 }
611 } else {
612 if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
613 m_value.Clear();
615 }
616 }
617 } break;
618 }
619 }
620 return m_value;
621}
622
625 return static_cast<Variable *>(m_context);
626 return nullptr;
627}
628
630 m_value.Clear();
633 m_context = nullptr;
636}
637
639 switch (value_type) {
641 return "invalid";
643 return "scalar";
645 return "file address";
647 return "load address";
649 return "host address";
650 };
651 llvm_unreachable("enum cases exhausted.");
652}
653
655 switch (context_type) {
657 return "invalid";
659 return "RegisterInfo *";
661 return "Type *";
663 return "Variable *";
664 };
665 llvm_unreachable("enum cases exhausted.");
666}
667
669 if (!module || !target || (GetValueType() != ValueType::FileAddress))
670 return;
671
673 if (file_addr == LLDB_INVALID_ADDRESS)
674 return;
675
676 Address so_addr;
677 if (!module->ResolveFileAddress(file_addr, so_addr))
678 return;
679 lldb::addr_t load_addr = so_addr.GetLoadAddress(target);
680 if (load_addr == LLDB_INVALID_ADDRESS)
681 return;
682
684 GetScalar() = load_addr;
685}
686
687void ValueList::PushValue(const Value &value) { m_values.push_back(value); }
688
689size_t ValueList::GetSize() { return m_values.size(); }
690
692 if (idx < GetSize()) {
693 return &(m_values[idx]);
694 } else
695 return nullptr;
696}
697
698void ValueList::Clear() { m_values.clear(); }
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
Definition: Address.h:62
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:313
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:709
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition: ArchSpec.cpp:756
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:188
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
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:367
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:89
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
Definition: Module.cpp:1199
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr)
Definition: Module.cpp:444
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition: Module.h:453
A plug-in interface definition class for object file parsers.
Definition: ObjectFile.h:44
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:602
A plug-in interface definition class for debugging a process.
Definition: Process.h:343
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:1953
lldb::StateType GetState()
Get accessor for the current process state.
Definition: Process.cpp:1308
virtual bool IsAlive()
Check if a process is still alive.
Definition: Process.cpp:1100
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1246
void GetValue(Stream &s, bool show_type) const
Definition: Scalar.cpp:156
size_t GetByteSize() const
Definition: Scalar.cpp:132
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition: Scalar.cpp:335
size_t GetAsMemoryData(void *dst, size_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
Definition: Scalar.cpp:771
bool GetData(DataExtractor &data, size_t limit_byte_size=UINT32_MAX) const
Definition: Scalar.cpp:85
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
An error handling class.
Definition: Status.h:115
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:138
bool Success() const
Test for success condition.
Definition: Status.cpp:280
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.
Definition: SymbolContext.h:34
lldb::ModuleSP module_sp
The Module for a given query.
SectionLoadList & GetSectionLoadList()
Definition: Target.h:1154
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)
Definition: Target.cpp:1956
const ArchSpec & GetArchitecture() const
Definition: Target.h:1039
CompilerType GetForwardCompilerType()
Definition: Type.cpp:774
void PushValue(const Value &value)
Definition: Value.cpp:687
collection m_values
Definition: Value.h:177
Value * GetValueAtIndex(size_t idx)
Definition: Value.cpp:691
const Scalar & GetScalar() const
Definition: Value.h:112
Type * GetType()
Definition: Value.cpp:146
void AppendBytes(const void *bytes, int len)
Definition: Value.cpp:94
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, Module *module)
Definition: Value.cpp:315
RegisterInfo * GetRegisterInfo() const
Definition: Value.cpp:140
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:126
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:152
ValueType GetValueType() const
Definition: Value.cpp:109
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:268
DataBufferHeap m_data_buffer
Definition: Value.h:156
lldb::Format GetValueDefaultFormat()
Definition: Value.cpp:272
Scalar & ResolveValue(ExecutionContext *exe_ctx, Module *module=nullptr)
Definition: Value.cpp:582
static const char * GetValueTypeAsCString(ValueType context_type)
Definition: Value.cpp:638
DataBufferHeap & GetBuffer()
Definition: Value.h:120
uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx)
Definition: Value.cpp:211
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:292
AddressType GetValueAddressType() const
Definition: Value.cpp:111
const CompilerType & GetCompilerType()
Definition: Value.cpp:239
static const char * GetContextTypeAsCString(ContextType context_type)
Definition: Value.cpp:654
void ConvertToLoadAddress(Module *module, Target *target)
Convert this value's file address to a load address, if possible.
Definition: Value.cpp:668
size_t ResizeData(size_t len)
Definition: Value.cpp:190
void SetBytes(const void *bytes, int len)
Definition: Value.cpp:88
bool ValueOf(ExecutionContext *exe_ctx)
Definition: Value.cpp:197
Scalar m_value
Definition: Value.h:151
Variable * GetVariable()
Definition: Value.cpp:623
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
Definition: lldb-defines.h:82
#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.
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:80
Every register is described in detail including its name, alternate name (optional),...
uint32_t byte_size
Size in bytes of the register.
lldb::Format format
Default display format.