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