Skip to content

Commit 07cf183

Browse files
committed
[lldb] Support Rosetta registers in crashlog.py
Rosetta crashlogs can have their own thread register state. Unlike the other registers which ware directly listed under "threadState", the Rosetta registers are nested under their own key in the JSON, as illustrated below: { "threadState": { "rosetta": { "tmp2": { "value": 4935057216 }, "tmp1": { "value": 4365863188 }, "tmp0": { "value": 18446744073709551615 } } } } (cherry picked from commit e1cad13)
1 parent 1893335 commit 07cf183

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

lldb/examples/python/crashlog.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,13 @@ def parse_threads(self, json_threads):
523523
def parse_thread_registers(self, json_thread_state):
524524
registers = dict()
525525
for key, state in json_thread_state.items():
526+
if key == "rosetta":
527+
registers.update(self.parse_thread_registers(state))
528+
continue
526529
try:
527530
value = int(state['value'])
528531
registers[key] = value
529-
except (TypeError, ValueError):
532+
except (KeyError, ValueError, TypeError):
530533
pass
531534
return registers
532535

lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,17 @@
106106
"rcx": {
107107
"value": 140732860114656
108108
},
109+
"rosetta": {
110+
"tmp2": {
111+
"value": 8
112+
},
113+
"tmp1": {
114+
"value": 20
115+
},
116+
"tmp0": {
117+
"value": 92
118+
}
119+
},
109120
"flavor": "x86_THREAD_STATE",
110121
"rdi": {
111122
"value": 1

lldb/test/Shell/ScriptInterpreter/Python/Crashlog/json.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
# CHECK: [ 1] {{.*}}out`bar + 8 at test.c
1414
# CHECK: [ 2] {{.*}}out`main + 19 at test.c
1515
# CHECK: rbp = 0x00007ffeec22a530
16+
# CHECK: tmp2 = 0x0000000000000008
1617
# CHECK: invalid foo
1718
# CHECK: invalid bar

0 commit comments

Comments
 (0)