[PATCH] D147499: [dsymutil] Improve error with invalid reproducer args
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 3 21:54:50 PDT 2023
keith created this revision.
keith added a reviewer: JDevlieghere.
Herald added a project: All.
keith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Previously it printed that the file or directory was missing, because it
defaulted to an empty string. Previously these were also printed without
newlines.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147499
Files:
llvm/test/tools/dsymutil/X86/reproducer.test
llvm/tools/dsymutil/dsymutil.cpp
Index: llvm/tools/dsymutil/dsymutil.cpp
===================================================================
--- llvm/tools/dsymutil/dsymutil.cpp
+++ llvm/tools/dsymutil/dsymutil.cpp
@@ -216,6 +216,12 @@
"cannot combine --gen-reproducer and --use-reproducer.",
errc::invalid_argument);
+ if (Options.ReproducerPath.empty() &&
+ Options.ReproMode == ReproducerMode::Use)
+ return make_error<StringError>("must specify --use-reproducer with a path "
+ "when using '--reproducer Use'.",
+ errc::invalid_argument);
+
return Error::success();
}
@@ -613,7 +619,7 @@
auto OptionsOrErr = getOptions(Args);
if (!OptionsOrErr) {
- WithColor::error() << toString(OptionsOrErr.takeError());
+ WithColor::error() << toString(OptionsOrErr.takeError()) << '\n';
return EXIT_FAILURE;
}
@@ -627,7 +633,7 @@
auto Repro = Reproducer::createReproducer(Options.ReproMode,
Options.ReproducerPath, argc, argv);
if (!Repro) {
- WithColor::error() << toString(Repro.takeError());
+ WithColor::error() << toString(Repro.takeError()) << '\n';
return EXIT_FAILURE;
}
Index: llvm/test/tools/dsymutil/X86/reproducer.test
===================================================================
--- llvm/test/tools/dsymutil/X86/reproducer.test
+++ llvm/test/tools/dsymutil/X86/reproducer.test
@@ -34,6 +34,8 @@
# Using a reproducer takes precedence.
RUN: dsymutil -gen-reproducer -use-reproducer %t.repro -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s
+RUN: not dsymutil --reproducer Use -f -o - %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=INVALID_ARG
+
CHECK: .debug_info
CHECK: DW_TAG_compile_unit
CHECK-NEXT: DW_AT_producer ("Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
@@ -84,3 +86,5 @@
REPRODUCER: Reproducer written
ERROR: error: cannot parse the debug map
+
+INVALID_ARG: must specify --use-reproducer with a path when using '--reproducer Use'.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147499.510686.patch
Type: text/x-patch
Size: 2113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230404/4118a0da/attachment.bin>
More information about the llvm-commits
mailing list