[Backtracing] Fix a couple of Linux specific issues.

Linux gives the main thread a name based on the process name, and also
we need to tolerate an extra slash on the `<compiler-generated>` filename
for some reason.

rdar://121430255
This commit is contained in:
Alastair Houghton
2025-01-30 17:24:04 +00:00
parent b85bf05a82
commit 6138992dfe
3 changed files with 12 additions and 9 deletions

View File

@@ -606,8 +606,8 @@ Generate a backtrace for the parent process.
while fd < 0 && (errno == EEXIST || errno == EINTR) {
if errno != EINTR {
ndx += 1
filename = "\(args.outputPath)/\(name)-\(pid)-\(now.tv_sec).\(now.tv_nsec)-\(ndx).\(ext)"
}
filename = "\(args.outputPath)/\(name)-\(pid)-\(now.tv_sec).\(now.tv_nsec)-\(ndx).\(ext)"
fd = open(filename, O_RDWR|O_CREAT|O_EXCL, 0o644)
}