From: Keith Packard Date: Mon, 2 Mar 2009 02:43:03 +0000 (-0800) Subject: Sometimes the link breaks and the GET_PC command returns garbage X-Git-Tag: 0.5~58^2~68 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=f7d91bd23b8214e09deae0aafb516331e934c49b;ds=sidebyside Sometimes the link breaks and the GET_PC command returns garbage --- 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