mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,10 @@ struct Crash {
|
||||
|
||||
// CHECK-NEXT: "threads": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "crashed": true,
|
||||
|
||||
// On Linux there's a name here
|
||||
|
||||
// CHECK: "crashed": true,
|
||||
// CHECK-NEXT: "registers": {
|
||||
// CHECK-NEXT: "{{.*}}": "0x{{[0-9a-f]+}}",
|
||||
|
||||
@@ -180,7 +183,7 @@ struct Crash {
|
||||
// CHECK-NEXT: "description": "static Crash.$main() + [[OFFSET]]",
|
||||
// CHECK-NEXT: "image": "Crash",
|
||||
// CHECK-NEXT: "sourceLocation": {
|
||||
// CHECK-NEXT: "file": "{{/?}}<compiler-generated>",
|
||||
// CHECK-NEXT: "file": "{{/*}}<compiler-generated>",
|
||||
// CHECK-NEXT: "line": 0,
|
||||
// CHECK-NEXT: "column": 0
|
||||
// CHECK-NEXT: }
|
||||
@@ -218,8 +221,8 @@ struct Crash {
|
||||
// Maybe multiple images before this one
|
||||
|
||||
// CHECK: "name": "Crash",
|
||||
// CHECK-NEXT: "buildId": "{{([0-9a-f][0-9a-f])+}}",
|
||||
// CHECK-NEXT: "path": "{{.*}}/Crash",
|
||||
// "buildId": ... is optional
|
||||
// CHECK: "path": "{{.*}}/Crash",
|
||||
// CHECK-NEXT: "baseAddress": "0x{{[0-9a-f]+}}",
|
||||
// CHECK-NEXT: "endOfText": "0x{{[0-9a-f]+}}"
|
||||
// CHECK-NEXT: }
|
||||
|
||||
@@ -166,7 +166,7 @@ struct JSONAsync {
|
||||
// CHECK-NEXT: "offset": [[OFFSET:[0-9]+]],
|
||||
// CHECK-NEXT: "image": "JSONAsync",
|
||||
// CHECK-NEXT: "sourceLocation": {
|
||||
// CHECK-NEXT: "file": "{{/?}}<compiler-generated>",
|
||||
// CHECK-NEXT: "file": "{{/*}}<compiler-generated>",
|
||||
// CHECK-NEXT: "line": 0,
|
||||
// CHECK-NEXT: "column": 0
|
||||
// CHECK-NEXT: }
|
||||
@@ -179,7 +179,7 @@ struct JSONAsync {
|
||||
// CHECK-NEXT: "offset": [[OFFSET:[0-9]+]],
|
||||
// CHECK-NEXT: "image": "JSONAsync",
|
||||
// CHECK-NEXT: "sourceLocation": {
|
||||
// CHECK-NEXT: "file": "{{/?}}<compiler-generated>",
|
||||
// CHECK-NEXT: "file": "{{/*}}<compiler-generated>",
|
||||
// CHECK-NEXT: "line": 0,
|
||||
// CHECK-NEXT: "column": 0
|
||||
// CHECK-NEXT: }
|
||||
@@ -206,8 +206,8 @@ struct JSONAsync {
|
||||
// Maybe multiple images before this one
|
||||
|
||||
// CHECK: "name": "JSONAsync",
|
||||
// CHECK-NEXT: "buildId": "{{([0-9a-f][0-9a-f])+}}",
|
||||
// CHECK-NEXT: "path": "{{.*}}/JSONAsync",
|
||||
// "buildId": ... is optional
|
||||
// CHECK: "path": "{{.*}}/JSONAsync",
|
||||
// CHECK-NEXT: "baseAddress": "0x{{[0-9a-f]+}}",
|
||||
// CHECK-NEXT: "endOfText": "0x{{[0-9a-f]+}}"
|
||||
// CHECK-NEXT: }
|
||||
|
||||
Reference in New Issue
Block a user