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

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 01:01:39 PDT 2023


aidengrossman created this revision.
Herald added a subscriber: mstojanovic.
Herald added a project: All.
aidengrossman requested review of this revision.
Herald added subscribers: llvm-commits, courbet.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157682

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


Index: llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -209,7 +209,8 @@
     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 @@
     size_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 @@
     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157682.549274.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230811/40fb36fb/attachment.bin>


More information about the llvm-commits mailing list