Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lldb] Support missing threadState in JSON crashlogs
Gracefully deal with JSON crashlogs that don't have thread state available and print an error saying as much: "No thread state (register information) available". rdar://83955858 Differential revision: https://reviews.llvm.org/D111341
- Loading branch information
1 parent
690da88
commit b913065
Showing
3 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/no_threadState.ips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{"app_name":"json.test.tmp.out","timestamp":"2021-03-08 13:57:06.00 -0800","app_version":"","slice_uuid":"8f528c10-3e80-3dd6-b0be-5d558f64f7ab","build_version":"","platform":1,"share_with_app_devs":1,"is_first_party":1,"etl_key":"3","bug_type":"309","os_version":"macOS 11.3","incident_id":"FA21DF23-3344-4E45-BF27-4B8E63B7012B","name":"json.test.tmp.out"} | ||
{ | ||
"uptime" : 320000, | ||
"procLaunch" : "2021-03-08 13:56:51.7232 -0800", | ||
"procRole" : "Unspecified", | ||
"version" : 2, | ||
"exception" : { | ||
"type" : "EXC_BAD_ACCESS", | ||
"signal" : "SIGSEGV", | ||
"subtype" : "KERN_INVALID_ADDRESS at 0x0000000000000000" | ||
}, | ||
"userID" : 501, | ||
"modelCode" : "iMacPro1,1", | ||
"coalitionID" : 6086, | ||
"osVersion" : { | ||
"train" : "macOS 11.3", | ||
"build" : "", | ||
"releaseType" : "" | ||
}, | ||
"captureTime" : "2021-03-08 13:56:51.8610 -0800", | ||
"incident" : "FA21DF23-3344-4E45-BF27-4B8E63B7012B", | ||
"pid" : 72932, | ||
"cpuType" : "X86-64", | ||
"procName" : "json.test.tmp.out", | ||
"procPath" : "\/Users\/USER\/*\/json.test.tmp.out", | ||
"parentProc" : "fish", | ||
"parentPid" : 67002, | ||
"coalitionName" : "io.alacritty", | ||
"crashReporterKey" : "DCEF35CB-68D5-F524-FF13-060901F52EA8", | ||
"responsiblePid" : 65465, | ||
"responsibleProc" : "alacritty", | ||
"bridgeVersion" : {"build":"18P4544","train":"5.3"}, | ||
"sip" : "enabled", | ||
"isCorpse" : 1, | ||
"termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":72932}, | ||
"asi" : {"dyld":["dyld2 mode"]}, | ||
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":125361,"task_for_pid":9935},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0}, | ||
"faultingThread" : 0, | ||
"threads" : [ | ||
{ | ||
"triggered": true, | ||
"id": 6152004, | ||
"name": "Crashing Thread Name", | ||
"queue": "com.apple.main-thread", | ||
"frames": [ | ||
{ | ||
"imageOffset": @foo@, | ||
"sourceLine": 3, | ||
"sourceFile": "test.c", | ||
"symbol": "foo", | ||
"imageIndex": 0, | ||
"symbolLocation": 16 | ||
}, | ||
{ | ||
"imageOffset": @bar@, | ||
"sourceLine": 6, | ||
"sourceFile": "test.c", | ||
"symbol": "bar", | ||
"imageIndex": 0, | ||
"symbolLocation": 9 | ||
}, | ||
{ | ||
"imageOffset": @main@, | ||
"sourceLine": 8, | ||
"sourceFile": "test.c", | ||
"symbol": "main", | ||
"imageIndex": 0, | ||
"symbolLocation": 20 | ||
}, | ||
{ | ||
"imageOffset": 89917, | ||
"symbol": "start", | ||
"symbolLocation": 1, | ||
"imageIndex": 1 | ||
} | ||
] | ||
} | ||
], | ||
"usedImages" : [ | ||
{ | ||
"source" : "P", | ||
"arch" : "x86_64", | ||
"base" : 4355608576, | ||
"size" : 16384, | ||
"uuid" : "@UUID@", | ||
"path" : "@EXEC@", | ||
"name" : "@NAME@" | ||
}, | ||
{ | ||
"source" : "P", | ||
"arch" : "x86_64", | ||
"base" : 140733734899712, | ||
"size" : 245760, | ||
"uuid" : "c5caf30b-0617-3b07-88c7-6319cd06f30a", | ||
"path" : "\/usr\/lib\/system\/libdyld.dylib", | ||
"name" : "libdyld.dylib" | ||
} | ||
], | ||
"legacyInfo" : { | ||
"threadTriggered" : { | ||
"queue" : "com.apple.main-thread" | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no_threadState.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# RUN: %clang_host -g %S/Inputs/test.c -o %t.out | ||
|
||
# RUN: cp %S/Inputs/no_threadState.ips %t.crash | ||
# RUN: python %S/patch-crashlog.py --binary %t.out --crashlog %t.crash --offsets '{"main":20, "bar":9, "foo":16}' --json | ||
# RUN: %lldb %t.out -o 'command script import lldb.macosx.crashlog' -o 'crashlog %t.crash' 2>&1 | FileCheck %s | ||
|
||
# CHECK: Thread[0] Crashing Thread Name EXC_BAD_ACCESS (SIGSEGV) (KERN_INVALID_ADDRESS at 0x0000000000000000) | ||
# CHECK: [ 0] {{.*}}out`foo + 16 at test.c | ||
# CHECK: [ 1] {{.*}}out`bar + 8 at test.c | ||
# CHECK: [ 2] {{.*}}out`main + 19 at test.c | ||
# CHECK: No thread state (register information) available |