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 <string>
35 
36 #include <cinttypes>
37 
38 using namespace lldb;
39 using namespace lldb_private;
40 
41 Value::Value() : m_value(), m_compiler_type(), m_data_buffer() {}
42 
43 Value::Value(const Scalar &scalar)
44  : m_value(scalar), m_compiler_type(), m_data_buffer() {}
45 
46 Value::Value(const void *bytes, int len)
47  : m_value(), m_compiler_type(), m_value_type(ValueType::HostAddress),
48  m_data_buffer() {
49  SetBytes(bytes, len);
50 }
51 
53  : m_value(v.m_value), m_compiler_type(v.m_compiler_type),
54  m_context(v.m_context), m_value_type(v.m_value_type),
55  m_context_type(v.m_context_type), m_data_buffer() {
56  const uintptr_t rhs_value =
58  if ((rhs_value != 0) &&
59  (rhs_value == (uintptr_t)v.m_data_buffer.GetBytes())) {
62 
63  m_value = (uintptr_t)m_data_buffer.GetBytes();
64  }
65 }
66 
68  if (this != &rhs) {
69  m_value = rhs.m_value;
71  m_context = rhs.m_context;
74  const uintptr_t rhs_value =
75  (uintptr_t)rhs.m_value.ULongLong(LLDB_INVALID_ADDRESS);
76  if ((rhs_value != 0) &&
77  (rhs_value == (uintptr_t)rhs.m_data_buffer.GetBytes())) {
78  m_data_buffer.CopyData(rhs.m_data_buffer.GetBytes(),
80 
81  m_value = (uintptr_t)m_data_buffer.GetBytes();
82  }
83  }
84  return *this;
85 }
86 
87 void Value::SetBytes(const void *bytes, int len) {
89  m_data_buffer.CopyData(bytes, len);
90  m_value = (uintptr_t)m_data_buffer.GetBytes();
91 }
92 
93 void Value::AppendBytes(const void *bytes, int len) {
95  m_data_buffer.AppendData(bytes, len);
96  m_value = (uintptr_t)m_data_buffer.GetBytes();
97 }
98 
99 void Value::Dump(Stream *strm) {
100  m_value.GetValue(strm, true);
101  strm->Printf(", value_type = %s, context = %p, context_type = %s",
104 }
105 
107 
109  switch (m_value_type) {
110  case ValueType::Invalid:
111  case ValueType::Scalar:
112  break;
114  return eAddressTypeLoad;
116  return eAddressTypeFile;
118  return eAddressTypeHost;
119  }
120  return eAddressTypeInvalid;
121 }
122 
123 RegisterInfo *Value::GetRegisterInfo() const {
125  return static_cast<RegisterInfo *>(m_context);
126  return nullptr;
127 }
128 
131  return static_cast<Type *>(m_context);
132  return nullptr;
133 }
134 
136  if (this == &rhs)
137  return 0;
138 
139  size_t curr_size = m_data_buffer.GetByteSize();
140  Status error;
141  switch (rhs.GetValueType()) {
142  case ValueType::Invalid:
143  return 0;
144  case ValueType::Scalar: {
145  const size_t scalar_size = rhs.m_value.GetByteSize();
146  if (scalar_size > 0) {
147  const size_t new_size = curr_size + scalar_size;
148  if (ResizeData(new_size) == new_size) {
149  rhs.m_value.GetAsMemoryData(m_data_buffer.GetBytes() + curr_size,
150  scalar_size, endian::InlHostByteOrder(),
151  error);
152  return scalar_size;
153  }
154  }
155  } break;
158  case ValueType::HostAddress: {
159  const uint8_t *src = rhs.GetBuffer().GetBytes();
160  const size_t src_len = rhs.GetBuffer().GetByteSize();
161  if (src && src_len > 0) {
162  const size_t new_size = curr_size + src_len;
163  if (ResizeData(new_size) == new_size) {
164  ::memcpy(m_data_buffer.GetBytes() + curr_size, src, src_len);
165  return src_len;
166  }
167  }
168  } break;
169  }
170  return 0;
171 }
172 
173 size_t Value::ResizeData(size_t len) {
176  m_value = (uintptr_t)m_data_buffer.GetBytes();
177  return m_data_buffer.GetByteSize();
178 }
179 
181  switch (m_context_type) {
183  case ContextType::RegisterInfo: // RegisterInfo *
184  case ContextType::LLDBType: // Type *
185  break;
186 
187  case ContextType::Variable: // Variable *
188  ResolveValue(exe_ctx);
189  return true;
190  }
191  return false;
192 }
193 
194 uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
195  switch (m_context_type) {
196  case ContextType::RegisterInfo: // RegisterInfo *
197  if (GetRegisterInfo()) {
198  if (error_ptr)
199  error_ptr->Clear();
200  return GetRegisterInfo()->byte_size;
201  }
202  break;
203 
205  case ContextType::LLDBType: // Type *
206  case ContextType::Variable: // Variable *
207  {
208  auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
209  if (llvm::Optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
210  if (error_ptr)
211  error_ptr->Clear();
212  return *size;
213  }
214  break;
215  }
216  }
217  if (error_ptr && error_ptr->Success())
218  error_ptr->SetErrorString("Unable to determine byte size.");
219  return 0;
220 }
221 
223  if (!m_compiler_type.IsValid()) {
224  switch (m_context_type) {
226  break;
227 
229  break; // TODO: Eventually convert into a compiler type?
230 
231  case ContextType::LLDBType: {
232  Type *lldb_type = GetType();
233  if (lldb_type)
235  } break;
236 
237  case ContextType::Variable: {
238  Variable *variable = GetVariable();
239  if (variable) {
240  Type *variable_type = variable->GetType();
241  if (variable_type)
242  m_compiler_type = variable_type->GetForwardCompilerType();
243  }
244  } break;
245  }
246  }
247 
248  return m_compiler_type;
249 }
250 
251 void Value::SetCompilerType(const CompilerType &compiler_type) {
252  m_compiler_type = compiler_type;
253 }
254 
256  switch (m_context_type) {
258  if (GetRegisterInfo())
259  return GetRegisterInfo()->format;
260  break;
261 
264  case ContextType::Variable: {
265  const CompilerType &ast_type = GetCompilerType();
266  if (ast_type.IsValid())
267  return ast_type.GetFormat();
268  } break;
269  }
270 
271  // Return a good default in case we can't figure anything out
272  return eFormatHex;
273 }
274 
276  switch (m_value_type) {
277  case ValueType::Invalid:
278  return false;
279  case ValueType::Scalar:
280  if (m_value.GetData(data))
281  return true;
282  break;
283 
287  if (m_data_buffer.GetByteSize()) {
288  data.SetData(m_data_buffer.GetBytes(), m_data_buffer.GetByteSize(),
289  data.GetByteOrder());
290  return true;
291  }
292  break;
293  }
294 
295  return false;
296 }
297 
299  Module *module) {
300  data.Clear();
301 
302  Status error;
304  AddressType address_type = eAddressTypeFile;
305  Address file_so_addr;
306  const CompilerType &ast_type = GetCompilerType();
307  llvm::Optional<uint64_t> type_size = ast_type.GetByteSize(
308  exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
309  // Nothing to be done for a zero-sized type.
310  if (type_size && *type_size == 0)
311  return error;
312 
313  switch (m_value_type) {
314  case ValueType::Invalid:
315  error.SetErrorString("invalid value");
316  break;
317  case ValueType::Scalar: {
319  if (ast_type.IsValid())
320  data.SetAddressByteSize(ast_type.GetPointerByteSize());
321  else
322  data.SetAddressByteSize(sizeof(void *));
323 
324  uint32_t limit_byte_size = UINT32_MAX;
325 
326  if (type_size)
327  limit_byte_size = *type_size;
328 
329  if (limit_byte_size <= m_value.GetByteSize()) {
330  if (m_value.GetData(data, limit_byte_size))
331  return error; // Success;
332  }
333 
334  error.SetErrorString("extracting data from value failed");
335  break;
336  }
338  if (exe_ctx == nullptr) {
339  error.SetErrorString("can't read load address (no execution context)");
340  } else {
341  Process *process = exe_ctx->GetProcessPtr();
342  if (process == nullptr || !process->IsAlive()) {
343  Target *target = exe_ctx->GetTargetPtr();
344  if (target) {
345  // Allow expressions to run and evaluate things when the target has
346  // memory sections loaded. This allows you to use "target modules
347  // load" to load your executable and any shared libraries, then
348  // execute commands where you can look at types in data sections.
349  const SectionLoadList &target_sections = target->GetSectionLoadList();
350  if (!target_sections.IsEmpty()) {
352  if (target_sections.ResolveLoadAddress(address, file_so_addr)) {
353  address_type = eAddressTypeLoad;
354  data.SetByteOrder(target->GetArchitecture().GetByteOrder());
355  data.SetAddressByteSize(
356  target->GetArchitecture().GetAddressByteSize());
357  } else
358  address = LLDB_INVALID_ADDRESS;
359  }
360  } else {
361  error.SetErrorString("can't read load address (invalid process)");
362  }
363  } else {
365  address_type = eAddressTypeLoad;
366  data.SetByteOrder(
367  process->GetTarget().GetArchitecture().GetByteOrder());
368  data.SetAddressByteSize(
370  }
371  }
372  break;
373 
375  if (exe_ctx == nullptr) {
376  error.SetErrorString("can't read file address (no execution context)");
377  } else if (exe_ctx->GetTargetPtr() == nullptr) {
378  error.SetErrorString("can't read file address (invalid target)");
379  } else {
381  if (address == LLDB_INVALID_ADDRESS) {
382  error.SetErrorString("invalid file address");
383  } else {
384  if (module == nullptr) {
385  // The only thing we can currently lock down to a module so that we
386  // can resolve a file address, is a variable.
387  Variable *variable = GetVariable();
388  if (variable) {
389  SymbolContext var_sc;
390  variable->CalculateSymbolContext(&var_sc);
391  module = var_sc.module_sp.get();
392  }
393  }
394 
395  if (module) {
396  bool resolved = false;
397  ObjectFile *objfile = module->GetObjectFile();
398  if (objfile) {
399  Address so_addr(address, objfile->GetSectionList());
400  addr_t load_address =
401  so_addr.GetLoadAddress(exe_ctx->GetTargetPtr());
402  bool process_launched_and_stopped =
403  exe_ctx->GetProcessPtr()
405  true /* must_exist */)
406  : false;
407  // Don't use the load address if the process has exited.
408  if (load_address != LLDB_INVALID_ADDRESS &&
409  process_launched_and_stopped) {
410  resolved = true;
411  address = load_address;
412  address_type = eAddressTypeLoad;
413  data.SetByteOrder(
414  exe_ctx->GetTargetRef().GetArchitecture().GetByteOrder());
415  data.SetAddressByteSize(exe_ctx->GetTargetRef()
416  .GetArchitecture()
417  .GetAddressByteSize());
418  } else {
419  if (so_addr.IsSectionOffset()) {
420  resolved = true;
421  file_so_addr = so_addr;
422  data.SetByteOrder(objfile->GetByteOrder());
423  data.SetAddressByteSize(objfile->GetAddressByteSize());
424  }
425  }
426  }
427  if (!resolved) {
428  Variable *variable = GetVariable();
429 
430  if (module) {
431  if (variable)
432  error.SetErrorStringWithFormat(
433  "unable to resolve the module for file address 0x%" PRIx64
434  " for variable '%s' in %s",
435  address, variable->GetName().AsCString(""),
436  module->GetFileSpec().GetPath().c_str());
437  else
438  error.SetErrorStringWithFormat(
439  "unable to resolve the module for file address 0x%" PRIx64
440  " in %s",
441  address, module->GetFileSpec().GetPath().c_str());
442  } else {
443  if (variable)
444  error.SetErrorStringWithFormat(
445  "unable to resolve the module for file address 0x%" PRIx64
446  " for variable '%s'",
447  address, variable->GetName().AsCString(""));
448  else
449  error.SetErrorStringWithFormat(
450  "unable to resolve the module for file address 0x%" PRIx64,
451  address);
452  }
453  }
454  } else {
455  // Can't convert a file address to anything valid without more
456  // context (which Module it came from)
457  error.SetErrorString(
458  "can't read memory from file address without more context");
459  }
460  }
461  }
462  break;
463 
466  address_type = eAddressTypeHost;
467  if (exe_ctx) {
468  Target *target = exe_ctx->GetTargetPtr();
469  if (target) {
470  data.SetByteOrder(target->GetArchitecture().GetByteOrder());
472  break;
473  }
474  }
475  // fallback to host settings
477  data.SetAddressByteSize(sizeof(void *));
478  break;
479  }
480 
481  // Bail if we encountered any errors
482  if (error.Fail())
483  return error;
484 
485  if (address == LLDB_INVALID_ADDRESS) {
486  error.SetErrorStringWithFormat("invalid %s address",
487  address_type == eAddressTypeHost ? "host"
488  : "load");
489  return error;
490  }
491 
492  // If we got here, we need to read the value from memory.
493  size_t byte_size = GetValueByteSize(&error, exe_ctx);
494 
495  // Bail if we encountered any errors getting the byte size.
496  if (error.Fail())
497  return error;
498 
499  // No memory to read for zero-sized types.
500  if (byte_size == 0)
501  return error;
502 
503  // Make sure we have enough room within "data", and if we don't make
504  // something large enough that does
505  if (!data.ValidOffsetForDataOfSize(0, byte_size)) {
506  auto data_sp = std::make_shared<DataBufferHeap>(byte_size, '\0');
507  data.SetData(data_sp);
508  }
509 
510  uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
511  if (dst != nullptr) {
512  if (address_type == eAddressTypeHost) {
513  // The address is an address in this process, so just copy it.
514  if (address == 0) {
515  error.SetErrorString("trying to read from host address of 0.");
516  return error;
517  }
518  memcpy(dst, reinterpret_cast<uint8_t *>(address), byte_size);
519  } else if ((address_type == eAddressTypeLoad) ||
520  (address_type == eAddressTypeFile)) {
521  if (file_so_addr.IsValid()) {
522  const bool force_live_memory = true;
523  if (exe_ctx->GetTargetRef().ReadMemory(file_so_addr, dst, byte_size,
524  error, force_live_memory) !=
525  byte_size) {
526  error.SetErrorStringWithFormat(
527  "read memory from 0x%" PRIx64 " failed", (uint64_t)address);
528  }
529  } else {
530  // The execution context might have a NULL process, but it might have a
531  // valid process in the exe_ctx->target, so use the
532  // ExecutionContext::GetProcess accessor to ensure we get the process
533  // if there is one.
534  Process *process = exe_ctx->GetProcessPtr();
535 
536  if (process) {
537  const size_t bytes_read =
538  process->ReadMemory(address, dst, byte_size, error);
539  if (bytes_read != byte_size)
540  error.SetErrorStringWithFormat(
541  "read memory from 0x%" PRIx64 " failed (%u of %u bytes read)",
542  (uint64_t)address, (uint32_t)bytes_read, (uint32_t)byte_size);
543  } else {
544  error.SetErrorStringWithFormat("read memory from 0x%" PRIx64
545  " failed (invalid process)",
546  (uint64_t)address);
547  }
548  }
549  } else {
550  error.SetErrorStringWithFormat("unsupported AddressType value (%i)",
551  address_type);
552  }
553  } else {
554  error.SetErrorString("out of memory");
555  }
556 
557  return error;
558 }
559 
561  const CompilerType &compiler_type = GetCompilerType();
562  if (compiler_type.IsValid()) {
563  switch (m_value_type) {
564  case ValueType::Invalid:
565  case ValueType::Scalar: // raw scalar value
566  break;
567 
569  case ValueType::LoadAddress: // load address value
570  case ValueType::HostAddress: // host address value (for memory in the process
571  // that is using liblldb)
572  {
573  DataExtractor data;
575  Status error(GetValueAsData(exe_ctx, data, nullptr));
576  if (error.Success()) {
577  Scalar scalar;
578  if (compiler_type.GetValueAsScalar(
579  data, 0, data.GetByteSize(), scalar,
580  exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)) {
581  m_value = scalar;
583  } else {
584  if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
585  m_value.Clear();
587  }
588  }
589  } else {
590  if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
591  m_value.Clear();
593  }
594  }
595  } break;
596  }
597  }
598  return m_value;
599 }
600 
603  return static_cast<Variable *>(m_context);
604  return nullptr;
605 }
606 
607 void Value::Clear() {
608  m_value.Clear();
611  m_context = nullptr;
614 }
615 
616 const char *Value::GetValueTypeAsCString(ValueType value_type) {
617  switch (value_type) {
618  case ValueType::Invalid:
619  return "invalid";
620  case ValueType::Scalar:
621  return "scalar";
623  return "file address";
625  return "load address";
627  return "host address";
628  };
629  llvm_unreachable("enum cases exhausted.");
630 }
631 
632 const char *Value::GetContextTypeAsCString(ContextType context_type) {
633  switch (context_type) {
635  return "invalid";
637  return "RegisterInfo *";
639  return "Type *";
641  return "Variable *";
642  };
643  llvm_unreachable("enum cases exhausted.");
644 }
645 
646 void Value::ConvertToLoadAddress(Module *module, Target *target) {
647  if (!module || !target || (GetValueType() != ValueType::FileAddress))
648  return;
649 
651  if (file_addr == LLDB_INVALID_ADDRESS)
652  return;
653 
654  Address so_addr;
655  if (!module->ResolveFileAddress(file_addr, so_addr))
656  return;
657  lldb::addr_t load_addr = so_addr.GetLoadAddress(target);
658  if (load_addr == LLDB_INVALID_ADDRESS)
659  return;
660 
662  GetScalar() = load_addr;
663 }
664 
665 void ValueList::PushValue(const Value &value) { m_values.push_back(value); }
666 
667 size_t ValueList::GetSize() { return m_values.size(); }
668 
670  if (idx < GetSize()) {
671  return &(m_values[idx]);
672  } else
673  return nullptr;
674 }
675 
676 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:782
lldb_private::Module::GetObjectFile
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
Definition: Module.cpp:1263
lldb_private::Value::GetValueDefaultFormat
lldb::Format GetValueDefaultFormat()
Definition: Value.cpp:255
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:729
lldb_private::DataBufferHeap::GetByteSize
lldb::offset_t GetByteSize() const override
Definition: DataBufferHeap.cpp:43
lldb_private::Value::GetValueAddressType
AddressType GetValueAddressType() const
Definition: Value.cpp:108
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:1922
lldb::Format
Format
Display format definitions.
Definition: lldb-enumerations.h:155
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::Value::Clear
void Clear()
Definition: Value.cpp:607
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:298
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:106
lldb-defines.h
lldb_private::ValueList::GetValueAtIndex
Value * GetValueAtIndex(size_t idx)
Definition: Value.cpp:669
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:85
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:180
lldb_private::Value::ValueType::LoadAddress
@ LoadAddress
A load address value.
lldb_private::CompilerType::GetByteSize
llvm::Optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
Definition: CompilerType.cpp:489
lldb_private::Process::IsAlive
virtual bool IsAlive()
Check if a process is still alive.
Definition: Process.cpp:1085
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:616
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:667
lldb_private::Value::m_context
void * m_context
Definition: Value.h:151
lldb_private::Value::operator=
Value & operator=(const Value &rhs)
Definition: Value.cpp:67
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:1295
Process.h
lldb_private::Value::ContextType::Invalid
@ Invalid
Undefined.
lldb_private::Value::GetRegisterInfo
RegisterInfo * GetRegisterInfo() const
Definition: Value.cpp:123
lldb_private::Value::SetCompilerType
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:251
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:496
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:665
lldb_private::CompilerType::Clear
void Clear()
Definition: CompilerType.h:409
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:646
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:508
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:436
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:93
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:632
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:72
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:682
ObjectFile.h
lldb_private::CompilerType::GetPointerByteSize
size_t GetPointerByteSize() const
AST related queries.
Definition: CompilerType.cpp:271
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:560
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:989
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:1743
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:275
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:66
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:655
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::Value::GetType
Type * GetType()
Definition: Value.cpp:129
lldb_private::ValueList::Clear
void Clear()
Definition: Value.cpp:676
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:1102
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:33
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:222
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:87
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::eFormatHex
@ eFormatHex
Definition: lldb-enumerations.h:169
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:173
lldb_private::Value::GetVariable
Variable * GetVariable()
Definition: Value.cpp:601
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:194
Stream.h
lldb_private::Variable
Definition: Variable.h:25
lldb_private::Value::Dump
void Dump(Stream *strm)
Definition: Value.cpp:99
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:364
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:41
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:135
ExecutionContext.h
DataBufferHeap.h
lldb_private::Scalar::GetValue
void GetValue(Stream *s, bool show_type) const
Definition: Scalar.cpp:155