From 139c9e1f85512c249512b830f564416e525f2999 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Wed, 19 May 2010 19:24:32 +0000 Subject: [PATCH] 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 --- lib/CompilerDriver/Action.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/CompilerDriver/Action.cpp b/lib/CompilerDriver/Action.cpp index 9d07811c896..8c63a4da53e 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) {