From f7d91bd23b8214e09deae0aafb516331e934c49b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 1 Mar 2009 18:43:03 -0800 Subject: [PATCH] Sometimes the link breaks and the GET_PC command returns garbage --- lib/ccdbg-command.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ccdbg-command.c b/lib/ccdbg-command.c index 2b29fdee..d99e8ff3 100644 --- a/lib/ccdbg-command.c +++ b/lib/ccdbg-command.c @@ -70,7 +70,14 @@ ccdbg_rd_config(struct ccdbg *dbg) uint16_t ccdbg_get_pc(struct ccdbg *dbg) { - return ccdbg_cmd_write_read16(dbg, CC_GET_PC, NULL, 0); + uint16_t pc1, pc2; + + pc1 = ccdbg_cmd_write_read16(dbg, CC_GET_PC, NULL, 0); + pc2 = ccdbg_cmd_write_read16(dbg, CC_GET_PC, NULL, 0); + if (pc1 != pc2) + fprintf (stderr, "Invalid pc %04x != %04x\n", + pc1, pc2); + return pc2; } uint8_t -- 2.30.2