[Pdbg] [PATCH] libpdbg/chip.c: Fix logic error attempting to restore r0 and r1
Alistair Popple
alistair at popple.id.au
Mon Aug 13 15:11:36 AEST 2018
When instruction ramming fails we attempt to restore r0 and r1. This is
unlikely to work as instruction ramming isn't likely to magically start
working if a previous attempt failed. Therefore it is only attempted once
before bailing. However a logic bug in the code meant it would try
indefinitely.
Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
libpdbg/chip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 079592c..5acda73 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -188,7 +188,7 @@ static int ram_instructions(struct pdbg_target *thread_target, uint64_t *opcodes
if (thread->ram_instruction(thread, opcode, &scratch)) {
PR_DEBUG("%s: %d, %016" PRIx64 "\n", __FUNCTION__, __LINE__, opcode);
exception = 1;
- if (i >= 0 || i < len)
+ if (i >= 0 && i < len)
/* skip the rest and attempt to restore r0 and r1 */
i = len - 1;
else
--
2.11.0
More information about the Pdbg
mailing list