From 402eceda1b5b5d35d615d7cdc213d0c81e9c4a61 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Fri, 14 Jun 2024 15:46:55 +0800 Subject: [PATCH] Arm32: Allow ldmia sp!, {..., pc} as function return On Armv7 I commonly write pop {..., pc} to return from a function; the itrace script currently doesn't handle that and it just keeps tracing after the return from the function. I added the ldmia here. --- scripts/itrace.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/itrace.py b/scripts/itrace.py index be2a5964..f438dd05 100755 --- a/scripts/itrace.py +++ b/scripts/itrace.py @@ -169,7 +169,7 @@ def getEA(self, insn, frame): return {'addr':addr} class ARM32(Extractor): - branchpattern = re.compile(r'^(b(?!f)\w*|cbn?z)\b') + branchpattern = re.compile(r'^(b(?!f)\w*|cbn?z|ldmia.*pc)\b') eapattern = re.compile(r'(?:\[([a-z]+[0-9]*)' '(?:\s*,\s*([a-z0-9]+|#-?(?:0x)?[0-9a-fA-F]+)|\s*:\d+)?''\]' '|(?:ld|st)m\w*\.?\w*\s+(\w+)!?,)') @@ -187,6 +187,8 @@ def isFunctionCall(self, b): return b.group(1).startswith("bl") def isFunctionReturn(self, b): + if "ldmia" in b.group(1) and "pc" in b.group(1): + return True return b.group(1) == "bx" def getEA(self, insn, frame):