LLDB  mainline
DWARFContext.cpp
Go to the documentation of this file.
1 //===-- DWARFContext.cpp ----------------------------------------*- C++ -*-===//
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 "DWARFContext.h"
10 
11 #include "lldb/Core/Section.h"
12 
13 using namespace lldb;
14 using namespace lldb_private;
15 
16 static const DWARFDataExtractor *
17 LoadOrGetSection(Module &module, SectionType section_type,
18  llvm::Optional<DWARFDataExtractor> &extractor) {
19  if (extractor.hasValue())
20  return extractor->GetByteSize() > 0 ? extractor.getPointer() : nullptr;
21 
22  // Initialize to an empty extractor so that we always take the fast path going
23  // forward.
24  extractor.emplace();
25 
26  const SectionList *section_list = module.GetSectionList();
27  if (!section_list)
28  return nullptr;
29 
30  auto section_sp = section_list->FindSectionByType(section_type, true);
31  if (!section_sp)
32  return nullptr;
33 
34  section_sp->GetSectionData(*extractor);
35  return extractor.getPointer();
36 }
37 
38 DWARFContext::DWARFContext(Module &module) : m_module(module) {}
39 
42  m_data_debug_aranges);
43 }
static const DWARFDataExtractor * LoadOrGetSection(Module &module, SectionType section_type, llvm::Optional< DWARFDataExtractor > &extractor)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
lldb::SectionSP FindSectionByType(lldb::SectionType sect_type, bool check_children, size_t start_idx=0) const
Definition: Section.cpp:545
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:109
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
virtual SectionList * GetSectionList()
Get the unified section list for the module.
Definition: Module.cpp:1284
Definition: SBAddress.h:15
const DWARFDataExtractor * getOrLoadArangesData()