[llvm] e409f85 - [DWP] Fix default for continue-on-cu-index-overflow (#75540)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 12:47:29 PST 2023
Author: Alexander Yermolovich
Date: 2023-12-18T12:47:24-08:00
New Revision: e409f85154fda5bd39436298741faa58178e6051
URL: https://github.com/llvm/llvm-project/commit/e409f85154fda5bd39436298741faa58178e6051
DIFF: https://github.com/llvm/llvm-project/commit/e409f85154fda5bd39436298741faa58178e6051.diff
LOG: [DWP] Fix default for continue-on-cu-index-overflow (#75540)
This is follow up for https://github.com/llvm/llvm-project/pull/71902.
The
default option --continue-on-cu-index-overflow returned an error
--continue-on-cu-index-overflow: missing argument. Changed it so that it
is the
same behavior as other flags like -gsplit-dwarf. Where
--continue-on-cu-index-overflow will default to continue, and user can
set mode
with --continue-on-cu-index-overflow=\<value>.
Added:
Modified:
llvm/test/tools/llvm-dwp/X86/simple.test
llvm/tools/llvm-dwp/Opts.td
llvm/tools/llvm-dwp/llvm-dwp.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-dwp/X86/simple.test b/llvm/test/tools/llvm-dwp/X86/simple.test
index 91c4021bd90983..649548a5634660 100644
--- a/llvm/test/tools/llvm-dwp/X86/simple.test
+++ b/llvm/test/tools/llvm-dwp/X86/simple.test
@@ -3,6 +3,14 @@ RUN: llvm-dwarfdump -v %t | FileCheck --check-prefixes=CHECK,NOTYP %s
RUN: llvm-objdump -h %t | FileCheck --check-prefix=NOTYPOBJ %s
RUN: llvm-dwp %p/../Inputs/simple/types/a.dwo %p/../Inputs/simple/types/b.dwo -o - \
RUN: | llvm-dwarfdump -v - | FileCheck --check-prefixes=CHECK,TYPES %s
+RUN: llvm-dwp %p/../Inputs/simple/notypes/a.dwo %p/../Inputs/simple/notypes/b.dwo -o %t --continue-on-cu-index-overflow
+RUN: llvm-dwp %p/../Inputs/simple/notypes/a.dwo %p/../Inputs/simple/notypes/b.dwo -o %t --continue-on-cu-index-overflow=continue
+RUN: llvm-dwp %p/../Inputs/simple/notypes/a.dwo %p/../Inputs/simple/notypes/b.dwo -o %t --continue-on-cu-index-overflow=soft-stop
+RUN: not llvm-dwp %p/../Inputs/simple/notypes/a.dwo %p/../Inputs/simple/notypes/b.dwo -o %t --continue-on-cu-index-overflow=foobar
+RUN: llvm-dwp %p/../Inputs/simple/notypes/a.dwo %p/../Inputs/simple/notypes/b.dwo -o %t -continue-on-cu-index-overflow
+RUN: llvm-dwp %p/../Inputs/simple/notypes/a.dwo %p/../Inputs/simple/notypes/b.dwo -o %t -continue-on-cu-index-overflow=continue
+RUN: llvm-dwp %p/../Inputs/simple/notypes/a.dwo %p/../Inputs/simple/notypes/b.dwo -o %t -continue-on-cu-index-overflow=soft-stop
+RUN: not llvm-dwp %p/../Inputs/simple/notypes/a.dwo %p/../Inputs/simple/notypes/b.dwo -o %t -continue-on-cu-index-overflow=foobar
DWP from non-type-unit debug info for these two translation units:
a.cpp:
diff --git a/llvm/tools/llvm-dwp/Opts.td b/llvm/tools/llvm-dwp/Opts.td
index 75b56fdb670cf4..46593bc40ebae8 100644
--- a/llvm/tools/llvm-dwp/Opts.td
+++ b/llvm/tools/llvm-dwp/Opts.td
@@ -9,7 +9,10 @@ def version : F<"version", "Display the version of this program">;
def execFileNames : S<"e", "Specify the executable/library files to get the list of *.dwo from.">, MetaVarName<"<filename>">;
def outputFileName : S<"o", "Specify the output file.">, MetaVarName<"<filename>">;
-def continueOnCuIndexOverflow : S<"continue-on-cu-index-overflow", "default = continue, This turns an error when offset "
- "for .debug_*.dwo sections overfolws into a warning. = soft-stop, This produces a "
- "truncated but valid DWP file, discarding any DWO files that would not fit within "
- "the 32 bit/4GB limits of the format.">, MetaVarName<"<filename>">;
\ No newline at end of file
+def continueOnCuIndexOverflow : Flag<["-", "--"], "continue-on-cu-index-overflow">;
+def continueOnCuIndexOverflow_EQ : Joined<["-", "--"], "continue-on-cu-index-overflow=">,
+ HelpText<"default = continue, This turns an error when offset \n"
+ "\t\tfor .debug_*.dwo sections overfolws into a warning. = soft-stop, This produces a \n"
+ "\t\ttruncated but valid DWP file, discarding any DWO files that would not fit within \n"
+ "\t\tthe 32 bit/4GB limits of the format.">,
+ Values<"continue,soft-stop">;
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 5cd4c0078a4586..a6b8643a590382 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -144,13 +144,21 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
}
OutputFilename = Args.getLastArgValue(OPT_outputFileName, "");
- if (Args.hasArg(OPT_continueOnCuIndexOverflow)) {
- ContinueOption =
- Args.getLastArgValue(OPT_continueOnCuIndexOverflow, "continue");
- if (ContinueOption == "soft-stop") {
- OverflowOptValue = OnCuIndexOverflow::SoftStop;
- } else {
+ if (Arg *Arg = Args.getLastArg(OPT_continueOnCuIndexOverflow,
+ OPT_continueOnCuIndexOverflow_EQ)) {
+ if (Arg->getOption().matches(OPT_continueOnCuIndexOverflow)) {
OverflowOptValue = OnCuIndexOverflow::Continue;
+ } else {
+ ContinueOption = Arg->getValue();
+ if (ContinueOption == "soft-stop") {
+ OverflowOptValue = OnCuIndexOverflow::SoftStop;
+ } else if (ContinueOption == "continue") {
+ OverflowOptValue = OnCuIndexOverflow::Continue;
+ } else {
+ llvm::errs() << "invalid value for --continue-on-cu-index-overflow"
+ << ContinueOption << '\n';
+ exit(1);
+ }
}
}
More information about the llvm-commits
mailing list