Skip to content

Commit c4a769b

Browse files
[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
1 parent ca8dbdc commit c4a769b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ class SubProcessFunctionExecutorImpl
209209
ssize_t BytesWritten = sendmsg(SocketFD, &Message, 0);
210210

211211
if (BytesWritten < 0)
212-
return make_error<Failure>("Failed to write FD to socket");
212+
return make_error<Failure>("Failed to write FD to socket: " +
213+
Twine(strerror(errno)));
213214

214215
return Error::success();
215216
}
@@ -224,7 +225,8 @@ class SubProcessFunctionExecutorImpl
224225
ssize_t BytesRead = recvmsg(SocketFD, &Message, 0);
225226

226227
if (BytesRead < 0)
227-
return make_error<Failure>("Failed to read FD from socket");
228+
return make_error<Failure>("Failed to read FD from socket: " +
229+
Twine(strerror(errno)));
228230

229231
struct cmsghdr *ControlMessage = CMSG_FIRSTHDR(&Message);
230232

@@ -246,7 +248,8 @@ class SubProcessFunctionExecutorImpl
246248
if (PipeSuccessOrErr != 0) {
247249
return make_error<Failure>(
248250
"Failed to create a pipe for interprocess communication between "
249-
"llvm-exegesis and the benchmarking subprocess");
251+
"llvm-exegesis and the benchmarking subprocess: " +
252+
Twine(strerror(errno)));
250253
}
251254

252255
SubprocessMemory SPMemory;

0 commit comments

Comments
 (0)