diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2010-05-19 19:24:32 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2010-05-19 19:24:32 +0000 |
commit | c4785580f1d8786c459b271554e088f52358e101 (patch) | |
tree | 9871cd0c7d9d13a54aa6df0a8d822b305e291ba7 /lib/CompilerDriver/Action.cpp | |
parent | 8f88e82b106a9cadd8b53ec2befa7de3547fb10d (diff) | |
download | external_llvm-c4785580f1d8786c459b271554e088f52358e101.zip external_llvm-c4785580f1d8786c459b271554e088f52358e101.tar.gz external_llvm-c4785580f1d8786c459b271554e088f52358e101.tar.bz2 |
llvmc: report an error if a child process segfaults.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CompilerDriver/Action.cpp')
-rw-r--r-- | lib/CompilerDriver/Action.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/CompilerDriver/Action.cpp b/lib/CompilerDriver/Action.cpp index 9d07811..8c63a4d 100644 --- a/lib/CompilerDriver/Action.cpp +++ b/lib/CompilerDriver/Action.cpp @@ -67,7 +67,20 @@ namespace { argv.push_back(0); // null terminate list. // Invoke the program. - return sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]); + int ret = sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]); + + if (ret < 0) { + const char** B = &argv[0]; + + errs() << "Segmentation fault:"; + while (*B) + errs() << ' ' << *(B++); + errs() << '\n'; + + return 1; + } + + return ret; } void print_string (const std::string& str) { |