diff options
author | Alistair Popple <alistair@popple.id.au> | 2018-08-09 17:10:58 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2018-08-09 17:10:58 +1000 |
commit | 7f0d7f29d39d19f553fb6b8ec1ac0cd8374c37a5 (patch) | |
tree | d0d29f3f9e9b88640b1aaf2e468883f84ac6f05b /libpdbg | |
parent | 272784c5a818f4382ab2a7d1cbb1b9329f20515c (diff) | |
download | pdbg-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.c | 2 |
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 |