aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
diff options
context:
space:
mode:
authorAlexander Yermolovich <ayermolo@fb.com>2023-01-10 15:14:47 -0800
committerAlexander Yermolovich <ayermolo@fb.com>2023-01-10 15:15:48 -0800
commit73712c8790a93c29e513f5e201f92ac5b2370cf9 (patch)
treeb74c1ec762dc7f30f3ec2afa8f2b7ba0cf1def65 /llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
parent3531c41168e01bf1750b436036c9b9db7e8ee5d5 (diff)
downloadllvm-73712c8790a93c29e513f5e201f92ac5b2370cf9.zip
llvm-73712c8790a93c29e513f5e201f92ac5b2370cf9.tar.gz
llvm-73712c8790a93c29e513f5e201f92ac5b2370cf9.tar.bz2
[DWARFLibrary] Add support to re-construct cu-index
According to DWARF5 specification and gnu specification for DWARF4 the offset entry in the CU/TU Index is 32 bits. This presents a problem when .debug_info.dwo in DWP file grows beyond 4GB. The CU Index becomes partially corrupted. This diff adds manual parsing of .debug_info.dwo/.debug_abbrev.dwo to reconstruct CU index in general, and TU index for DWARF5. This is a work around until DWARF6 spec is finalized. Next patch will change internal CU/TU struct to 64 bit, and change uses as necessary. The plan is to land all the patches in one go after all are approved. This patch originates from the discussion in: https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902 Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D137882
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp')
-rw-r--r--llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index c151129..27330a5 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -249,6 +249,13 @@ static cl::opt<bool>
cl::desc("Show the sizes of all debug sections, "
"expressed in bytes."),
cat(DwarfDumpCategory));
+static cl::opt<bool> ManuallyGenerateUnitIndex(
+ "manaully-generate-unit-index",
+ cl::desc("if the input is dwp file, parse .debug_info "
+ "section and use it to populate "
+ "DW_SECT_INFO contributions in cu-index. "
+ "For DWARF5 it also populated TU Index."),
+ cl::init(false), cl::Hidden, cl::cat(DwarfDumpCategory));
static cl::opt<bool>
ShowSources("show-sources",
cl::desc("Show the sources across all compilation units."),
@@ -675,6 +682,7 @@ static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
std::unique_ptr<DWARFContext> DICtx = DWARFContext::create(
*Obj, DWARFContext::ProcessDebugRelocations::Process, nullptr, "",
RecoverableErrorHandler);
+ DICtx->setParseCUTUIndexManually(ManuallyGenerateUnitIndex);
if (!HandleObj(*Obj, *DICtx, Filename, OS))
Result = false;
}