aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/Shell/ScriptInterpreter/Python/Crashlog
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2021-10-07 11:35:56 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2021-10-07 15:53:52 -0700
commitb913065bf470bcaf1ee8ff8b6a647b877110a4ba (patch)
tree2346e4e567ae592d617299f15d800fa92ec27fb6 /lldb/test/Shell/ScriptInterpreter/Python/Crashlog
parent690da88a9585542a2205e137aaeb44c79ec63950 (diff)
downloadllvm-b913065bf470bcaf1ee8ff8b6a647b877110a4ba.zip
llvm-b913065bf470bcaf1ee8ff8b6a647b877110a4ba.tar.gz
llvm-b913065bf470bcaf1ee8ff8b6a647b877110a4ba.tar.bz2
[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
Diffstat (limited to 'lldb/test/Shell/ScriptInterpreter/Python/Crashlog')
-rw-r--r--lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/no_threadState.ips104
-rw-r--r--lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no_threadState.test11
2 files changed, 115 insertions, 0 deletions
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/no_threadState.ips b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/no_threadState.ips
new file mode 100644
index 0000000..925e6cd
--- /dev/null
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/no_threadState.ips
@@ -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"
+ }
+}
+}
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no_threadState.test b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no_threadState.test
new file mode 100644
index 0000000..4092efe
--- /dev/null
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no_threadState.test
@@ -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