diff options
author | Alexander Yermolovich <ayermolo@fb.com> | 2022-12-06 16:07:59 -0800 |
---|---|---|
committer | Alexander Yermolovich <ayermolo@fb.com> | 2022-12-07 13:08:35 -0800 |
commit | a5bd76a6e3119af9dd9c1d8af89e2b89f5267deb (patch) | |
tree | b89c44b27c88a6c6f3dc2ffe1e6ed3a57c253819 /llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | |
parent | 5ebd28f3e56c00a739fda46c72c9e0f6528add87 (diff) | |
download | llvm-a5bd76a6e3119af9dd9c1d8af89e2b89f5267deb.zip llvm-a5bd76a6e3119af9dd9c1d8af89e2b89f5267deb.tar.gz llvm-a5bd76a6e3119af9dd9c1d8af89e2b89f5267deb.tar.bz2 |
[DWARFLibrary] Add support to re-construct cu-index
Summary:
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
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.cpp | 8 |
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 59e7361..80bbbb7 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -247,6 +247,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."), @@ -635,6 +642,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; } |