This patch implements proposal https://lists.llvm.org/pipermail/llvm-dev/2020-August/144579.html llvm-dwarfutil - is a tool that is used for processing debug info(DWARF) located in built binary files to improve debug info quality, reduce debug info size. The patch currently implements smaller set of command-line options(comparing to the proposal): ``` ./llvm-dwarfutil [options] <input file> <output file> --garbage-collection Do garbage collection for debug info(default) -j <value> Alias for --num-threads --no-garbage-collection Don`t do garbage collection for debug info --no-odr-deduplication Don`t do ODR deduplication for debug types --no-odr Alias for --no-odr-deduplication --no-separate-debug-file Create single output file, containing debug tables(default) --num-threads <threads> Number of available threads for multi-threaded execution. Defaults to the number of cores on the current machine --odr-deduplication Do ODR deduplication for debug types(default) --odr Alias for --odr-deduplication --separate-debug-file Create two output files: file w/o debug tables and file with debug tables --tombstone [bfd,maxpc,exec,universal] Tombstone value used as a marker of invalid address(default: universal) =bfd - Zero for all addresses and [1,1] for DWARF v4 (or less) address ranges and exec =maxpc - Minus 1 for all addresses and minus 2 for DWARF v4 (or less) address ranges =exec - Match with address ranges of executable sections =universal - Both: bfd and maxpc ``` Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D86539
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
//===- Options.h ------------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TOOLS_LLVM_DWARFUTIL_OPTIONS_H
|
|
#define LLVM_TOOLS_LLVM_DWARFUTIL_OPTIONS_H
|
|
|
|
#include "llvm/ADT/SmallString.h"
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
namespace llvm {
|
|
namespace dwarfutil {
|
|
|
|
/// The kind of tombstone value.
|
|
enum class TombstoneKind {
|
|
BFD, /// 0/[1:1]. Bfd default.
|
|
MaxPC, /// -1/-2. Assumed to match with
|
|
/// http://www.dwarfstd.org/ShowIssue.php?issue=200609.1.
|
|
Universal, /// both: BFD + MaxPC
|
|
Exec, /// match with address range of executable sections.
|
|
};
|
|
|
|
struct Options {
|
|
std::string InputFileName;
|
|
std::string OutputFileName;
|
|
bool DoGarbageCollection = false;
|
|
bool DoODRDeduplication = false;
|
|
bool BuildSeparateDebugFile = false;
|
|
TombstoneKind Tombstone = TombstoneKind::Universal;
|
|
bool Verbose = false;
|
|
int NumThreads = 0;
|
|
bool Verify = false;
|
|
|
|
std::string getSeparateDebugFileName() const {
|
|
return OutputFileName + ".debug";
|
|
}
|
|
};
|
|
|
|
} // namespace dwarfutil
|
|
} // namespace llvm
|
|
|
|
#endif // LLVM_TOOLS_LLVM_DWARFUTIL_OPTIONS_H
|