LLDB  mainline
Address.cpp
Go to the documentation of this file.
1 //===-- Address.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/Address.h"
10 #include "lldb/Core/Declaration.h"
12 #include "lldb/Core/Module.h"
13 #include "lldb/Core/ModuleList.h"
14 #include "lldb/Core/Section.h"
15 #include "lldb/Symbol/Block.h"
16 #include "lldb/Symbol/LineEntry.h"
17 #include "lldb/Symbol/ObjectFile.h"
18 #include "lldb/Symbol/Symbol.h"
21 #include "lldb/Symbol/Symtab.h"
22 #include "lldb/Symbol/Type.h"
23 #include "lldb/Symbol/Variable.h"
27 #include "lldb/Target/Process.h"
29 #include "lldb/Target/Target.h"
32 #include "lldb/Utility/Endian.h"
33 #include "lldb/Utility/FileSpec.h"
34 #include "lldb/Utility/Status.h"
35 #include "lldb/Utility/Stream.h"
37 
38 #include "llvm/ADT/StringRef.h"
39 #include "llvm/ADT/Triple.h"
40 #include "llvm/Support/Compiler.h"
41 
42 #include <cstdint>
43 #include <memory>
44 #include <vector>
45 
46 #include <cassert>
47 #include <cinttypes>
48 #include <cstring>
49 
50 namespace lldb_private {
51 class CompileUnit;
52 }
53 namespace lldb_private {
54 class Function;
55 }
56 
57 using namespace lldb;
58 using namespace lldb_private;
59 
60 static size_t ReadBytes(ExecutionContextScope *exe_scope,
61  const Address &address, void *dst, size_t dst_len) {
62  if (exe_scope == nullptr)
63  return 0;
64 
65  TargetSP target_sp(exe_scope->CalculateTarget());
66  if (target_sp) {
67  Status error;
68  bool force_live_memory = true;
69  return target_sp->ReadMemory(address, dst, dst_len, error,
70  force_live_memory);
71  }
72  return 0;
73 }
74 
76  const Address &address,
77  ByteOrder &byte_order,
78  uint32_t &addr_size) {
79  byte_order = eByteOrderInvalid;
80  addr_size = 0;
81  if (exe_scope == nullptr)
82  return false;
83 
84  TargetSP target_sp(exe_scope->CalculateTarget());
85  if (target_sp) {
86  byte_order = target_sp->GetArchitecture().GetByteOrder();
87  addr_size = target_sp->GetArchitecture().GetAddressByteSize();
88  }
89 
90  if (byte_order == eByteOrderInvalid || addr_size == 0) {
91  ModuleSP module_sp(address.GetModule());
92  if (module_sp) {
93  byte_order = module_sp->GetArchitecture().GetByteOrder();
94  addr_size = module_sp->GetArchitecture().GetAddressByteSize();
95  }
96  }
97  return byte_order != eByteOrderInvalid && addr_size != 0;
98 }
99 
100 static uint64_t ReadUIntMax64(ExecutionContextScope *exe_scope,
101  const Address &address, uint32_t byte_size,
102  bool &success) {
103  uint64_t uval64 = 0;
104  if (exe_scope == nullptr || byte_size > sizeof(uint64_t)) {
105  success = false;
106  return 0;
107  }
108  uint64_t buf = 0;
109 
110  success = ReadBytes(exe_scope, address, &buf, byte_size) == byte_size;
111  if (success) {
112  ByteOrder byte_order = eByteOrderInvalid;
113  uint32_t addr_size = 0;
114  if (GetByteOrderAndAddressSize(exe_scope, address, byte_order, addr_size)) {
115  DataExtractor data(&buf, sizeof(buf), byte_order, addr_size);
116  lldb::offset_t offset = 0;
117  uval64 = data.GetU64(&offset);
118  } else
119  success = false;
120  }
121  return uval64;
122 }
123 
124 static bool ReadAddress(ExecutionContextScope *exe_scope,
125  const Address &address, uint32_t pointer_size,
126  Address &deref_so_addr) {
127  if (exe_scope == nullptr)
128  return false;
129 
130  bool success = false;
131  addr_t deref_addr = ReadUIntMax64(exe_scope, address, pointer_size, success);
132  if (success) {
133  ExecutionContext exe_ctx;
134  exe_scope->CalculateExecutionContext(exe_ctx);
135  // If we have any sections that are loaded, try and resolve using the
136  // section load list
137  Target *target = exe_ctx.GetTargetPtr();
138  if (target && !target->GetSectionLoadList().IsEmpty()) {
139  if (target->GetSectionLoadList().ResolveLoadAddress(deref_addr,
140  deref_so_addr))
141  return true;
142  } else {
143  // If we were not running, yet able to read an integer, we must have a
144  // module
145  ModuleSP module_sp(address.GetModule());
146 
147  assert(module_sp);
148  if (module_sp->ResolveFileAddress(deref_addr, deref_so_addr))
149  return true;
150  }
151 
152  // We couldn't make "deref_addr" into a section offset value, but we were
153  // able to read the address, so we return a section offset address with no
154  // section and "deref_addr" as the offset (address).
155  deref_so_addr.SetRawAddress(deref_addr);
156  return true;
157  }
158  return false;
159 }
160 
161 static bool DumpUInt(ExecutionContextScope *exe_scope, const Address &address,
162  uint32_t byte_size, Stream *strm) {
163  if (exe_scope == nullptr || byte_size == 0)
164  return false;
165  std::vector<uint8_t> buf(byte_size, 0);
166 
167  if (ReadBytes(exe_scope, address, &buf[0], buf.size()) == buf.size()) {
168  ByteOrder byte_order = eByteOrderInvalid;
169  uint32_t addr_size = 0;
170  if (GetByteOrderAndAddressSize(exe_scope, address, byte_order, addr_size)) {
171  DataExtractor data(&buf.front(), buf.size(), byte_order, addr_size);
172 
173  DumpDataExtractor(data, strm,
174  0, // Start offset in "data"
175  eFormatHex, // Print as characters
176  buf.size(), // Size of item
177  1, // Items count
178  UINT32_MAX, // num per line
179  LLDB_INVALID_ADDRESS, // base address
180  0, // bitfield bit size
181  0); // bitfield bit offset
182 
183  return true;
184  }
185  }
186  return false;
187 }
188 
190  const Address &address, Stream *strm) {
191  if (exe_scope == nullptr)
192  return 0;
193  const size_t k_buf_len = 256;
194  char buf[k_buf_len + 1];
195  buf[k_buf_len] = '\0'; // NULL terminate
196 
197  // Byte order and address size don't matter for C string dumping..
198  DataExtractor data(buf, sizeof(buf), endian::InlHostByteOrder(), 4);
199  size_t total_len = 0;
200  size_t bytes_read;
201  Address curr_address(address);
202  strm->PutChar('"');
203  while ((bytes_read = ReadBytes(exe_scope, curr_address, buf, k_buf_len)) >
204  0) {
205  size_t len = strlen(buf);
206  if (len == 0)
207  break;
208  if (len > bytes_read)
209  len = bytes_read;
210 
211  DumpDataExtractor(data, strm,
212  0, // Start offset in "data"
213  eFormatChar, // Print as characters
214  1, // Size of item (1 byte for a char!)
215  len, // How many bytes to print?
216  UINT32_MAX, // num per line
217  LLDB_INVALID_ADDRESS, // base address
218  0, // bitfield bit size
219 
220  0); // bitfield bit offset
221 
222  total_len += bytes_read;
223 
224  if (len < k_buf_len)
225  break;
226  curr_address.SetOffset(curr_address.GetOffset() + bytes_read);
227  }
228  strm->PutChar('"');
229  return total_len;
230 }
231 
232 Address::Address(lldb::addr_t abs_addr) : m_section_wp(), m_offset(abs_addr) {}
233 
234 Address::Address(addr_t address, const SectionList *section_list)
235  : m_section_wp(), m_offset(LLDB_INVALID_ADDRESS) {
236  ResolveAddressUsingFileSections(address, section_list);
237 }
238 
239 const Address &Address::operator=(const Address &rhs) {
240  if (this != &rhs) {
242  m_offset = rhs.m_offset;
243  }
244  return *this;
245 }
246 
248  const SectionList *section_list) {
249  if (section_list) {
250  SectionSP section_sp(
251  section_list->FindSectionContainingFileAddress(file_addr));
252  m_section_wp = section_sp;
253  if (section_sp) {
254  assert(section_sp->ContainsFileAddress(file_addr));
255  m_offset = file_addr - section_sp->GetFileAddress();
256  return true; // Successfully transformed addr into a section offset
257  // address
258  }
259  }
260  m_offset = file_addr;
261  return false; // Failed to resolve this address to a section offset value
262 }
263 
264 /// if "addr_range_ptr" is not NULL, then fill in with the address range of the function.
266  AddressRange *addr_range_ptr) {
267  constexpr SymbolContextItem resolve_scope =
268  eSymbolContextFunction | eSymbolContextSymbol;
269 
270  if (!(CalculateSymbolContext(&sym_ctx, resolve_scope) & resolve_scope)) {
271  if (addr_range_ptr)
272  addr_range_ptr->Clear();
273  return false;
274  }
275 
276  if (!addr_range_ptr)
277  return true;
278 
279  return sym_ctx.GetAddressRange(resolve_scope, 0, false, *addr_range_ptr);
280 }
281 
282 ModuleSP Address::GetModule() const {
283  lldb::ModuleSP module_sp;
284  SectionSP section_sp(GetSection());
285  if (section_sp)
286  module_sp = section_sp->GetModule();
287  return module_sp;
288 }
289 
291  SectionSP section_sp(GetSection());
292  if (section_sp) {
293  addr_t sect_file_addr = section_sp->GetFileAddress();
294  if (sect_file_addr == LLDB_INVALID_ADDRESS) {
295  // Section isn't resolved, we can't return a valid file address
296  return LLDB_INVALID_ADDRESS;
297  }
298  // We have a valid file range, so we can return the file based address by
299  // adding the file base address to our offset
300  return sect_file_addr + m_offset;
301  } else if (SectionWasDeletedPrivate()) {
302  // Used to have a valid section but it got deleted so the offset doesn't
303  // mean anything without the section
304  return LLDB_INVALID_ADDRESS;
305  }
306  // No section, we just return the offset since it is the value in this case
307  return m_offset;
308 }
309 
311  SectionSP section_sp(GetSection());
312  if (section_sp) {
313  if (target) {
314  addr_t sect_load_addr = section_sp->GetLoadBaseAddress(target);
315 
316  if (sect_load_addr != LLDB_INVALID_ADDRESS) {
317  // We have a valid file range, so we can return the file based address
318  // by adding the file base address to our offset
319  return sect_load_addr + m_offset;
320  }
321  }
322  } else if (SectionWasDeletedPrivate()) {
323  // Used to have a valid section but it got deleted so the offset doesn't
324  // mean anything without the section
325  return LLDB_INVALID_ADDRESS;
326  } else {
327  // We don't have a section so the offset is the load address
328  return m_offset;
329  }
330  // The section isn't resolved or an invalid target was passed in so we can't
331  // return a valid load address.
332  return LLDB_INVALID_ADDRESS;
333 }
334 
335 addr_t Address::GetCallableLoadAddress(Target *target, bool is_indirect) const {
336  addr_t code_addr = LLDB_INVALID_ADDRESS;
337 
338  if (is_indirect && target) {
339  ProcessSP processSP = target->GetProcessSP();
340  Status error;
341  if (processSP) {
342  code_addr = processSP->ResolveIndirectFunction(this, error);
343  if (!error.Success())
344  code_addr = LLDB_INVALID_ADDRESS;
345  }
346  } else {
347  code_addr = GetLoadAddress(target);
348  }
349 
350  if (code_addr == LLDB_INVALID_ADDRESS)
351  return code_addr;
352 
353  if (target)
354  return target->GetCallableLoadAddress(code_addr, GetAddressClass());
355  return code_addr;
356 }
357 
359  if (SetLoadAddress(load_addr, target)) {
360  if (target)
362  return true;
363  }
364  return false;
365 }
366 
368  AddressClass addr_class) const {
369  addr_t code_addr = GetLoadAddress(target);
370  if (code_addr != LLDB_INVALID_ADDRESS) {
371  if (addr_class == AddressClass::eInvalid)
372  addr_class = GetAddressClass();
373  code_addr = target->GetOpcodeLoadAddress(code_addr, addr_class);
374  }
375  return code_addr;
376 }
377 
379  AddressClass addr_class,
380  bool allow_section_end) {
381  if (SetLoadAddress(load_addr, target, allow_section_end)) {
382  if (target) {
383  if (addr_class == AddressClass::eInvalid)
384  addr_class = GetAddressClass();
385  m_offset = target->GetOpcodeLoadAddress(m_offset, addr_class);
386  }
387  return true;
388  }
389  return false;
390 }
391 
393  DescriptionLevel level) const {
394  assert(level == eDescriptionLevelBrief &&
395  "Non-brief descriptions not implemented");
396  LineEntry line_entry;
397  if (CalculateSymbolContextLineEntry(line_entry)) {
398  s.Printf(" (%s:%u:%u)", line_entry.file.GetFilename().GetCString(),
399  line_entry.line, line_entry.column);
400  return true;
401  }
402  return false;
403 }
404 
406  DumpStyle fallback_style, uint32_t addr_size) const {
407  // If the section was nullptr, only load address is going to work unless we
408  // are trying to deref a pointer
409  SectionSP section_sp(GetSection());
410  if (!section_sp && style != DumpStyleResolvedPointerDescription)
411  style = DumpStyleLoadAddress;
412 
413  ExecutionContext exe_ctx(exe_scope);
414  Target *target = exe_ctx.GetTargetPtr();
415  // If addr_byte_size is UINT32_MAX, then determine the correct address byte
416  // size for the process or default to the size of addr_t
417  if (addr_size == UINT32_MAX) {
418  if (target)
419  addr_size = target->GetArchitecture().GetAddressByteSize();
420  else
421  addr_size = sizeof(addr_t);
422  }
423 
424  Address so_addr;
425  switch (style) {
426  case DumpStyleInvalid:
427  return false;
428 
430  if (section_sp) {
431  section_sp->DumpName(s->AsRawOstream());
432  s->Printf(" + %" PRIu64, m_offset);
433  } else {
434  DumpAddress(s->AsRawOstream(), m_offset, addr_size);
435  }
436  break;
437 
439  s->Printf("(Section *)%p + ", static_cast<void *>(section_sp.get()));
440  DumpAddress(s->AsRawOstream(), m_offset, addr_size);
441  break;
442 
444  if (section_sp) {
445  ModuleSP module_sp = section_sp->GetModule();
446  if (module_sp)
447  s->Printf("%s[", module_sp->GetFileSpec().GetFilename().AsCString(
448  "<Unknown>"));
449  else
450  s->Printf("%s[", "<Unknown>");
451  }
452  LLVM_FALLTHROUGH;
453  case DumpStyleFileAddress: {
454  addr_t file_addr = GetFileAddress();
455  if (file_addr == LLDB_INVALID_ADDRESS) {
456  if (fallback_style != DumpStyleInvalid)
457  return Dump(s, exe_scope, fallback_style, DumpStyleInvalid, addr_size);
458  return false;
459  }
460  DumpAddress(s->AsRawOstream(), file_addr, addr_size);
461  if (style == DumpStyleModuleWithFileAddress && section_sp)
462  s->PutChar(']');
463  } break;
464 
465  case DumpStyleLoadAddress: {
466  addr_t load_addr = GetLoadAddress(target);
467 
468  /*
469  * MIPS:
470  * Display address in compressed form for MIPS16 or microMIPS
471  * if the address belongs to AddressClass::eCodeAlternateISA.
472  */
473  if (target) {
474  const llvm::Triple::ArchType llvm_arch =
475  target->GetArchitecture().GetMachine();
476  if (llvm_arch == llvm::Triple::mips ||
477  llvm_arch == llvm::Triple::mipsel ||
478  llvm_arch == llvm::Triple::mips64 ||
479  llvm_arch == llvm::Triple::mips64el)
480  load_addr = GetCallableLoadAddress(target);
481  }
482 
483  if (load_addr == LLDB_INVALID_ADDRESS) {
484  if (fallback_style != DumpStyleInvalid)
485  return Dump(s, exe_scope, fallback_style, DumpStyleInvalid, addr_size);
486  return false;
487  }
488  DumpAddress(s->AsRawOstream(), load_addr, addr_size);
489  } break;
490 
495  if (IsSectionOffset()) {
496  uint32_t pointer_size = 4;
497  ModuleSP module_sp(GetModule());
498  if (target)
499  pointer_size = target->GetArchitecture().GetAddressByteSize();
500  else if (module_sp)
501  pointer_size = module_sp->GetArchitecture().GetAddressByteSize();
502 
503  bool showed_info = false;
504  if (section_sp) {
505  SectionType sect_type = section_sp->GetType();
506  switch (sect_type) {
507  case eSectionTypeData:
508  if (module_sp) {
509  if (Symtab *symtab = module_sp->GetSymtab()) {
510  const addr_t file_Addr = GetFileAddress();
511  Symbol *symbol =
512  symtab->FindSymbolContainingFileAddress(file_Addr);
513  if (symbol) {
514  const char *symbol_name = symbol->GetName().AsCString();
515  if (symbol_name) {
516  s->PutCString(symbol_name);
517  addr_t delta =
518  file_Addr - symbol->GetAddressRef().GetFileAddress();
519  if (delta)
520  s->Printf(" + %" PRIu64, delta);
521  showed_info = true;
522  }
523  }
524  }
525  }
526  break;
527 
529  // Read the C string from memory and display it
530  showed_info = true;
531  ReadCStringFromMemory(exe_scope, *this, s);
532  break;
533 
535  if (ReadAddress(exe_scope, *this, pointer_size, so_addr)) {
536 #if VERBOSE_OUTPUT
537  s->PutCString("(char *)");
538  so_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
540  s->PutCString(": ");
541 #endif
542  showed_info = true;
543  ReadCStringFromMemory(exe_scope, so_addr, s);
544  }
545  break;
546 
548  if (ReadAddress(exe_scope, *this, pointer_size, so_addr)) {
549  if (target && so_addr.IsSectionOffset()) {
550  SymbolContext func_sc;
552  so_addr, eSymbolContextEverything, func_sc);
553  if (func_sc.function != nullptr || func_sc.symbol != nullptr) {
554  showed_info = true;
555 #if VERBOSE_OUTPUT
556  s->PutCString("(objc_msgref *) -> { (func*)");
557  so_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
559 #else
560  s->PutCString("{ ");
561 #endif
562  Address cstr_addr(*this);
563  cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
564  func_sc.DumpStopContext(s, exe_scope, so_addr, true, true,
565  false, true, true);
566  if (ReadAddress(exe_scope, cstr_addr, pointer_size, so_addr)) {
567 #if VERBOSE_OUTPUT
568  s->PutCString("), (char *)");
569  so_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
571  s->PutCString(" (");
572 #else
573  s->PutCString(", ");
574 #endif
575  ReadCStringFromMemory(exe_scope, so_addr, s);
576  }
577 #if VERBOSE_OUTPUT
578  s->PutCString(") }");
579 #else
580  s->PutCString(" }");
581 #endif
582  }
583  }
584  }
585  break;
586 
588  Address cfstring_data_addr(*this);
589  cfstring_data_addr.SetOffset(cfstring_data_addr.GetOffset() +
590  (2 * pointer_size));
591  if (ReadAddress(exe_scope, cfstring_data_addr, pointer_size,
592  so_addr)) {
593 #if VERBOSE_OUTPUT
594  s->PutCString("(CFString *) ");
595  cfstring_data_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
597  s->PutCString(" -> @");
598 #else
599  s->PutChar('@');
600 #endif
601  if (so_addr.Dump(s, exe_scope, DumpStyleResolvedDescription))
602  showed_info = true;
603  }
604  } break;
605 
606  case eSectionTypeData4:
607  // Read the 4 byte data and display it
608  showed_info = true;
609  s->PutCString("(uint32_t) ");
610  DumpUInt(exe_scope, *this, 4, s);
611  break;
612 
613  case eSectionTypeData8:
614  // Read the 8 byte data and display it
615  showed_info = true;
616  s->PutCString("(uint64_t) ");
617  DumpUInt(exe_scope, *this, 8, s);
618  break;
619 
620  case eSectionTypeData16:
621  // Read the 16 byte data and display it
622  showed_info = true;
623  s->PutCString("(uint128_t) ");
624  DumpUInt(exe_scope, *this, 16, s);
625  break;
626 
628  // Read the pointer data and display it
629  if (ReadAddress(exe_scope, *this, pointer_size, so_addr)) {
630  s->PutCString("(void *)");
631  so_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
633 
634  showed_info = true;
635  if (so_addr.IsSectionOffset()) {
636  SymbolContext pointer_sc;
637  if (target) {
639  so_addr, eSymbolContextEverything, pointer_sc);
640  if (pointer_sc.function != nullptr ||
641  pointer_sc.symbol != nullptr) {
642  s->PutCString(": ");
643  pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false,
644  false, true, true);
645  }
646  }
647  }
648  }
649  break;
650 
651  default:
652  break;
653  }
654  }
655 
656  if (!showed_info) {
657  if (module_sp) {
658  SymbolContext sc;
659  module_sp->ResolveSymbolContextForAddress(
660  *this, eSymbolContextEverything, sc);
661  if (sc.function || sc.symbol) {
662  bool show_stop_context = true;
663  const bool show_module = (style == DumpStyleResolvedDescription);
664  const bool show_fullpaths = false;
665  const bool show_inlined_frames = true;
666  const bool show_function_arguments =
668  const bool show_function_name = (style != DumpStyleNoFunctionName);
669  if (sc.function == nullptr && sc.symbol != nullptr) {
670  // If we have just a symbol make sure it is in the right section
671  if (sc.symbol->ValueIsAddress()) {
672  if (sc.symbol->GetAddressRef().GetSection() != GetSection()) {
673  // don't show the module if the symbol is a trampoline symbol
674  show_stop_context = false;
675  }
676  }
677  }
678  if (show_stop_context) {
679  // We have a function or a symbol from the same sections as this
680  // address.
681  sc.DumpStopContext(s, exe_scope, *this, show_fullpaths,
682  show_module, show_inlined_frames,
683  show_function_arguments, show_function_name);
684  } else {
685  // We found a symbol but it was in a different section so it
686  // isn't the symbol we should be showing, just show the section
687  // name + offset
688  Dump(s, exe_scope, DumpStyleSectionNameOffset);
689  }
690  }
691  }
692  }
693  } else {
694  if (fallback_style != DumpStyleInvalid)
695  return Dump(s, exe_scope, fallback_style, DumpStyleInvalid, addr_size);
696  return false;
697  }
698  break;
699 
701  if (IsSectionOffset()) {
702  ModuleSP module_sp(GetModule());
703  if (module_sp) {
704  SymbolContext sc;
705  module_sp->ResolveSymbolContextForAddress(
706  *this, eSymbolContextEverything | eSymbolContextVariable, sc);
707  if (sc.symbol) {
708  // If we have just a symbol make sure it is in the same section as
709  // our address. If it isn't, then we might have just found the last
710  // symbol that came before the address that we are looking up that
711  // has nothing to do with our address lookup.
712  if (sc.symbol->ValueIsAddress() &&
714  sc.symbol = nullptr;
715  }
716  sc.GetDescription(s, eDescriptionLevelBrief, target);
717 
718  if (sc.block) {
719  bool can_create = true;
720  bool get_parent_variables = true;
721  bool stop_if_block_is_inlined_function = false;
722  VariableList variable_list;
723  sc.block->AppendVariables(can_create, get_parent_variables,
724  stop_if_block_is_inlined_function,
725  [](Variable *) { return true; },
726  &variable_list);
727 
728  for (const VariableSP &var_sp : variable_list) {
729  if (var_sp && var_sp->LocationIsValidForAddress(*this)) {
730  s->Indent();
731  s->Printf(" Variable: id = {0x%8.8" PRIx64 "}, name = \"%s\"",
732  var_sp->GetID(), var_sp->GetName().GetCString());
733  Type *type = var_sp->GetType();
734  if (type)
735  s->Printf(", type = \"%s\"", type->GetName().GetCString());
736  else
737  s->PutCString(", type = <unknown>");
738  s->PutCString(", location = ");
739  var_sp->DumpLocationForAddress(s, *this);
740  s->PutCString(", decl = ");
741  var_sp->GetDeclaration().DumpStopContext(s, false);
742  s->EOL();
743  }
744  }
745  }
746  }
747  } else {
748  if (fallback_style != DumpStyleInvalid)
749  return Dump(s, exe_scope, fallback_style, DumpStyleInvalid, addr_size);
750  return false;
751  }
752  break;
753 
755  Process *process = exe_ctx.GetProcessPtr();
756  if (process) {
757  addr_t load_addr = GetLoadAddress(target);
758  if (load_addr != LLDB_INVALID_ADDRESS) {
759  Status memory_error;
760  addr_t dereferenced_load_addr =
761  process->ReadPointerFromMemory(load_addr, memory_error);
762  if (dereferenced_load_addr != LLDB_INVALID_ADDRESS) {
763  Address dereferenced_addr;
764  if (dereferenced_addr.SetLoadAddress(dereferenced_load_addr,
765  target)) {
766  StreamString strm;
767  if (dereferenced_addr.Dump(&strm, exe_scope,
769  DumpStyleInvalid, addr_size)) {
770  DumpAddress(s->AsRawOstream(), dereferenced_load_addr, addr_size,
771  " -> ", " ");
772  s->Write(strm.GetString().data(), strm.GetSize());
773  return true;
774  }
775  }
776  }
777  }
778  }
779  if (fallback_style != DumpStyleInvalid)
780  return Dump(s, exe_scope, fallback_style, DumpStyleInvalid, addr_size);
781  return false;
782  } break;
783  }
784 
785  return true;
786 }
787 
789  if (GetSection())
790  return false;
791  return SectionWasDeletedPrivate();
792 }
793 
795  lldb::SectionWP empty_section_wp;
796 
797  // If either call to "std::weak_ptr::owner_before(...) value returns true,
798  // this indicates that m_section_wp once contained (possibly still does) a
799  // reference to a valid shared pointer. This helps us know if we had a valid
800  // reference to a section which is now invalid because the module it was in
801  // was unloaded/deleted, or if the address doesn't have a valid reference to
802  // a section.
803  return empty_section_wp.owner_before(m_section_wp) ||
804  m_section_wp.owner_before(empty_section_wp);
805 }
806 
807 uint32_t
809  SymbolContextItem resolve_scope) const {
810  sc->Clear(false);
811  // Absolute addresses don't have enough information to reconstruct even their
812  // target.
813 
814  SectionSP section_sp(GetSection());
815  if (section_sp) {
816  ModuleSP module_sp(section_sp->GetModule());
817  if (module_sp) {
818  sc->module_sp = module_sp;
819  if (sc->module_sp)
820  return sc->module_sp->ResolveSymbolContextForAddress(
821  *this, resolve_scope, *sc);
822  }
823  }
824  return 0;
825 }
826 
828  SectionSP section_sp(GetSection());
829  if (section_sp)
830  return section_sp->GetModule();
831  return ModuleSP();
832 }
833 
835  SectionSP section_sp(GetSection());
836  if (section_sp) {
837  SymbolContext sc;
838  sc.module_sp = section_sp->GetModule();
839  if (sc.module_sp) {
840  sc.module_sp->ResolveSymbolContextForAddress(*this,
841  eSymbolContextCompUnit, sc);
842  return sc.comp_unit;
843  }
844  }
845  return nullptr;
846 }
847 
849  SectionSP section_sp(GetSection());
850  if (section_sp) {
851  SymbolContext sc;
852  sc.module_sp = section_sp->GetModule();
853  if (sc.module_sp) {
854  sc.module_sp->ResolveSymbolContextForAddress(*this,
855  eSymbolContextFunction, sc);
856  return sc.function;
857  }
858  }
859  return nullptr;
860 }
861 
863  SectionSP section_sp(GetSection());
864  if (section_sp) {
865  SymbolContext sc;
866  sc.module_sp = section_sp->GetModule();
867  if (sc.module_sp) {
868  sc.module_sp->ResolveSymbolContextForAddress(*this, eSymbolContextBlock,
869  sc);
870  return sc.block;
871  }
872  }
873  return nullptr;
874 }
875 
877  SectionSP section_sp(GetSection());
878  if (section_sp) {
879  SymbolContext sc;
880  sc.module_sp = section_sp->GetModule();
881  if (sc.module_sp) {
882  sc.module_sp->ResolveSymbolContextForAddress(*this, eSymbolContextSymbol,
883  sc);
884  return sc.symbol;
885  }
886  }
887  return nullptr;
888 }
889 
891  SectionSP section_sp(GetSection());
892  if (section_sp) {
893  SymbolContext sc;
894  sc.module_sp = section_sp->GetModule();
895  if (sc.module_sp) {
896  sc.module_sp->ResolveSymbolContextForAddress(*this,
897  eSymbolContextLineEntry, sc);
898  if (sc.line_entry.IsValid()) {
899  line_entry = sc.line_entry;
900  return true;
901  }
902  }
903  }
904  line_entry.Clear();
905  return false;
906 }
907 
908 int Address::CompareFileAddress(const Address &a, const Address &b) {
909  addr_t a_file_addr = a.GetFileAddress();
910  addr_t b_file_addr = b.GetFileAddress();
911  if (a_file_addr < b_file_addr)
912  return -1;
913  if (a_file_addr > b_file_addr)
914  return +1;
915  return 0;
916 }
917 
919  Target *target) {
920  assert(target != nullptr);
921  addr_t a_load_addr = a.GetLoadAddress(target);
922  addr_t b_load_addr = b.GetLoadAddress(target);
923  if (a_load_addr < b_load_addr)
924  return -1;
925  if (a_load_addr > b_load_addr)
926  return +1;
927  return 0;
928 }
929 
931  ModuleSP a_module_sp(a.GetModule());
932  ModuleSP b_module_sp(b.GetModule());
933  Module *a_module = a_module_sp.get();
934  Module *b_module = b_module_sp.get();
935  if (a_module < b_module)
936  return -1;
937  if (a_module > b_module)
938  return +1;
939  // Modules are the same, just compare the file address since they should be
940  // unique
941  addr_t a_file_addr = a.GetFileAddress();
942  addr_t b_file_addr = b.GetFileAddress();
943  if (a_file_addr < b_file_addr)
944  return -1;
945  if (a_file_addr > b_file_addr)
946  return +1;
947  return 0;
948 }
949 
950 size_t Address::MemorySize() const {
951  // Noting special for the memory size of a single Address object, it is just
952  // the size of itself.
953  return sizeof(Address);
954 }
955 
956 // NOTE: Be careful using this operator. It can correctly compare two
957 // addresses from the same Module correctly. It can't compare two addresses
958 // from different modules in any meaningful way, but it will compare the module
959 // pointers.
960 //
961 // To sum things up:
962 // - works great for addresses within the same module - it works for addresses
963 // across multiple modules, but don't expect the
964 // address results to make much sense
965 //
966 // This basically lets Address objects be used in ordered collection classes.
967 
968 bool lldb_private::operator<(const Address &lhs, const Address &rhs) {
969  ModuleSP lhs_module_sp(lhs.GetModule());
970  ModuleSP rhs_module_sp(rhs.GetModule());
971  Module *lhs_module = lhs_module_sp.get();
972  Module *rhs_module = rhs_module_sp.get();
973  if (lhs_module == rhs_module) {
974  // Addresses are in the same module, just compare the file addresses
975  return lhs.GetFileAddress() < rhs.GetFileAddress();
976  } else {
977  // The addresses are from different modules, just use the module pointer
978  // value to get consistent ordering
979  return lhs_module < rhs_module;
980  }
981 }
982 
983 bool lldb_private::operator>(const Address &lhs, const Address &rhs) {
984  ModuleSP lhs_module_sp(lhs.GetModule());
985  ModuleSP rhs_module_sp(rhs.GetModule());
986  Module *lhs_module = lhs_module_sp.get();
987  Module *rhs_module = rhs_module_sp.get();
988  if (lhs_module == rhs_module) {
989  // Addresses are in the same module, just compare the file addresses
990  return lhs.GetFileAddress() > rhs.GetFileAddress();
991  } else {
992  // The addresses are from different modules, just use the module pointer
993  // value to get consistent ordering
994  return lhs_module > rhs_module;
995  }
996 }
997 
998 // The operator == checks for exact equality only (same section, same offset)
999 bool lldb_private::operator==(const Address &a, const Address &rhs) {
1000  return a.GetOffset() == rhs.GetOffset() && a.GetSection() == rhs.GetSection();
1001 }
1002 
1003 // The operator != checks for exact inequality only (differing section, or
1004 // different offset)
1005 bool lldb_private::operator!=(const Address &a, const Address &rhs) {
1006  return a.GetOffset() != rhs.GetOffset() || a.GetSection() != rhs.GetSection();
1007 }
1008 
1010  ModuleSP module_sp(GetModule());
1011  if (module_sp) {
1012  ObjectFile *obj_file = module_sp->GetObjectFile();
1013  if (obj_file) {
1014  // Give the symbol file a chance to add to the unified section list
1015  // and to the symtab.
1016  module_sp->GetSymtab();
1017  return obj_file->GetAddressClass(GetFileAddress());
1018  }
1019  }
1020  return AddressClass::eUnknown;
1021 }
1022 
1024  bool allow_section_end) {
1025  if (target && target->GetSectionLoadList().ResolveLoadAddress(
1026  load_addr, *this, allow_section_end))
1027  return true;
1028  m_section_wp.reset();
1029  m_offset = load_addr;
1030  return false;
1031 }
lldb_private::Address::SetLoadAddress
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
Definition: Address.cpp:1023
Block.h
lldb_private::SectionList::FindSectionContainingFileAddress
lldb::SectionSP FindSectionContainingFileAddress(lldb::addr_t addr, uint32_t depth=UINT32_MAX) const
Definition: Section.cpp:613
lldb_private::Address::CalculateSymbolContextCompileUnit
CompileUnit * CalculateSymbolContextCompileUnit() const
Definition: Address.cpp:834
lldb::eSectionTypeData8
@ eSectionTypeData8
Definition: lldb-enumerations.h:655
lldb_private::SymbolContext::block
Block * block
The Block for a given query.
Definition: SymbolContext.h:321
lldb_private::Address::DumpStyleSectionNameOffset
@ DumpStyleSectionNameOffset
Display as the section name + offset.
Definition: Address.h:71
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::SymbolContext::comp_unit
CompileUnit * comp_unit
The CompileUnit for a given query.
Definition: SymbolContext.h:319
lldb_private::LineEntry::file
FileSpec file
The source file, possibly mapped by the target.source-map setting.
Definition: LineEntry.h:140
lldb_private::Address::DumpStyleSectionPointerOffset
@ DumpStyleSectionPointerOffset
Display as the section pointer + offset (debug output).
Definition: Address.h:77
lldb_private::ArchSpec::GetMachine
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:667
lldb_private::LineEntry::IsValid
bool IsValid() const
Check if a line entry object is valid.
Definition: LineEntry.cpp:46
lldb_private::Address::CalculateSymbolContextFunction
Function * CalculateSymbolContextFunction() const
Definition: Address.cpp:848
lldb_private::AddressClass
AddressClass
Definition: lldb-private-enumerations.h:48
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::Symbol::ValueIsAddress
bool ValueIsAddress() const
Definition: Symbol.cpp:117
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:208
lldb::eSectionTypeData16
@ eSectionTypeData16
Definition: lldb-enumerations.h:656
lldb::eSectionTypeDataCStringPointers
@ eSectionTypeDataCStringPointers
Pointers to C string data.
Definition: lldb-enumerations.h:652
lldb_private::SymbolContext::GetAddressRange
bool GetAddressRange(uint32_t scope, uint32_t range_idx, bool use_inline_block_range, AddressRange &range) const
Get the address range contained within a symbol context.
Definition: SymbolContext.cpp:379
lldb_private::Address::DumpStyleFileAddress
@ DumpStyleFileAddress
Display as the file address (if any).
Definition: Address.h:84
lldb::eSectionTypeDataPointers
@ eSectionTypeDataPointers
Definition: lldb-enumerations.h:657
lldb_private::Address::m_offset
lldb::addr_t m_offset
Offset into section if m_section_wp is valid...
Definition: Address.h:494
lldb_private::Process
Definition: Process.h:341
Module.h
lldb_private::ObjectFile::GetAddressClass
virtual AddressClass GetAddressClass(lldb::addr_t file_addr)
Get the address type given a file address in an object file.
Definition: ObjectFile.cpp:292
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:193
lldb_private::Address::CalculateSymbolContextModule
lldb::ModuleSP CalculateSymbolContextModule() const
Definition: Address.cpp:827
lldb_private::SectionList
Definition: Section.h:34
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::Address::operator=
const Address & operator=(const Address &rhs)
Assignment operator.
Definition: Address.cpp:239
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Type::GetName
ConstString GetName()
Definition: Type.cpp:301
GetByteOrderAndAddressSize
static bool GetByteOrderAndAddressSize(ExecutionContextScope *exe_scope, const Address &address, ByteOrder &byte_order, uint32_t &addr_size)
Definition: Address.cpp:75
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:451
lldb_private::Address::GetOpcodeLoadAddress
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
Definition: Address.cpp:367
Section.h
lldb_private::DataExtractor::GetU64
uint64_t GetU64(lldb::offset_t *offset_ptr) const
Extract a uint64_t value from *offset_ptr.
Definition: DataExtractor.cpp:476
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:925
lldb_private::AddressClass::eInvalid
@ eInvalid
lldb_private::VariableList
Definition: VariableList.h:18
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::AddressClass::eUnknown
@ eUnknown
Process.h
lldb_private::CompileUnit
Definition: CompileUnit.h:38
Target.h
lldb_private::Address::CalculateSymbolContextLineEntry
bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const
Definition: Address.cpp:890
DumpUInt
static bool DumpUInt(ExecutionContextScope *exe_scope, const Address &address, uint32_t byte_size, Stream *strm)
Definition: Address.cpp:161
lldb_private::ObjectFile::GetSymtab
Symtab * GetSymtab()
Gets the symbol table for the currently selected architecture (and object for archives).
Definition: ObjectFile.cpp:722
lldb_private::operator==
bool operator==(const Address &lhs, const Address &rhs)
Definition: Address.cpp:999
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::Address::SectionWasDeleted
bool SectionWasDeleted() const
Definition: Address.cpp:788
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
lldb::eSectionTypeDataObjCMessageRefs
@ eSectionTypeDataObjCMessageRefs
Pointer to function pointer + selector.
Definition: lldb-enumerations.h:660
lldb_private::StreamString::GetSize
size_t GetSize() const
Definition: StreamString.cpp:38
lldb_private::Function
Definition: Function.h:413
lldb_private::SymbolContext::DumpStopContext
bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr, bool show_fullpaths, bool show_module, bool show_inlined_frames, bool show_function_arguments, bool show_function_name) const
Dump the stop context in this object to a Stream.
Definition: SymbolContext.cpp:67
ModuleList.h
lldb_private::Stream::Indent
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:130
lldb_private::Address::DumpStyleLoadAddress
@ DumpStyleLoadAddress
Display as the load address (if resolved).
Definition: Address.h:96
lldb_private::Address::GetAddressClass
AddressClass GetAddressClass() const
Definition: Address.cpp:1009
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb::eSectionTypeDataObjCCFStrings
@ eSectionTypeDataObjCCFStrings
Objective-C const CFString/NSString objects.
Definition: lldb-enumerations.h:661
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::DumpAddress
void DumpAddress(llvm::raw_ostream &s, uint64_t addr, uint32_t addr_size, const char *prefix=nullptr, const char *suffix=nullptr)
Output an address value to this stream.
Definition: Stream.cpp:81
lldb_private::Address::GetCallableLoadAddress
lldb::addr_t GetCallableLoadAddress(Target *target, bool is_indirect=false) const
Get the load address as a callable code load address.
Definition: Address.cpp:335
LineEntry.h
Declaration.h
lldb_private::SymbolContext::function
Function * function
The Function for a given query.
Definition: SymbolContext.h:320
StreamString.h
lldb_private::Address::GetFileAddress
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:290
Type.h
lldb_private::Symbol::GetAddressRef
Address & GetAddressRef()
Definition: Symbol.h:57
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::Target::GetCallableLoadAddress
lldb::addr_t GetCallableLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as a callable code load address for this target.
Definition: Target.cpp:2575
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::Address::CalculateSymbolContextBlock
Block * CalculateSymbolContextBlock() const
Definition: Address.cpp:862
lldb_private::operator>
bool operator>(const Address &lhs, const Address &rhs)
Definition: Address.cpp:983
lldb_private::Address::SetOpcodeLoadAddress
bool SetOpcodeLoadAddress(lldb::addr_t load_addr, Target *target, AddressClass addr_class=AddressClass::eInvalid, bool allow_section_end=false)
Definition: Address.cpp:378
lldb_private::Address::GetSection
lldb::SectionSP GetSection() const
Get const accessor for the section.
Definition: Address.h:420
lldb_private::LineEntry::column
uint16_t column
The column number of the source line, or zero if there is no column information.
Definition: LineEntry.h:146
lldb_private::Stream::PutChar
size_t PutChar(char ch)
Definition: Stream.cpp:104
lldb_private::Address::CalculateSymbolContextSymbol
Symbol * CalculateSymbolContextSymbol() const
Definition: Address.cpp:876
lldb_private::ModuleList::ResolveSymbolContextForAddress
uint32_t ResolveSymbolContextForAddress(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) const
Resolve the symbol context for the given address. (const Address
Definition: ModuleList.cpp:620
lldb_private::Target::GetOpcodeLoadAddress
lldb::addr_t GetOpcodeLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as an opcode for this target.
Definition: Target.cpp:2583
lldb_private::SectionLoadList::ResolveLoadAddress
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
Definition: SectionLoadList.cpp:208
Address.h
lldb_private::Address::CompareLoadAddress
static int CompareLoadAddress(const Address &lhs, const Address &rhs, Target *target)
Definition: Address.cpp:918
DumpDataExtractor.h
VariableList.h
lldb_private::Address::DumpStyleModuleWithFileAddress
@ DumpStyleModuleWithFileAddress
Display as the file address with the module name prepended (if any).
Definition: Address.h:90
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:683
lldb_private::operator!=
bool operator!=(const Address &lhs, const Address &rhs)
Definition: Address.cpp:1005
lldb::eSectionTypeData
@ eSectionTypeData
Definition: lldb-enumerations.h:650
ObjectFile.h
lldb_private::LineEntry::line
uint32_t line
The source line number, or zero if there is no line number information.
Definition: LineEntry.h:143
lldb_private::Address::CompareModulePointerAndOffset
static int CompareModulePointerAndOffset(const Address &lhs, const Address &rhs)
Definition: Address.cpp:930
lldb::eFormatChar
@ eFormatChar
Definition: lldb-enumerations.h:162
lldb_private::Address::SetRawAddress
void SetRawAddress(lldb::addr_t addr)
Definition: Address.h:435
lldb::eSectionTypeData4
@ eSectionTypeData4
Definition: lldb-enumerations.h:654
lldb_private::Address::DumpStyleResolvedDescriptionNoFunctionArguments
@ DumpStyleResolvedDescriptionNoFunctionArguments
Definition: Address.h:103
lldb_private::Block::AppendVariables
uint32_t AppendVariables(bool can_create, bool get_parent_variables, bool stop_if_block_is_inlined_function, const std::function< bool(Variable *)> &filter, VariableList *variable_list)
Appends the variables from this block, and optionally from all parent blocks, to variable_list.
Definition: Block.cpp:442
Symbol.h
ReadUIntMax64
static uint64_t ReadUIntMax64(ExecutionContextScope *exe_scope, const Address &address, uint32_t byte_size, bool &success)
Definition: Address.cpp:100
lldb_private::Symbol::GetName
ConstString GetName() const
Definition: Symbol.cpp:501
lldb_private::Target::GetProcessSP
const lldb::ProcessSP & GetProcessSP() const
Definition: Target.cpp:211
lldb_private::SectionLoadList::IsEmpty
bool IsEmpty() const
Definition: SectionLoadList.cpp:37
ReadCStringFromMemory
static size_t ReadCStringFromMemory(ExecutionContextScope *exe_scope, const Address &address, Stream *strm)
Definition: Address.cpp:189
lldb_private::Address::ResolveFunctionScope
bool ResolveFunctionScope(lldb_private::SymbolContext &sym_ctx, lldb_private::AddressRange *addr_range_ptr=nullptr)
Resolve this address to its containing function and optionally get that function's address range.
Definition: Address.cpp:265
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:967
lldb_private::Status
Definition: Status.h:44
lldb_private::Address::CompareFileAddress
static int CompareFileAddress(const Address &lhs, const Address &rhs)
Compare two Address objects.
Definition: Address.cpp:908
lldb_private::Address::DumpStyleResolvedDescription
@ DumpStyleResolvedDescription
Display the details about what an address resolves to.
Definition: Address.h:101
lldb_private::Address::DumpStyleResolvedDescriptionNoModule
@ DumpStyleResolvedDescriptionNoModule
Definition: Address.h:102
lldb_private::Address::DumpStyleInvalid
@ DumpStyleInvalid
Invalid dump style.
Definition: Address.h:65
lldb::eByteOrderInvalid
@ eByteOrderInvalid
Definition: lldb-enumerations.h:139
lldb_private::Block
Definition: Block.h:41
lldb_private::AddressRange::Clear
void Clear()
Clear the object's state.
Definition: AddressRange.cpp:143
lldb_private::SymbolContext::GetDescription
void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target) const
Definition: SymbolContext.cpp:185
lldb_private::Symtab
Definition: Symtab.h:22
uint32_t
lldb::SectionType
SectionType
Definition: lldb-enumerations.h:646
lldb_private::Address::SetCallableLoadAddress
bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target)
Definition: Address.cpp:358
lldb_private::Address
Definition: Address.h:59
lldb_private::Stream::EOL
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:128
lldb_private::endian::InlHostByteOrder
lldb::ByteOrder InlHostByteOrder()
Definition: Endian.h:25
lldb_private::Address::GetDescription
bool GetDescription(Stream &s, Target &target, lldb::DescriptionLevel level) const
Write a description of this object to a Stream.
Definition: Address.cpp:392
lldb_private::Type
Definition: Type.h:66
ExecutionContextScope.h
Symtab.h
lldb_private::Address::GetLoadAddress
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:310
lldb_private::Address::ResolveAddressUsingFileSections
bool ResolveAddressUsingFileSections(lldb::addr_t addr, const SectionList *sections)
Resolve a file virtual address using a section list.
Definition: Address.cpp:247
ReadAddress
static bool ReadAddress(ExecutionContextScope *exe_scope, const Address &address, uint32_t pointer_size, Address &deref_so_addr)
Definition: Address.cpp:124
lldb::eSectionTypeDataCString
@ eSectionTypeDataCString
Inlined C string data.
Definition: lldb-enumerations.h:651
lldb_private::Stream::AsRawOstream
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition: Stream.h:357
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::Address::MemorySize
size_t MemorySize() const
Get the memory cost of this object.
Definition: Address.cpp:950
lldb_private::operator<
bool operator<(const Address &lhs, const Address &rhs)
Definition: Address.cpp:968
lldb_private::Address::Dump
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX) const
Dump a description of this object to a Stream.
Definition: Address.cpp:405
lldb_private::SymbolContext::module_sp
lldb::ModuleSP module_sp
The Module for a given query.
Definition: SymbolContext.h:318
lldb_private::Address::SectionWasDeletedPrivate
bool SectionWasDeletedPrivate() const
Definition: Address.cpp:794
lldb_private::Address::SetOffset
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
Definition: Address.h:429
lldb_private::Target::GetSectionLoadList
SectionLoadList & GetSectionLoadList()
Definition: Target.h:1071
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
DataExtractor.h
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_private::DumpDataExtractor
lldb::offset_t DumpDataExtractor(const DataExtractor &DE, Stream *s, lldb::offset_t offset, lldb::Format item_format, size_t item_byte_size, size_t item_count, size_t num_per_line, uint64_t base_addr, uint32_t item_bit_size, uint32_t item_bit_offset, ExecutionContextScope *exe_scope=nullptr)
Dumps item_count objects into the stream s.
Definition: DumpDataExtractor.cpp:256
lldb_private::Address::m_section_wp
lldb::SectionWP m_section_wp
The section for the address, can be NULL.
Definition: Address.h:493
Status.h
SymbolContext.h
lldb_private::LineEntry::Clear
void Clear()
Clear the object's state.
Definition: LineEntry.cpp:33
lldb_private::SymbolContext::Clear
void Clear(bool clear_target)
Clear the object's state.
Definition: SymbolContext.cpp:55
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::ExecutionContextScope::CalculateTarget
virtual lldb::TargetSP CalculateTarget()=0
ReadBytes
static size_t ReadBytes(ExecutionContextScope *exe_scope, const Address &address, void *dst, size_t dst_len)
Definition: Address.cpp:60
FileSpec.h
lldb_private::Address::DumpStyle
DumpStyle
Dump styles allow the Address::Dump(Stream *,DumpStyle) const function to display Address contents in...
Definition: Address.h:63
lldb_private::Address::IsSectionOffset
bool IsSectionOffset() const
Check if an address is section offset.
Definition: Address.h:323
lldb_private::Stream::Write
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
Definition: Stream.h:101
ConstString.h
lldb_private::Address::GetOffset
lldb::addr_t GetOffset() const
Get the section relative offset value.
Definition: Address.h:310
lldb_private::Address::GetModule
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
Definition: Address.cpp:282
Stream.h
lldb_private::Variable
Definition: Variable.h:25
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::Address::DumpStyleResolvedPointerDescription
@ DumpStyleResolvedPointerDescription
Dereference a pointer at the current address and then lookup the dereferenced address using DumpStyle...
Definition: Address.h:112
lldb_private::Process::ReadPointerFromMemory
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition: Process.cpp:2082
lldb_private::ExecutionContextScope::CalculateExecutionContext
virtual void CalculateExecutionContext(ExecutionContext &exe_ctx)=0
Reconstruct the object's execution context into sc.
lldb_private::SymbolContext::line_entry
LineEntry line_entry
The LineEntry for a given query.
Definition: SymbolContext.h:322
SymbolVendor.h
Variable.h
lldb
Definition: SBAddress.h:15
Endian.h
lldb_private::FileSpec::GetFilename
ConstString & GetFilename()
Filename string get accessor.
Definition: FileSpec.cpp:339
lldb_private::LineEntry
Definition: LineEntry.h:20
lldb_private::Address::CalculateSymbolContext
uint32_t CalculateSymbolContext(SymbolContext *sc, lldb::SymbolContextItem resolve_scope=lldb::eSymbolContextEverything) const
Reconstruct a symbol context from an address.
Definition: Address.cpp:808
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:200
lldb_private::ObjectFile
Definition: ObjectFile.h:59
lldb_private::Address::Address
Address()
Default constructor.
Definition: Address.h:119
ExecutionContext.h
lldb::eDescriptionLevelBrief
@ eDescriptionLevelBrief
Definition: lldb-enumerations.h:208
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb_private::Address::DumpStyleNoFunctionName
@ DumpStyleNoFunctionName
Elide the function name; display an offset into the current function.
Definition: Address.h:106
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
lldb_private::Address::DumpStyleDetailedSymbolContext
@ DumpStyleDetailedSymbolContext
Detailed symbol context information for an address for all symbol context members.
Definition: Address.h:109