LLDB  mainline
SymbolFileBreakpad.cpp
Go to the documentation of this file.
1 //===-- SymbolFileBreakpad.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 
12 #include "lldb/Core/Module.h"
14 #include "lldb/Core/Section.h"
15 #include "lldb/Host/FileSystem.h"
17 #include "lldb/Symbol/ObjectFile.h"
19 #include "lldb/Symbol/TypeMap.h"
20 #include "lldb/Utility/LLDBLog.h"
21 #include "lldb/Utility/Log.h"
23 #include "llvm/ADT/StringExtras.h"
24 
25 using namespace lldb;
26 using namespace lldb_private;
27 using namespace lldb_private::breakpad;
28 
30 
32 
34 public:
35  // begin iterator for sections of given type
36  LineIterator(ObjectFile &obj, Record::Kind section_type)
37  : m_obj(&obj), m_section_type(toString(section_type)),
38  m_next_section_idx(0), m_next_line(llvm::StringRef::npos) {
39  ++*this;
40  }
41 
42  // An iterator starting at the position given by the bookmark.
43  LineIterator(ObjectFile &obj, Record::Kind section_type, Bookmark bookmark);
44 
45  // end iterator
46  explicit LineIterator(ObjectFile &obj)
47  : m_obj(&obj),
48  m_next_section_idx(m_obj->GetSectionList()->GetNumSections(0)),
49  m_current_line(llvm::StringRef::npos),
50  m_next_line(llvm::StringRef::npos) {}
51 
52  friend bool operator!=(const LineIterator &lhs, const LineIterator &rhs) {
53  assert(lhs.m_obj == rhs.m_obj);
55  return true;
56  if (lhs.m_current_line != rhs.m_current_line)
57  return true;
58  assert(lhs.m_next_line == rhs.m_next_line);
59  return false;
60  }
61 
62  const LineIterator &operator++();
63  llvm::StringRef operator*() const {
64  return m_section_text.slice(m_current_line, m_next_line);
65  }
66 
68  return Bookmark{m_next_section_idx, m_current_line};
69  }
70 
71 private:
75  llvm::StringRef m_section_text;
77  size_t m_next_line;
78 
79  void FindNextLine() {
80  m_next_line = m_section_text.find('\n', m_current_line);
81  if (m_next_line != llvm::StringRef::npos) {
82  ++m_next_line;
83  if (m_next_line >= m_section_text.size())
84  m_next_line = llvm::StringRef::npos;
85  }
86  }
87 };
88 
90  Record::Kind section_type,
91  Bookmark bookmark)
92  : m_obj(&obj), m_section_type(toString(section_type)),
93  m_next_section_idx(bookmark.section), m_current_line(bookmark.offset) {
94  Section &sect =
96  assert(sect.GetName() == m_section_type);
97 
98  DataExtractor data;
99  obj.ReadSectionData(&sect, data);
100  m_section_text = toStringRef(data.GetData());
101 
102  assert(m_current_line < m_section_text.size());
103  FindNextLine();
104 }
105 
108  const SectionList &list = *m_obj->GetSectionList();
109  size_t num_sections = list.GetNumSections(0);
110  while (m_next_line != llvm::StringRef::npos ||
111  m_next_section_idx < num_sections) {
112  if (m_next_line != llvm::StringRef::npos) {
113  m_current_line = m_next_line;
114  FindNextLine();
115  return *this;
116  }
117 
118  Section &sect = *list.GetSectionAtIndex(m_next_section_idx++);
119  if (sect.GetName() != m_section_type)
120  continue;
121  DataExtractor data;
122  m_obj->ReadSectionData(&sect, data);
123  m_section_text = toStringRef(data.GetData());
124  m_next_line = 0;
125  }
126  // We've reached the end.
127  m_current_line = m_next_line;
128  return *this;
129 }
130 
131 llvm::iterator_range<SymbolFileBreakpad::LineIterator>
132 SymbolFileBreakpad::lines(Record::Kind section_type) {
133  return llvm::make_range(LineIterator(*m_objfile_sp, section_type),
134  LineIterator(*m_objfile_sp));
135 }
136 
137 namespace {
138 // A helper class for constructing the list of support files for a given compile
139 // unit.
140 class SupportFileMap {
141 public:
142  // Given a breakpad file ID, return a file ID to be used in the support files
143  // for this compile unit.
144  size_t operator[](size_t file) {
145  return m_map.try_emplace(file, m_map.size() + 1).first->second;
146  }
147 
148  // Construct a FileSpecList containing only the support files relevant for
149  // this compile unit (in the correct order).
150  FileSpecList translate(const FileSpec &cu_spec,
151  llvm::ArrayRef<FileSpec> all_files);
152 
153 private:
154  llvm::DenseMap<size_t, size_t> m_map;
155 };
156 } // namespace
157 
158 FileSpecList SupportFileMap::translate(const FileSpec &cu_spec,
159  llvm::ArrayRef<FileSpec> all_files) {
160  std::vector<FileSpec> result;
161  result.resize(m_map.size() + 1);
162  result[0] = cu_spec;
163  for (const auto &KV : m_map) {
164  if (KV.first < all_files.size())
165  result[KV.second] = all_files[KV.first];
166  }
167  return FileSpecList(std::move(result));
168 }
169 
170 void SymbolFileBreakpad::Initialize() {
171  PluginManager::RegisterPlugin(GetPluginNameStatic(),
172  GetPluginDescriptionStatic(), CreateInstance,
173  DebuggerInitialize);
174 }
175 
176 void SymbolFileBreakpad::Terminate() {
177  PluginManager::UnregisterPlugin(CreateInstance);
178 }
179 
180 uint32_t SymbolFileBreakpad::CalculateAbilities() {
181  if (!m_objfile_sp || !llvm::isa<ObjectFileBreakpad>(*m_objfile_sp))
182  return 0;
183 
184  return CompileUnits | Functions | LineTables;
185 }
186 
187 uint32_t SymbolFileBreakpad::CalculateNumCompileUnits() {
188  ParseCUData();
189  return m_cu_data->GetSize();
190 }
191 
192 CompUnitSP SymbolFileBreakpad::ParseCompileUnitAtIndex(uint32_t index) {
193  if (index >= m_cu_data->GetSize())
194  return nullptr;
195 
196  CompUnitData &data = m_cu_data->GetEntryRef(index).data;
197 
198  ParseFileRecords();
199 
200  FileSpec spec;
201 
202  // The FileSpec of the compile unit will be the file corresponding to the
203  // first LINE record.
204  LineIterator It(*m_objfile_sp, Record::Func, data.bookmark),
205  End(*m_objfile_sp);
206  assert(Record::classify(*It) == Record::Func);
207  ++It; // Skip FUNC record.
208  // Skip INLINE records.
209  while (It != End && Record::classify(*It) == Record::Inline)
210  ++It;
211 
212  if (It != End) {
213  auto record = LineRecord::parse(*It);
214  if (record && record->FileNum < m_files->size())
215  spec = (*m_files)[record->FileNum];
216  }
217 
218  auto cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(),
219  /*user_data*/ nullptr, spec, index,
221  /*is_optimized*/ eLazyBoolNo);
222 
223  SetCompileUnitAtIndex(index, cu_sp);
224  return cu_sp;
225 }
226 
227 FunctionSP SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) {
228  user_id_t id = comp_unit.GetID();
229  if (FunctionSP func_sp = comp_unit.FindFunctionByUID(id))
230  return func_sp;
231 
232  Log *log = GetLog(LLDBLog::Symbols);
233  FunctionSP func_sp;
234  addr_t base = GetBaseFileAddress();
235  if (base == LLDB_INVALID_ADDRESS) {
236  LLDB_LOG(log, "Unable to fetch the base address of object file. Skipping "
237  "symtab population.");
238  return func_sp;
239  }
240 
241  const SectionList *list = comp_unit.GetModule()->GetSectionList();
242  CompUnitData &data = m_cu_data->GetEntryRef(id).data;
243  LineIterator It(*m_objfile_sp, Record::Func, data.bookmark);
244  assert(Record::classify(*It) == Record::Func);
245 
246  if (auto record = FuncRecord::parse(*It)) {
247  Mangled func_name;
248  func_name.SetValue(ConstString(record->Name), false);
249  addr_t address = record->Address + base;
250  SectionSP section_sp = list->FindSectionContainingFileAddress(address);
251  if (section_sp) {
252  AddressRange func_range(
253  section_sp, address - section_sp->GetFileAddress(), record->Size);
254  // Use the CU's id because every CU has only one function inside.
255  func_sp = std::make_shared<Function>(&comp_unit, id, 0, func_name,
256  nullptr, func_range);
257  comp_unit.AddFunction(func_sp);
258  }
259  }
260  return func_sp;
261 }
262 
263 size_t SymbolFileBreakpad::ParseFunctions(CompileUnit &comp_unit) {
264  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
265  return GetOrCreateFunction(comp_unit) ? 1 : 0;
266 }
267 
268 bool SymbolFileBreakpad::ParseLineTable(CompileUnit &comp_unit) {
269  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
270  CompUnitData &data = m_cu_data->GetEntryRef(comp_unit.GetID()).data;
271 
272  if (!data.line_table_up)
273  ParseLineTableAndSupportFiles(comp_unit, data);
274 
275  comp_unit.SetLineTable(data.line_table_up.release());
276  return true;
277 }
278 
279 bool SymbolFileBreakpad::ParseSupportFiles(CompileUnit &comp_unit,
280  FileSpecList &support_files) {
281  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
282  CompUnitData &data = m_cu_data->GetEntryRef(comp_unit.GetID()).data;
283  if (!data.support_files)
284  ParseLineTableAndSupportFiles(comp_unit, data);
285 
286  support_files = std::move(*data.support_files);
287  return true;
288 }
289 
290 size_t SymbolFileBreakpad::ParseBlocksRecursive(Function &func) {
291  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
292  CompileUnit *comp_unit = func.GetCompileUnit();
293  lldbassert(comp_unit);
294  ParseInlineOriginRecords();
295  // A vector of current each level's parent block. For example, when parsing
296  // "INLINE 0 ...", the current level is 0 and its parent block is the
297  // funciton block at index 0.
298  std::vector<Block *> blocks;
299  Block &block = func.GetBlock(false);
300  block.AddRange(Block::Range(0, func.GetAddressRange().GetByteSize()));
301  blocks.push_back(&block);
302 
303  size_t blocks_added = 0;
304  addr_t func_base = func.GetAddressRange().GetBaseAddress().GetOffset();
305  CompUnitData &data = m_cu_data->GetEntryRef(comp_unit->GetID()).data;
306  LineIterator It(*m_objfile_sp, Record::Func, data.bookmark),
307  End(*m_objfile_sp);
308  ++It; // Skip the FUNC record.
309  size_t last_added_nest_level = 0;
310  while (It != End && Record::classify(*It) == Record::Inline) {
311  if (auto record = InlineRecord::parse(*It)) {
312  if (record->InlineNestLevel == 0 ||
313  record->InlineNestLevel <= last_added_nest_level + 1) {
314  last_added_nest_level = record->InlineNestLevel;
315  BlockSP block_sp = std::make_shared<Block>(It.GetBookmark().offset);
316  FileSpec callsite_file;
317  if (record->CallSiteFileNum < m_files->size())
318  callsite_file = (*m_files)[record->CallSiteFileNum];
319  llvm::StringRef name;
320  if (record->OriginNum < m_inline_origins->size())
321  name = (*m_inline_origins)[record->OriginNum];
322 
323  Declaration callsite(callsite_file, record->CallSiteLineNum);
324  block_sp->SetInlinedFunctionInfo(name.str().c_str(),
325  /*mangled=*/nullptr,
326  /*decl_ptr=*/nullptr, &callsite);
327  for (const auto &range : record->Ranges) {
328  block_sp->AddRange(
329  Block::Range(range.first - func_base, range.second));
330  }
331  block_sp->FinalizeRanges();
332 
333  blocks[record->InlineNestLevel]->AddChild(block_sp);
334  if (record->InlineNestLevel + 1 >= blocks.size()) {
335  blocks.resize(blocks.size() + 1);
336  }
337  blocks[record->InlineNestLevel + 1] = block_sp.get();
338  ++blocks_added;
339  }
340  }
341  ++It;
342  }
343  return blocks_added;
344 }
345 
346 void SymbolFileBreakpad::ParseInlineOriginRecords() {
347  if (m_inline_origins)
348  return;
349  m_inline_origins.emplace();
350 
351  Log *log = GetLog(LLDBLog::Symbols);
352  for (llvm::StringRef line : lines(Record::InlineOrigin)) {
353  auto record = InlineOriginRecord::parse(line);
354  if (!record) {
355  LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", line);
356  continue;
357  }
358 
359  if (record->Number >= m_inline_origins->size())
360  m_inline_origins->resize(record->Number + 1);
361  (*m_inline_origins)[record->Number] = record->Name;
362  }
363 }
364 
365 uint32_t
366 SymbolFileBreakpad::ResolveSymbolContext(const Address &so_addr,
367  SymbolContextItem resolve_scope,
368  SymbolContext &sc) {
369  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
370  if (!(resolve_scope & (eSymbolContextCompUnit | eSymbolContextLineEntry |
371  eSymbolContextFunction | eSymbolContextBlock)))
372  return 0;
373 
374  ParseCUData();
375  uint32_t idx =
376  m_cu_data->FindEntryIndexThatContains(so_addr.GetFileAddress());
377  if (idx == UINT32_MAX)
378  return 0;
379 
380  sc.comp_unit = GetCompileUnitAtIndex(idx).get();
381  SymbolContextItem result = eSymbolContextCompUnit;
382  if (resolve_scope & eSymbolContextLineEntry) {
383  if (sc.comp_unit->GetLineTable()->FindLineEntryByAddress(so_addr,
384  sc.line_entry)) {
385  result |= eSymbolContextLineEntry;
386  }
387  }
388 
389  if (resolve_scope & (eSymbolContextFunction | eSymbolContextBlock)) {
390  FunctionSP func_sp = GetOrCreateFunction(*sc.comp_unit);
391  if (func_sp) {
392  sc.function = func_sp.get();
393  result |= eSymbolContextFunction;
394  if (resolve_scope & eSymbolContextBlock) {
395  Block &block = func_sp->GetBlock(true);
397  so_addr.GetFileAddress() -
399  if (sc.block)
400  result |= eSymbolContextBlock;
401  }
402  }
403  }
404 
405  return result;
406 }
407 
408 uint32_t SymbolFileBreakpad::ResolveSymbolContext(
409  const SourceLocationSpec &src_location_spec,
410  lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
411  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
412  if (!(resolve_scope & eSymbolContextCompUnit))
413  return 0;
414 
415  uint32_t old_size = sc_list.GetSize();
416  for (size_t i = 0, size = GetNumCompileUnits(); i < size; ++i) {
417  CompileUnit &cu = *GetCompileUnitAtIndex(i);
418  cu.ResolveSymbolContext(src_location_spec, resolve_scope, sc_list);
419  }
420  return sc_list.GetSize() - old_size;
421 }
422 
423 void SymbolFileBreakpad::FindFunctions(
424  const Module::LookupInfo &lookup_info,
425  const CompilerDeclContext &parent_decl_ctx, bool include_inlines,
426  SymbolContextList &sc_list) {
427  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
428  // TODO: Implement this with supported FunctionNameType.
429 
430  ConstString name = lookup_info.GetLookupName();
431  for (uint32_t i = 0; i < GetNumCompileUnits(); ++i) {
432  CompUnitSP cu_sp = GetCompileUnitAtIndex(i);
433  FunctionSP func_sp = GetOrCreateFunction(*cu_sp);
434  if (func_sp && name == func_sp->GetNameNoArguments()) {
435  SymbolContext sc;
436  sc.comp_unit = cu_sp.get();
437  sc.function = func_sp.get();
438  sc.module_sp = func_sp->CalculateSymbolContextModule();
439  sc_list.Append(sc);
440  }
441  }
442 }
443 
444 void SymbolFileBreakpad::FindFunctions(const RegularExpression &regex,
445  bool include_inlines,
446  SymbolContextList &sc_list) {
447  // TODO
448 }
449 
450 void SymbolFileBreakpad::FindTypes(
451  ConstString name, const CompilerDeclContext &parent_decl_ctx,
452  uint32_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files,
453  TypeMap &types) {}
454 
455 void SymbolFileBreakpad::FindTypes(
456  llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
457  llvm::DenseSet<SymbolFile *> &searched_symbol_files, TypeMap &types) {}
458 
459 void SymbolFileBreakpad::AddSymbols(Symtab &symtab) {
460  Log *log = GetLog(LLDBLog::Symbols);
461  Module &module = *m_objfile_sp->GetModule();
462  addr_t base = GetBaseFileAddress();
463  if (base == LLDB_INVALID_ADDRESS) {
464  LLDB_LOG(log, "Unable to fetch the base address of object file. Skipping "
465  "symtab population.");
466  return;
467  }
468 
469  const SectionList &list = *module.GetSectionList();
470  llvm::DenseSet<addr_t> found_symbol_addresses;
471  std::vector<Symbol> symbols;
472  auto add_symbol = [&](addr_t address, llvm::Optional<addr_t> size,
473  llvm::StringRef name) {
474  address += base;
475  SectionSP section_sp = list.FindSectionContainingFileAddress(address);
476  if (!section_sp) {
477  LLDB_LOG(log,
478  "Ignoring symbol {0}, whose address ({1}) is outside of the "
479  "object file. Mismatched symbol file?",
480  name, address);
481  return;
482  }
483  // Keep track of what addresses were already added so far and only add
484  // the symbol with the first address.
485  if (!found_symbol_addresses.insert(address).second)
486  return;
487  symbols.emplace_back(
488  /*symID*/ 0, Mangled(name), eSymbolTypeCode,
489  /*is_global*/ true, /*is_debug*/ false,
490  /*is_trampoline*/ false, /*is_artificial*/ false,
491  AddressRange(section_sp, address - section_sp->GetFileAddress(),
492  size.value_or(0)),
493  size.has_value(), /*contains_linker_annotations*/ false, /*flags*/ 0);
494  };
495 
496  for (llvm::StringRef line : lines(Record::Public)) {
497  if (auto record = PublicRecord::parse(line))
498  add_symbol(record->Address, llvm::None, record->Name);
499  else
500  LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", line);
501  }
502 
503  for (Symbol &symbol : symbols)
504  symtab.AddSymbol(std::move(symbol));
505  symtab.Finalize();
506 }
507 
508 llvm::Expected<lldb::addr_t>
509 SymbolFileBreakpad::GetParameterStackSize(Symbol &symbol) {
510  ParseUnwindData();
511  if (auto *entry = m_unwind_data->win.FindEntryThatContains(
512  symbol.GetAddress().GetFileAddress())) {
513  auto record = StackWinRecord::parse(
514  *LineIterator(*m_objfile_sp, Record::StackWin, entry->data));
515  assert(record);
516  return record->ParameterSize;
517  }
518  return llvm::createStringError(llvm::inconvertibleErrorCode(),
519  "Parameter size unknown.");
520 }
521 
522 static llvm::Optional<std::pair<llvm::StringRef, llvm::StringRef>>
523 GetRule(llvm::StringRef &unwind_rules) {
524  // Unwind rules are of the form
525  // register1: expression1 register2: expression2 ...
526  // We assume none of the tokens in expression<n> end with a colon.
527 
528  llvm::StringRef lhs, rest;
529  std::tie(lhs, rest) = getToken(unwind_rules);
530  if (!lhs.consume_back(":"))
531  return llvm::None;
532 
533  // Seek forward to the next register: expression pair
534  llvm::StringRef::size_type pos = rest.find(": ");
535  if (pos == llvm::StringRef::npos) {
536  // No pair found, this means the rest of the string is a single expression.
537  unwind_rules = llvm::StringRef();
538  return std::make_pair(lhs, rest);
539  }
540 
541  // Go back one token to find the end of the current rule.
542  pos = rest.rfind(' ', pos);
543  if (pos == llvm::StringRef::npos)
544  return llvm::None;
545 
546  llvm::StringRef rhs = rest.take_front(pos);
547  unwind_rules = rest.drop_front(pos);
548  return std::make_pair(lhs, rhs);
549 }
550 
551 static const RegisterInfo *
552 ResolveRegister(const llvm::Triple &triple,
553  const SymbolFile::RegisterInfoResolver &resolver,
554  llvm::StringRef name) {
555  if (triple.isX86() || triple.isMIPS()) {
556  // X86 and MIPS registers have '$' in front of their register names. Arm and
557  // AArch64 don't.
558  if (!name.consume_front("$"))
559  return nullptr;
560  }
561  return resolver.ResolveName(name);
562 }
563 
564 static const RegisterInfo *
565 ResolveRegisterOrRA(const llvm::Triple &triple,
566  const SymbolFile::RegisterInfoResolver &resolver,
567  llvm::StringRef name) {
568  if (name == ".ra")
570  return ResolveRegister(triple, resolver, name);
571 }
572 
573 llvm::ArrayRef<uint8_t> SymbolFileBreakpad::SaveAsDWARF(postfix::Node &node) {
574  ArchSpec arch = m_objfile_sp->GetArchitecture();
575  StreamString dwarf(Stream::eBinary, arch.GetAddressByteSize(),
576  arch.GetByteOrder());
577  ToDWARF(node, dwarf);
578  uint8_t *saved = m_allocator.Allocate<uint8_t>(dwarf.GetSize());
579  std::memcpy(saved, dwarf.GetData(), dwarf.GetSize());
580  return {saved, dwarf.GetSize()};
581 }
582 
583 bool SymbolFileBreakpad::ParseCFIUnwindRow(llvm::StringRef unwind_rules,
584  const RegisterInfoResolver &resolver,
585  UnwindPlan::Row &row) {
586  Log *log = GetLog(LLDBLog::Symbols);
587 
588  llvm::BumpPtrAllocator node_alloc;
589  llvm::Triple triple = m_objfile_sp->GetArchitecture().GetTriple();
590  while (auto rule = GetRule(unwind_rules)) {
591  node_alloc.Reset();
592  llvm::StringRef lhs = rule->first;
593  postfix::Node *rhs = postfix::ParseOneExpression(rule->second, node_alloc);
594  if (!rhs) {
595  LLDB_LOG(log, "Could not parse `{0}` as unwind rhs.", rule->second);
596  return false;
597  }
598 
599  bool success = postfix::ResolveSymbols(
600  rhs, [&](postfix::SymbolNode &symbol) -> postfix::Node * {
601  llvm::StringRef name = symbol.GetName();
602  if (name == ".cfa" && lhs != ".cfa")
603  return postfix::MakeNode<postfix::InitialValueNode>(node_alloc);
604 
605  if (const RegisterInfo *info =
606  ResolveRegister(triple, resolver, name)) {
607  return postfix::MakeNode<postfix::RegisterNode>(
608  node_alloc, info->kinds[eRegisterKindLLDB]);
609  }
610  return nullptr;
611  });
612 
613  if (!success) {
614  LLDB_LOG(log, "Resolving symbols in `{0}` failed.", rule->second);
615  return false;
616  }
617 
618  llvm::ArrayRef<uint8_t> saved = SaveAsDWARF(*rhs);
619  if (lhs == ".cfa") {
620  row.GetCFAValue().SetIsDWARFExpression(saved.data(), saved.size());
621  } else if (const RegisterInfo *info =
622  ResolveRegisterOrRA(triple, resolver, lhs)) {
624  loc.SetIsDWARFExpression(saved.data(), saved.size());
625  row.SetRegisterInfo(info->kinds[eRegisterKindLLDB], loc);
626  } else
627  LLDB_LOG(log, "Invalid register `{0}` in unwind rule.", lhs);
628  }
629  if (unwind_rules.empty())
630  return true;
631 
632  LLDB_LOG(log, "Could not parse `{0}` as an unwind rule.", unwind_rules);
633  return false;
634 }
635 
636 UnwindPlanSP
637 SymbolFileBreakpad::GetUnwindPlan(const Address &address,
638  const RegisterInfoResolver &resolver) {
639  ParseUnwindData();
640  if (auto *entry =
641  m_unwind_data->cfi.FindEntryThatContains(address.GetFileAddress()))
642  return ParseCFIUnwindPlan(entry->data, resolver);
643  if (auto *entry =
644  m_unwind_data->win.FindEntryThatContains(address.GetFileAddress()))
645  return ParseWinUnwindPlan(entry->data, resolver);
646  return nullptr;
647 }
648 
649 UnwindPlanSP
650 SymbolFileBreakpad::ParseCFIUnwindPlan(const Bookmark &bookmark,
651  const RegisterInfoResolver &resolver) {
652  addr_t base = GetBaseFileAddress();
653  if (base == LLDB_INVALID_ADDRESS)
654  return nullptr;
655 
656  LineIterator It(*m_objfile_sp, Record::StackCFI, bookmark),
657  End(*m_objfile_sp);
658  llvm::Optional<StackCFIRecord> init_record = StackCFIRecord::parse(*It);
659  assert(init_record && init_record->Size &&
660  "Record already parsed successfully in ParseUnwindData!");
661 
662  auto plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindLLDB);
663  plan_sp->SetSourceName("breakpad STACK CFI");
664  plan_sp->SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
665  plan_sp->SetUnwindPlanForSignalTrap(eLazyBoolNo);
666  plan_sp->SetSourcedFromCompiler(eLazyBoolYes);
667  plan_sp->SetPlanValidAddressRange(
668  AddressRange(base + init_record->Address, *init_record->Size,
669  m_objfile_sp->GetModule()->GetSectionList()));
670 
671  auto row_sp = std::make_shared<UnwindPlan::Row>();
672  row_sp->SetOffset(0);
673  if (!ParseCFIUnwindRow(init_record->UnwindRules, resolver, *row_sp))
674  return nullptr;
675  plan_sp->AppendRow(row_sp);
676  for (++It; It != End; ++It) {
677  llvm::Optional<StackCFIRecord> record = StackCFIRecord::parse(*It);
678  if (!record)
679  return nullptr;
680  if (record->Size)
681  break;
682 
683  row_sp = std::make_shared<UnwindPlan::Row>(*row_sp);
684  row_sp->SetOffset(record->Address - init_record->Address);
685  if (!ParseCFIUnwindRow(record->UnwindRules, resolver, *row_sp))
686  return nullptr;
687  plan_sp->AppendRow(row_sp);
688  }
689  return plan_sp;
690 }
691 
692 UnwindPlanSP
693 SymbolFileBreakpad::ParseWinUnwindPlan(const Bookmark &bookmark,
694  const RegisterInfoResolver &resolver) {
695  Log *log = GetLog(LLDBLog::Symbols);
696  addr_t base = GetBaseFileAddress();
697  if (base == LLDB_INVALID_ADDRESS)
698  return nullptr;
699 
700  LineIterator It(*m_objfile_sp, Record::StackWin, bookmark);
701  llvm::Optional<StackWinRecord> record = StackWinRecord::parse(*It);
702  assert(record && "Record already parsed successfully in ParseUnwindData!");
703 
704  auto plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindLLDB);
705  plan_sp->SetSourceName("breakpad STACK WIN");
706  plan_sp->SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
707  plan_sp->SetUnwindPlanForSignalTrap(eLazyBoolNo);
708  plan_sp->SetSourcedFromCompiler(eLazyBoolYes);
709  plan_sp->SetPlanValidAddressRange(
710  AddressRange(base + record->RVA, record->CodeSize,
711  m_objfile_sp->GetModule()->GetSectionList()));
712 
713  auto row_sp = std::make_shared<UnwindPlan::Row>();
714  row_sp->SetOffset(0);
715 
716  llvm::BumpPtrAllocator node_alloc;
717  std::vector<std::pair<llvm::StringRef, postfix::Node *>> program =
718  postfix::ParseFPOProgram(record->ProgramString, node_alloc);
719 
720  if (program.empty()) {
721  LLDB_LOG(log, "Invalid unwind rule: {0}.", record->ProgramString);
722  return nullptr;
723  }
724  auto it = program.begin();
725  llvm::Triple triple = m_objfile_sp->GetArchitecture().GetTriple();
726  const auto &symbol_resolver =
727  [&](postfix::SymbolNode &symbol) -> postfix::Node * {
728  llvm::StringRef name = symbol.GetName();
729  for (const auto &rule : llvm::make_range(program.begin(), it)) {
730  if (rule.first == name)
731  return rule.second;
732  }
733  if (const RegisterInfo *info = ResolveRegister(triple, resolver, name))
734  return postfix::MakeNode<postfix::RegisterNode>(
735  node_alloc, info->kinds[eRegisterKindLLDB]);
736  return nullptr;
737  };
738 
739  // We assume the first value will be the CFA. It is usually called T0, but
740  // clang will use T1, if it needs to realign the stack.
741  auto *symbol = llvm::dyn_cast<postfix::SymbolNode>(it->second);
742  if (symbol && symbol->GetName() == ".raSearch") {
743  row_sp->GetCFAValue().SetRaSearch(record->LocalSize +
744  record->SavedRegisterSize);
745  } else {
746  if (!postfix::ResolveSymbols(it->second, symbol_resolver)) {
747  LLDB_LOG(log, "Resolving symbols in `{0}` failed.",
748  record->ProgramString);
749  return nullptr;
750  }
751  llvm::ArrayRef<uint8_t> saved = SaveAsDWARF(*it->second);
752  row_sp->GetCFAValue().SetIsDWARFExpression(saved.data(), saved.size());
753  }
754 
755  // Replace the node value with InitialValueNode, so that subsequent
756  // expressions refer to the CFA value instead of recomputing the whole
757  // expression.
758  it->second = postfix::MakeNode<postfix::InitialValueNode>(node_alloc);
759 
760 
761  // Now process the rest of the assignments.
762  for (++it; it != program.end(); ++it) {
763  const RegisterInfo *info = ResolveRegister(triple, resolver, it->first);
764  // It is not an error if the resolution fails because the program may
765  // contain temporary variables.
766  if (!info)
767  continue;
768  if (!postfix::ResolveSymbols(it->second, symbol_resolver)) {
769  LLDB_LOG(log, "Resolving symbols in `{0}` failed.",
770  record->ProgramString);
771  return nullptr;
772  }
773 
774  llvm::ArrayRef<uint8_t> saved = SaveAsDWARF(*it->second);
776  loc.SetIsDWARFExpression(saved.data(), saved.size());
777  row_sp->SetRegisterInfo(info->kinds[eRegisterKindLLDB], loc);
778  }
779 
780  plan_sp->AppendRow(row_sp);
781  return plan_sp;
782 }
783 
784 addr_t SymbolFileBreakpad::GetBaseFileAddress() {
785  return m_objfile_sp->GetModule()
786  ->GetObjectFile()
787  ->GetBaseAddress()
788  .GetFileAddress();
789 }
790 
791 // Parse out all the FILE records from the breakpad file. These will be needed
792 // when constructing the support file lists for individual compile units.
793 void SymbolFileBreakpad::ParseFileRecords() {
794  if (m_files)
795  return;
796  m_files.emplace();
797 
798  Log *log = GetLog(LLDBLog::Symbols);
799  for (llvm::StringRef line : lines(Record::File)) {
800  auto record = FileRecord::parse(line);
801  if (!record) {
802  LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", line);
803  continue;
804  }
805 
806  if (record->Number >= m_files->size())
807  m_files->resize(record->Number + 1);
808  FileSpec::Style style = FileSpec::GuessPathStyle(record->Name)
809  .value_or(FileSpec::Style::native);
810  (*m_files)[record->Number] = FileSpec(record->Name, style);
811  }
812 }
813 
814 void SymbolFileBreakpad::ParseCUData() {
815  if (m_cu_data)
816  return;
817 
818  m_cu_data.emplace();
819  Log *log = GetLog(LLDBLog::Symbols);
820  addr_t base = GetBaseFileAddress();
821  if (base == LLDB_INVALID_ADDRESS) {
822  LLDB_LOG(log, "SymbolFile parsing failed: Unable to fetch the base address "
823  "of object file.");
824  }
825 
826  // We shall create one compile unit for each FUNC record. So, count the number
827  // of FUNC records, and store them in m_cu_data, together with their ranges.
828  for (LineIterator It(*m_objfile_sp, Record::Func), End(*m_objfile_sp);
829  It != End; ++It) {
830  if (auto record = FuncRecord::parse(*It)) {
831  m_cu_data->Append(CompUnitMap::Entry(base + record->Address, record->Size,
832  CompUnitData(It.GetBookmark())));
833  } else
834  LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", *It);
835  }
836  m_cu_data->Sort();
837 }
838 
839 // Construct the list of support files and line table entries for the given
840 // compile unit.
841 void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu,
842  CompUnitData &data) {
843  addr_t base = GetBaseFileAddress();
844  assert(base != LLDB_INVALID_ADDRESS &&
845  "How did we create compile units without a base address?");
846 
847  SupportFileMap map;
848  std::vector<std::unique_ptr<LineSequence>> sequences;
849  std::unique_ptr<LineSequence> line_seq_up =
850  LineTable::CreateLineSequenceContainer();
851  llvm::Optional<addr_t> next_addr;
852  auto finish_sequence = [&]() {
853  LineTable::AppendLineEntryToSequence(
854  line_seq_up.get(), *next_addr, /*line=*/0, /*column=*/0,
855  /*file_idx=*/0, /*is_start_of_statement=*/false,
856  /*is_start_of_basic_block=*/false, /*is_prologue_end=*/false,
857  /*is_epilogue_begin=*/false, /*is_terminal_entry=*/true);
858  sequences.push_back(std::move(line_seq_up));
859  line_seq_up = LineTable::CreateLineSequenceContainer();
860  };
861 
862  LineIterator It(*m_objfile_sp, Record::Func, data.bookmark),
863  End(*m_objfile_sp);
864  assert(Record::classify(*It) == Record::Func);
865  for (++It; It != End; ++It) {
866  // Skip INLINE records
867  if (Record::classify(*It) == Record::Inline)
868  continue;
869 
870  auto record = LineRecord::parse(*It);
871  if (!record)
872  break;
873 
874  record->Address += base;
875 
876  if (next_addr && *next_addr != record->Address) {
877  // Discontiguous entries. Finish off the previous sequence and reset.
878  finish_sequence();
879  }
880  LineTable::AppendLineEntryToSequence(
881  line_seq_up.get(), record->Address, record->LineNum, /*column=*/0,
882  map[record->FileNum], /*is_start_of_statement=*/true,
883  /*is_start_of_basic_block=*/false, /*is_prologue_end=*/false,
884  /*is_epilogue_begin=*/false, /*is_terminal_entry=*/false);
885  next_addr = record->Address + record->Size;
886  }
887  if (next_addr)
888  finish_sequence();
889  data.line_table_up = std::make_unique<LineTable>(&cu, std::move(sequences));
890  data.support_files = map.translate(cu.GetPrimaryFile(), *m_files);
891 }
892 
893 void SymbolFileBreakpad::ParseUnwindData() {
894  if (m_unwind_data)
895  return;
896  m_unwind_data.emplace();
897 
898  Log *log = GetLog(LLDBLog::Symbols);
899  addr_t base = GetBaseFileAddress();
900  if (base == LLDB_INVALID_ADDRESS) {
901  LLDB_LOG(log, "SymbolFile parsing failed: Unable to fetch the base address "
902  "of object file.");
903  }
904 
905  for (LineIterator It(*m_objfile_sp, Record::StackCFI), End(*m_objfile_sp);
906  It != End; ++It) {
907  if (auto record = StackCFIRecord::parse(*It)) {
908  if (record->Size)
909  m_unwind_data->cfi.Append(UnwindMap::Entry(
910  base + record->Address, *record->Size, It.GetBookmark()));
911  } else
912  LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", *It);
913  }
914  m_unwind_data->cfi.Sort();
915 
916  for (LineIterator It(*m_objfile_sp, Record::StackWin), End(*m_objfile_sp);
917  It != End; ++It) {
918  if (auto record = StackWinRecord::parse(*It)) {
919  m_unwind_data->win.Append(UnwindMap::Entry(
920  base + record->RVA, record->CodeSize, It.GetBookmark()));
921  } else
922  LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", *It);
923  }
924  m_unwind_data->win.Sort();
925 }
926 
927 uint64_t SymbolFileBreakpad::GetDebugInfoSize() {
928  // Breakpad files are all debug info.
929  return m_objfile_sp->GetByteSize();
930 }
lldb_private::toString
const char * toString(AppleArm64ExceptionClass EC)
Definition: AppleArm64ExceptionClass.h:38
lldb_private::Block::FindInnermostBlockByOffset
Block * FindInnermostBlockByOffset(const lldb::addr_t offset)
Definition: Block.cpp:126
lldb_private::LineTable::FindLineEntryByAddress
bool FindLineEntryByAddress(const Address &so_addr, LineEntry &line_entry, uint32_t *index_ptr=nullptr)
Find a line entry that contains the section offset address so_addr.
Definition: LineTable.cpp:188
lldb_private::AddressRange::GetBaseAddress
Address & GetBaseAddress()
Get accessor for the base address of the range.
Definition: AddressRange.h:209
list
MATCHES FreeBSD list(APPEND FBSDKERNEL_LIBS kvm) endif() if(NOT FBSDKERNEL_LIBS) message(STATUS "Skipping FreeBSDKernel plugin due to missing libfbsdvmcore") return() endif() add_lldb_library(lldbPluginProcessFreeBSDKernel PLUGIN ProcessFreeBSDKernel.cpp RegisterContextFreeBSDKernel_arm64.cpp RegisterContextFreeBSDKernel_i386.cpp RegisterContextFreeBSDKernel_x86_64.cpp ThreadFreeBSDKernel.cpp LINK_LIBS lldbCore lldbTarget $
Definition: Plugins/Process/FreeBSDKernel/CMakeLists.txt:6
lldb_private::SymbolContext::block
Block * block
The Block for a given query.
Definition: SymbolContext.h:321
lldb_private::ArchSpec::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition: ArchSpec.cpp:731
lldb_private::SymbolContext::comp_unit
CompileUnit * comp_unit
The CompileUnit for a given query.
Definition: SymbolContext.h:319
llvm
Definition: Debugger.h:50
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::RegularExpression
Definition: RegularExpression.h:18
FileSystem.h
lldb::eSymbolTypeCode
@ eSymbolTypeCode
Definition: lldb-enumerations.h:624
CompileUnit.h
lldb_private::Function::GetAddressRange
const AddressRange & GetAddressRange()
Definition: Function.h:457
TypeMap.h
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::postfix::Node
The base class for all nodes in the parsed postfix tree.
Definition: PostfixExpression.h:29
lldb_private::SourceLocationSpec
Definition: SourceLocationSpec.h:27
lldb_private::UnwindPlan::Row::SetRegisterInfo
void SetRegisterInfo(uint32_t reg_num, const RegisterLocation register_location)
Definition: UnwindPlan.cpp:273
lldb::eRegisterKindGeneric
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
Definition: lldb-enumerations.h:230
lldb_private::SymbolContextList::Append
void Append(const SymbolContext &sc)
Append a new symbol context to the list.
Definition: SymbolContext.cpp:1184
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::m_current_line
size_t m_current_line
Definition: SymbolFileBreakpad.cpp:76
lldb_private::breakpad::SymbolFileBreakpad::CompUnitData::line_table_up
std::unique_ptr< LineTable > line_table_up
Definition: SymbolFileBreakpad.h:205
lldb_private::postfix::ResolveSymbols
bool ResolveSymbols(Node *&node, llvm::function_ref< Node *(SymbolNode &symbol)> replacer)
A utility function for "resolving" SymbolNodes.
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::LineIterator
LineIterator(ObjectFile &obj)
Definition: SymbolFileBreakpad.cpp:46
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
lldb_private::AddressRange::GetByteSize
lldb::addr_t GetByteSize() const
Get accessor for the byte size of this range.
Definition: AddressRange.h:221
Module.h
lldb_private::breakpad::SymbolFileBreakpad
Definition: SymbolFileBreakpad.h:23
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
lldb_private::ObjectFile::ReadSectionData
virtual size_t ReadSectionData(Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len)
Definition: ObjectFile.cpp:474
lldb_private::postfix::ToDWARF
void ToDWARF(Node &node, Stream &stream)
Serialize the given expression tree as DWARF.
Definition: PostfixExpression.cpp:246
lldb_private::Module
Definition: Module.h:85
lldb_private::SectionList
Definition: Section.h:34
lldb_private::breakpad::SymbolFileBreakpad::CompUnitData
Definition: SymbolFileBreakpad.h:187
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::operator++
const LineIterator & operator++()
Definition: SymbolFileBreakpad.cpp:107
lldb_private::RangeData
Definition: RangeMap.h:410
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::SymbolContext
Definition: SymbolContext.h:33
Section.h
lldb_private::CompileUnit
Definition: CompileUnit.h:38
lldb_private::Block::AddRange
void AddRange(const Range &range)
Add a new offset range to this block.
Definition: Block.cpp:335
lldb_private::Module::LookupInfo
Definition: Module.h:931
lldb_private::FileSpec
Definition: FileSpec.h:56
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::Function
Definition: Function.h:409
ID
static char ID
Definition: IRDynamicChecks.cpp:33
lldb_private::Function::GetCompileUnit
CompileUnit * GetCompileUnit()
Get accessor for the compile unit that owns this function.
Definition: Function.cpp:360
lldb::eRegisterKindLLDB
@ eRegisterKindLLDB
lldb's internal register numbers
Definition: lldb-enumerations.h:234
dwarf
Definition: ABISysV_arc.cpp:61
lldb_private::DataExtractor
Definition: DataExtractor.h:48
Log.h
lldb_private::Symtab::Finalize
void Finalize()
Definition: Symtab.cpp:1008
lldb_private::Function::GetBlock
Block & GetBlock(bool can_create)
Get accessor for the block list.
Definition: Function.cpp:345
lldb_private::UnwindPlan::Row::GetCFAValue
FAValue & GetCFAValue()
Definition: UnwindPlan.h:341
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:291
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::m_next_section_idx
uint32_t m_next_section_idx
Definition: SymbolFileBreakpad.cpp:74
lldb_private::CompileUnit::AddFunction
void AddFunction(lldb::FunctionSP &function_sp)
Add a function to this compile unit.
Definition: CompileUnit.cpp:139
lldb_private::SymbolContextList::GetSize
uint32_t GetSize() const
Get accessor for a symbol context list size.
Definition: SymbolContext.cpp:1274
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::Section::GetName
ConstString GetName() const
Definition: Section.h:176
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::SymbolFile::RegisterInfoResolver::ResolveNumber
virtual const RegisterInfo * ResolveNumber(lldb::RegisterKind kind, uint32_t number) const =0
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::CompileUnit::SetLineTable
void SetLineTable(LineTable *line_table)
Set the line table for the compile unit.
Definition: CompileUnit.cpp:172
lldb_private::SectionList::GetSectionAtIndex
lldb::SectionSP GetSectionAtIndex(size_t idx) const
Definition: Section.cpp:538
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::m_section_text
llvm::StringRef m_section_text
Definition: SymbolFileBreakpad.cpp:75
lldb_private::Range
Definition: Process.h:61
lldb_private::CompileUnit::GetPrimaryFile
const FileSpec & GetPrimaryFile() const
Return the primary source file associated with this compile unit.
Definition: CompileUnit.h:227
lldb_private::SymbolFile::RegisterInfoResolver
Definition: SymbolFile.h:292
lldb_private::SymbolFile::RegisterInfoResolver::ResolveName
virtual const RegisterInfo * ResolveName(llvm::StringRef name) const =0
lldb_private::CompileUnit::GetLineTable
LineTable * GetLineTable()
Get the line table for the compile unit.
Definition: CompileUnit.cpp:161
lldb_private::postfix::SymbolNode::GetName
llvm::StringRef GetName() const
Definition: PostfixExpression.h:123
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::m_obj
ObjectFile * m_obj
Definition: SymbolFileBreakpad.cpp:72
lldb_private::TypeMap
Definition: TypeMap.h:20
lldb_private::CompilerDeclContext
Represents a generic declaration context in a program.
Definition: CompilerDeclContext.h:30
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:684
ObjectFile.h
lldb_private::UserID::GetID
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47
lldb_private::UnwindPlan::Row::RegisterLocation
Definition: UnwindPlan.h:57
lldb_private::Section
Definition: Section.h:102
lldb_private::FileSpec::Style
llvm::sys::path::Style Style
Definition: FileSpec.h:58
lldb_private::Module::GetSectionList
virtual SectionList * GetSectionList()
Get the unified section list for the module.
Definition: Module.cpp:1302
lldbassert
#define lldbassert(x)
Definition: LLDBAssert.h:15
lldb_private::breakpad
Definition: BreakpadRecords.h:19
lldb_private::Symtab::AddSymbol
uint32_t AddSymbol(const Symbol &symbol)
Definition: Symtab.cpp:64
lldb_private::Module::LookupInfo::GetLookupName
ConstString GetLookupName() const
Definition: Module.h:942
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::m_section_type
ConstString m_section_type
Definition: SymbolFileBreakpad.cpp:73
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::FindNextLine
void FindNextLine()
Definition: SymbolFileBreakpad.cpp:79
lldb_private::Block
Definition: Block.h:41
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:437
lldb_private::Symtab
Definition: Symtab.h:22
lldb_private::breakpad::SymbolFileBreakpad::Bookmark
Definition: SymbolFileBreakpad.h:159
lldb_private::UnwindPlan::Row
Definition: UnwindPlan.h:55
uint32_t
lldb_private::postfix::ParseOneExpression
Node * ParseOneExpression(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc)
Parse the given postfix expression.
Definition: PostfixExpression.cpp:45
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::operator*
llvm::StringRef operator*() const
Definition: SymbolFileBreakpad.cpp:63
lldb_private::Address
Definition: Address.h:59
lldb_private::postfix::ParseFPOProgram
std::vector< std::pair< llvm::StringRef, Node * > > ParseFPOProgram(llvm::StringRef prog, llvm::BumpPtrAllocator &alloc)
Definition: PostfixExpression.cpp:89
lldb_private::UnwindPlan::Row::RegisterLocation::SetIsDWARFExpression
void SetIsDWARFExpression(const uint8_t *opcodes, uint32_t len)
Definition: UnwindPlan.cpp:64
lldb_private::postfix::SymbolNode
A node representing a symbolic reference to a named entity.
Definition: PostfixExpression.h:119
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::ModuleChild::GetModule
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:24
lldb_private::CompileUnit::ResolveSymbolContext
void ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
Resolve symbol contexts by file and line.
Definition: CompileUnit.cpp:250
lldb_private::SymbolContext::module_sp
lldb::ModuleSP module_sp
The Module for a given query.
Definition: SymbolContext.h:318
PluginManager.h
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:336
lldb_private::CompileUnit::FindFunctionByUID
lldb::FunctionSP FindFunctionByUID(lldb::user_id_t uid)
Finds a function by user ID.
Definition: CompileUnit.cpp:143
lldb_private::breakpad::SymbolFileBreakpad::LineIterator
Definition: SymbolFileBreakpad.cpp:33
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::LineIterator
LineIterator(ObjectFile &obj, Record::Kind section_type)
Definition: SymbolFileBreakpad.cpp:36
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::m_next_line
size_t m_next_line
Definition: SymbolFileBreakpad.cpp:77
lldb_private::UnwindPlan::Row::FAValue::SetIsDWARFExpression
void SetIsDWARFExpression(const uint8_t *opcodes, uint32_t len)
Definition: UnwindPlan.h:244
lldb_private::breakpad::SymbolFileBreakpad::CompUnitData::support_files
llvm::Optional< FileSpecList > support_files
Definition: SymbolFileBreakpad.h:204
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
GetRule
static llvm::Optional< std::pair< llvm::StringRef, llvm::StringRef > > GetRule(llvm::StringRef &unwind_rules)
Definition: SymbolFileBreakpad.cpp:523
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::breakpad::Record::Kind
Kind
Definition: BreakpadRecords.h:23
SymbolFileBreakpad.h
ResolveRegister
static const RegisterInfo * ResolveRegister(const llvm::Triple &triple, const SymbolFile::RegisterInfoResolver &resolver, llvm::StringRef name)
Definition: SymbolFileBreakpad.cpp:552
LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:51
lldb_private::Address::GetOffset
lldb::addr_t GetOffset() const
Get the section relative offset value.
Definition: Address.h:319
lldb_private::DataExtractor::GetData
const void * GetData(lldb::offset_t *offset_ptr, lldb::offset_t length) const
Extract length bytes from *offset_ptr.
Definition: DataExtractor.h:337
lldb_private::LanguageSet
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: TypeSystem.h:40
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb_private::Log
Definition: Log.h:115
ResolveRegisterOrRA
static const RegisterInfo * ResolveRegisterOrRA(const llvm::Triple &triple, const SymbolFile::RegisterInfoResolver &resolver, llvm::StringRef name)
Definition: SymbolFileBreakpad.cpp:565
lldb_private::SymbolContext::line_entry
LineEntry line_entry
The LineEntry for a given query.
Definition: SymbolContext.h:322
SymbolVendor.h
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:308
lldb_private::Declaration
Definition: Declaration.h:24
BreakpadRecords.h
lldb
Definition: SBAddress.h:15
ObjectFileBreakpad.h
LLDBLog.h
lldb_private::ObjectFile
Definition: ObjectFile.h:60
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::operator!=
friend bool operator!=(const LineIterator &lhs, const LineIterator &rhs)
Definition: SymbolFileBreakpad.cpp:52
lldb_private::breakpad::SymbolFileBreakpad::LineIterator::GetBookmark
Bookmark GetBookmark() const
Definition: SymbolFileBreakpad.cpp:67
lldb_private::breakpad::SymbolFileBreakpad::CompUnitData::bookmark
Bookmark bookmark
Definition: SymbolFileBreakpad.h:203
lldb_private::Symbol::GetAddress
Address GetAddress() const
Definition: Symbol.h:73