summaryrefslogtreecommitdiffstats
path: root/libpdbg
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2018-08-09 17:10:58 +1000
committerAlistair Popple <alistair@popple.id.au>2018-08-09 17:10:58 +1000
commit7f0d7f29d39d19f553fb6b8ec1ac0cd8374c37a5 (patch)
treed0d29f3f9e9b88640b1aaf2e468883f84ac6f05b /libpdbg
parent272784c5a818f4382ab2a7d1cbb1b9329f20515c (diff)
downloadpdbg-7f0d7f29d39d19f553fb6b8ec1ac0cd8374c37a5.tar.gz
pdbg-7f0d7f29d39d19f553fb6b8ec1ac0cd8374c37a5.zip
libpdbg/chip.c: Fix logic error attempting to restore r0 and r1
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@popple.id.au>
Diffstat (limited to 'libpdbg')
-rw-r--r--libpdbg/chip.c2
1 files changed, 1 insertions, 1 deletions
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
OpenPOWER on IntegriCloud