[lldb/crashlog] Make registers always available & fix x29/x30 parsing (#145104)
This patch addresses 2 issues: 1. It makes registers available on non-crashed threads all the time 2. It fixes arm64 registers parsing for registers that don't use the `x` prefix (`fp` -> `x29` / `lr` -> `x30`) --------- Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
This commit is contained in:
committed by
GitHub
parent
b7be8786af
commit
1db9afb102
@@ -777,10 +777,10 @@ class JSONCrashLogParser(CrashLogParser):
|
|||||||
if json_thread.get("triggered", False):
|
if json_thread.get("triggered", False):
|
||||||
self.crashlog.crashed_thread_idx = idx
|
self.crashlog.crashed_thread_idx = idx
|
||||||
thread.crashed = True
|
thread.crashed = True
|
||||||
if "threadState" in json_thread:
|
if "threadState" in json_thread:
|
||||||
thread.registers = self.parse_thread_registers(
|
thread.registers = self.parse_thread_registers(
|
||||||
json_thread["threadState"]
|
json_thread["threadState"]
|
||||||
)
|
)
|
||||||
if "queue" in json_thread:
|
if "queue" in json_thread:
|
||||||
thread.queue = json_thread.get("queue")
|
thread.queue = json_thread.get("queue")
|
||||||
self.parse_frames(thread, json_thread.get("frames", []))
|
self.parse_frames(thread, json_thread.get("frames", []))
|
||||||
|
|||||||
@@ -123,11 +123,6 @@ class CrashLogScriptedProcess(ScriptedProcess):
|
|||||||
|
|
||||||
class CrashLogScriptedThread(ScriptedThread):
|
class CrashLogScriptedThread(ScriptedThread):
|
||||||
def create_register_ctx(self):
|
def create_register_ctx(self):
|
||||||
if not self.has_crashed:
|
|
||||||
return dict.fromkeys(
|
|
||||||
[*map(lambda reg: reg["name"], self.register_info["registers"])], 0
|
|
||||||
)
|
|
||||||
|
|
||||||
if not self.backing_thread or not len(self.backing_thread.registers):
|
if not self.backing_thread or not len(self.backing_thread.registers):
|
||||||
return dict.fromkeys(
|
return dict.fromkeys(
|
||||||
[*map(lambda reg: reg["name"], self.register_info["registers"])], 0
|
[*map(lambda reg: reg["name"], self.register_info["registers"])], 0
|
||||||
@@ -135,8 +130,15 @@ class CrashLogScriptedThread(ScriptedThread):
|
|||||||
|
|
||||||
for reg in self.register_info["registers"]:
|
for reg in self.register_info["registers"]:
|
||||||
reg_name = reg["name"]
|
reg_name = reg["name"]
|
||||||
|
reg_alt_name = None
|
||||||
|
if "alt-name" in reg:
|
||||||
|
reg_alt_name = reg["alt-name"]
|
||||||
if reg_name in self.backing_thread.registers:
|
if reg_name in self.backing_thread.registers:
|
||||||
self.register_ctx[reg_name] = self.backing_thread.registers[reg_name]
|
self.register_ctx[reg_name] = self.backing_thread.registers[reg_name]
|
||||||
|
elif reg_alt_name and reg_alt_name in self.backing_thread.registers:
|
||||||
|
self.register_ctx[reg_name] = self.backing_thread.registers[
|
||||||
|
reg_alt_name
|
||||||
|
]
|
||||||
else:
|
else:
|
||||||
self.register_ctx[reg_name] = 0
|
self.register_ctx[reg_name] = 0
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
# REQUIRES: python, native && system-darwin
|
||||||
|
|
||||||
|
# RUN: mkdir -p %t.dir
|
||||||
|
# RUN: yaml2obj %S/Inputs/interactive_crashlog/multithread-test.yaml > %t.dir/multithread-test
|
||||||
|
# RUN: %lldb -o 'command script import lldb.macosx.crashlog' \
|
||||||
|
# RUN: -o 'crashlog -a -t %t.dir/multithread-test %S/Inputs/interactive_crashlog/multithread-test.ips' \
|
||||||
|
# RUN: -o "thread list" -o "bt all" -o "register read" 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands
|
||||||
|
|
||||||
|
# CHECK: (lldb) process status
|
||||||
|
# CHECK-NEXT: Process 22511 stopped
|
||||||
|
# CHECK-NEXT: * thread #3, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
|
||||||
|
# CHECK-NEXT: frame #0: 0x0000000100ec58f4 multithread-test`bar
|
||||||
|
|
||||||
|
# CHECK: (lldb) thread backtrace
|
||||||
|
# CHECK-NEXT: * thread #3, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
|
||||||
|
# CHECK-NEXT: * frame #0: 0x0000000100ec58f4 multithread-test`bar{{.*}} [artificial]
|
||||||
|
# CHECK-NEXT: frame #1: 0x0000000100ec591b multithread-test`foo{{.*}} [artificial]
|
||||||
|
# CHECK-NEXT: frame #2: 0x0000000100ec5a87 multithread-test`compute_pow{{.*}} [artificial]
|
||||||
|
|
||||||
|
# CHECK: (lldb) thread list
|
||||||
|
# CHECK-NEXT: Process 22511 stopped
|
||||||
|
# CHECK-NEXT: thread #1: tid = 0x23c7fe, 0x000000019cc40b84{{.*}}, queue = 'com.apple.main-thread'
|
||||||
|
# CHECK-NEXT: thread #2: tid = 0x23c800, 0x000000019cc42c9c{{.*}}
|
||||||
|
# CHECK-NEXT: * thread #3: tid = 0x23c801, 0x0000000100ec58f4 multithread-test`bar{{.*}}, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
|
||||||
|
|
||||||
|
# CHECK: (lldb) bt all
|
||||||
|
# CHECK: thread #1, queue = 'com.apple.main-thread'
|
||||||
|
# CHECK: frame #{{[0-9]+}}: 0x000000019cc40b84{{.*}} [artificial]
|
||||||
|
# CHECK: frame #{{[0-9]+}}: 0x0000000100ec5b3b multithread-test`main{{.*}} [artificial]
|
||||||
|
# CHECK: frame #{{[0-9]+}}: 0x00000002230f8da7{{.*}} [artificial]
|
||||||
|
# CHECK-NEXT: thread #2
|
||||||
|
# CHECK-NEXT: frame #0: 0x000000019cc42c9c{{.*}} [artificial]
|
||||||
|
# CHECK: frame #{{[0-9]+}}: 0x0000000100ec5957 multithread-test`call_and_wait{{.*}} [artificial]
|
||||||
|
# CHECK: frame #{{[0-9]+}}: 0x000000019cc7e06b{{.*}} [artificial]
|
||||||
|
# CHECK: frame #{{[0-9]+}}: 0x000000019cc78e2b{{.*}} [artificial]
|
||||||
|
# CHECK-NEXT:* thread #3, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
|
||||||
|
# CHECK-NEXT: * frame #0: 0x0000000100ec58f4 multithread-test`bar{{.*}} [artificial]
|
||||||
|
# CHECK-NEXT: frame #1: 0x0000000100ec591b multithread-test`foo{{.*}} [artificial]
|
||||||
|
# CHECK-NEXT: frame #2: 0x0000000100ec5a87 multithread-test`compute_pow{{.*}} [artificial]
|
||||||
|
# CHECK: frame #{{[0-9]+}}: 0x000000019cc7e06b{{.*}} [artificial]
|
||||||
|
# CHECK: frame #{{[0-9]+}}: 0x000000019cc78e2b{{.*}} [artificial]
|
||||||
|
|
||||||
|
# CHECK: (lldb) register read
|
||||||
|
# CHECK: General Purpose Registers:
|
||||||
|
# CHECK: x0 = 0x000000000000002a
|
||||||
|
# CHECK: x1 = 0x0000600001d291b0
|
||||||
|
# CHECK: x2 = 0x000000019cbbf000
|
||||||
|
# CHECK: x3 = 0x0000000000000000
|
||||||
|
# CHECK: x4 = 0x00000000000030a0
|
||||||
|
# CHECK: x5 = 0x00000000190008ff
|
||||||
|
# CHECK: x6 = 0x0000000000000000
|
||||||
|
# CHECK: x7 = 0x0000000000000000
|
||||||
|
# CHECK: x8 = 0x0000000000000001
|
||||||
|
# CHECK: x9 = 0x0000000000000000
|
||||||
|
# CHECK: x10 = 0xfffffffe634277cf
|
||||||
|
# CHECK: x11 = 0x0000010000000102
|
||||||
|
# CHECK: x12 = 0x0000010000000102
|
||||||
|
# CHECK: x13 = 0x0000010000000100
|
||||||
|
# CHECK: x14 = 0x0000010000000000
|
||||||
|
# CHECK: x15 = 0x0000000000000001
|
||||||
|
# CHECK: x16 = 0x000000019cc78ea8
|
||||||
|
# CHECK: x17 = 0x00000001fd0a7698
|
||||||
|
# CHECK: x18 = 0x0000000000000000
|
||||||
|
# CHECK: x19 = 0x000000016f04f000
|
||||||
|
# CHECK: x20 = 0x0000000000000000
|
||||||
|
# CHECK: x21 = 0x0000000000000000
|
||||||
|
# CHECK: x22 = 0x0000000000000000
|
||||||
|
# CHECK: x23 = 0x0000000000000000
|
||||||
|
# CHECK: x24 = 0x0000000000000000
|
||||||
|
# CHECK: x25 = 0x0000000000000000
|
||||||
|
# CHECK: x26 = 0x0000000000000000
|
||||||
|
# CHECK: x27 = 0x0000000000000000
|
||||||
|
# CHECK: x28 = 0x0000000000000000
|
||||||
|
# CHECK: x29 = 0x000000016f04ef00
|
||||||
|
# CHECK: x30 = 0x0000000100ec591c
|
||||||
|
# CHECK: sp = 0x000000016f04eee0
|
||||||
|
# CHECK: pc = 0x0000000100ec58f4
|
||||||
|
# CHECK: cpsr = 0x80001000
|
||||||
Reference in New Issue
Block a user