From 3266493603b2e77d1fca273be6410a546262459e Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 14 Sep 2011 20:52:27 +0000 Subject: DWARF: Generate the address lookup table from the DIE tree if .debug_aranges is not available. Ported from LLDB. llvm-svn: 139732 --- llvm/lib/DebugInfo/DWARFDebugAranges.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'llvm/lib/DebugInfo/DWARFDebugAranges.cpp') diff --git a/llvm/lib/DebugInfo/DWARFDebugAranges.cpp b/llvm/lib/DebugInfo/DWARFDebugAranges.cpp index b116f8f7d89..5053e19b71c 100644 --- a/llvm/lib/DebugInfo/DWARFDebugAranges.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugAranges.cpp @@ -83,6 +83,19 @@ bool DWARFDebugAranges::extract(DataExtractor debug_aranges_data) { return false; } +bool DWARFDebugAranges::generate(DWARFContext *ctx) { + clear(); + if (ctx) { + const uint32_t num_compile_units = ctx->getNumCompileUnits(); + for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) { + DWARFCompileUnit *cu = ctx->getCompileUnitAtIndex(cu_idx); + if (cu) + cu->buildAddressRangeTable(this, true); + } + } + return !isEmpty(); +} + void DWARFDebugAranges::dump(raw_ostream &OS) const { const uint32_t num_ranges = getNumRanges(); for (uint32_t i = 0; i < num_ranges; ++i) { -- cgit v1.2.3