[Lldb-commits] [PATCH] D119168: [lldb/crashlog] Fix arm64 register parsing on crashlog.py

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 7 11:22:08 PST 2022


mib created this revision.
mib added a reviewer: JDevlieghere.
mib added a project: LLDB.
Herald added subscribers: omjavaid, pengfei, kristof.beyls.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

This patch fixes the register parser for arm64 crashlogs.

Compared to x86_64 crashlogs, the arm64 crashlogs nests the general
purpose registers into a separate dictionary within `thread_state`
dictionary. It uses the dictionary key as the the register number.

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119168

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -521,6 +521,15 @@
 
     def parse_thread_registers(self, json_thread_state):
         registers = dict()
+
+        if json_thread_state['flavor'] == "ARM_THREAD_STATE64":
+            for idx, state in enumerate(json_thread_state['x']):
+                try:
+                    value = int(state['value'])
+                    registers['x' + str(idx)] = value
+                except (TypeError, ValueError):
+                    pass
+
         for key, state in json_thread_state.items():
             try:
                value = int(state['value'])


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119168.406540.patch
Type: text/x-patch
Size: 743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220207/31283459/attachment.bin>


More information about the lldb-commits mailing list