Skip to content

Commit aa59bce

Browse files
authored
Merge pull request #1521 from ucgJhe/qdb
Qdb bug fix missing function `handle_bnj_arm`
2 parents 6c1d77c + d0cd4ea commit aa59bce

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

qiling/debugger/qdb/branch_predictor/branch_predictor_arm.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ def get_cpsr(bits: int) -> (bool, bool, bool, bool):
4040
bits & 0x80000000 != 0, # N, sign flag
4141
)
4242

43-
def predict(self):
43+
def predict(self, pref_addr=None):
4444
prophecy = self.Prophecy()
45-
cur_addr = self.cur_addr
45+
cur_addr = self.cur_addr if pref_addr is None else pref_addr
4646
line = self.disasm(cur_addr)
4747

48-
prophecy.where = cur_addr + line.size
49-
5048
if line.mnemonic == self.CODE_END: # indicates program exited
5149
prophecy.where = True
5250
return prophecy
@@ -160,7 +158,7 @@ def predict(self):
160158
next_addr = cur_addr + self.THUMB_INST_SIZE
161159
for each in it_block_range:
162160
_insn = self.read_insn(next_addr)
163-
n2_addr = handle_bnj_arm(ql, next_addr)
161+
n2_addr = self.predict(ql, next_addr)
164162

165163
if (cond_met and each == "t") or (not cond_met and each == "e"):
166164
if n2_addr != (next_addr+len(_insn)): # branch detected

0 commit comments

Comments
 (0)