Skip to content

[lldb] Support Rosetta registers in crashlog.py #3863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lldb/examples/python/crashlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,13 @@ def parse_threads(self, json_threads):
def parse_thread_registers(self, json_thread_state):
registers = dict()
for key, state in json_thread_state.items():
if key == "rosetta":
registers.update(self.parse_thread_registers(state))
continue
try:
value = int(state['value'])
registers[key] = value
except (TypeError, ValueError):
except (KeyError, ValueError, TypeError):
pass
return registers

Expand Down
11 changes: 11 additions & 0 deletions lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@
"rcx": {
"value": 140732860114656
},
"rosetta": {
"tmp2": {
"value": 8
},
"tmp1": {
"value": 20
},
"tmp0": {
"value": 92
}
},
"flavor": "x86_THREAD_STATE",
"rdi": {
"value": 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
# CHECK: [ 1] {{.*}}out`bar + 8 at test.c
# CHECK: [ 2] {{.*}}out`main + 19 at test.c
# CHECK: rbp = 0x00007ffeec22a530
# CHECK: tmp2 = 0x0000000000000008
# CHECK: invalid foo
# CHECK: invalid bar