[llvm] c4a769b - [llvm-exegesis] Print errno on failures in subprocess

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 12:41:57 PDT 2023


Author: Aiden Grossman
Date: 2023-09-05T12:41:49-07:00
New Revision: c4a769ba03e4738340e28f2697ae1a2b972cd845

URL: https://github.com/llvm/llvm-project/commit/c4a769ba03e4738340e28f2697ae1a2b972cd845
DIFF: https://github.com/llvm/llvm-project/commit/c4a769ba03e4738340e28f2697ae1a2b972cd845.diff

LOG: [llvm-exegesis] Print errno on failures in subprocess

Some error logging in llvm-exegesis under the subprocess executor just
prints a generic failure information rather than any details about the
error as we omit printing the string version of errno. This patch adds
in printing errno at all relevant points in the subprocess executor that
were previously missed.

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D157682

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index 0bafb05b7a1d73..2f70822608f502 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -209,7 +209,8 @@ class SubProcessFunctionExecutorImpl
     ssize_t BytesWritten = sendmsg(SocketFD, &Message, 0);
 
     if (BytesWritten < 0)
-      return make_error<Failure>("Failed to write FD to socket");
+      return make_error<Failure>("Failed to write FD to socket: " +
+                                 Twine(strerror(errno)));
 
     return Error::success();
   }
@@ -224,7 +225,8 @@ class SubProcessFunctionExecutorImpl
     ssize_t BytesRead = recvmsg(SocketFD, &Message, 0);
 
     if (BytesRead < 0)
-      return make_error<Failure>("Failed to read FD from socket");
+      return make_error<Failure>("Failed to read FD from socket: " +
+                                 Twine(strerror(errno)));
 
     struct cmsghdr *ControlMessage = CMSG_FIRSTHDR(&Message);
 
@@ -246,7 +248,8 @@ class SubProcessFunctionExecutorImpl
     if (PipeSuccessOrErr != 0) {
       return make_error<Failure>(
           "Failed to create a pipe for interprocess communication between "
-          "llvm-exegesis and the benchmarking subprocess");
+          "llvm-exegesis and the benchmarking subprocess: " +
+          Twine(strerror(errno)));
     }
 
     SubprocessMemory SPMemory;


        


More information about the llvm-commits mailing list