[Pdbg] [PATCH v2] libpdbg: Attempt to restore registers that we clobbered on failure

Rashmica Gupta rashmica.g at gmail.com
Wed Jun 6 17:14:39 AEST 2018


---
v1 -> v2 print out variables properly...

 libpdbg/chip.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 6d0b47e..cb92de1 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -266,9 +266,13 @@ static int ram_instructions(struct pdbg_target *thread_target, uint64_t *opcodes
 		}
 
 		if (thread->ram_instruction(thread, opcode, &scratch)) {
-			PR_DEBUG("%s: %d\n", __FUNCTION__, __LINE__);
+			PR_DEBUG("%s: %d, %016" PRIx64 "\n", __FUNCTION__, __LINE__, opcode);
 			exception = 1;
-			break;
+			if (i >= 0 || i < len)
+				/* skip the rest and attempt to restore r0 and r1 */
+				i = len - 1;
+			else
+				break;
 		}
 
 		if (i == -2)
-- 
2.14.4



More information about the Pdbg mailing list