Skip to content

Commit d0d3673

Browse files
authored
Merge pull request #7610 from apple/cherrypick/rebranch/bd206a363af3
[dsymutil] Keep DSYMUTIL_REPRODUCER_PATH in addition to LLVM_DIAGNOST…
2 parents edf72c1 + aa9a82a commit d0d3673

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

llvm/test/tools/dsymutil/X86/reproducer.test

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ RUN: env TMPDIR="%t/tempdir" dsymutil -o - -f %t/Inputs/basic.macho.x86_64
2121
RUN: not ls %t/tempdir/dsymutil-*
2222

2323
# Create a reproducer.
24-
RUN: env LLVM_DIAGNOSTIC_DIR=%t.repro dsymutil -gen-reproducer -f -o %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefixes=REPRODUCER
24+
RUN: rm -rf %t.repro
25+
RUN: env DSYMUTIL_REPRODUCER_PATH=%t.repro dsymutil -gen-reproducer -f -o %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefixes=REPRODUCER
2526
RUN: llvm-dwarfdump -a %t.generate | FileCheck %s
2627

28+
RUN: rm -rf %t.diags
29+
RUN: env LLVM_DIAGNOSTIC_DIR=%t.diags dsymutil -gen-reproducer -f -o %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefixes=REPRODUCER
30+
RUN: ls %t.diags | grep 'dsymutil-' | count 1
31+
2732
# Remove the input files and verify that was successful.
2833
RUN: rm -rf %t
2934
RUN: not dsymutil -f -o %t.error -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=ERROR

llvm/tools/dsymutil/Reproducer.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,21 @@
88

99
#include "Reproducer.h"
1010
#include "llvm/Support/Path.h"
11+
#include "llvm/Support/Process.h"
1112

1213
using namespace llvm;
1314
using namespace llvm::dsymutil;
1415

1516
static std::string createReproducerDir(std::error_code &EC) {
1617
SmallString<128> Root;
17-
if (const char *Path = getenv("LLVM_DIAGNOSTIC_DIR")) {
18+
if (const char *Path = getenv("DSYMUTIL_REPRODUCER_PATH")) {
1819
Root.assign(Path);
19-
EC = sys::fs::create_directory(Root);
20+
EC = sys::fs::create_directories(Root);
21+
} else if (const char *Path = getenv("LLVM_DIAGNOSTIC_DIR")) {
22+
Root.assign(Path);
23+
llvm::sys::path::append(
24+
Root, "dsymutil-" + llvm::Twine(llvm::sys::Process::getProcessId()));
25+
EC = sys::fs::create_directories(Root);
2026
} else {
2127
EC = sys::fs::createUniqueDirectory("dsymutil", Root);
2228
}

0 commit comments

Comments
 (0)