diff options
author | Keith Packard <keithp@keithp.com> | 2009-03-01 18:43:03 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-03-01 18:43:03 -0800 |
commit | f7d91bd23b8214e09deae0aafb516331e934c49b (patch) | |
tree | b13ae9bf8b3f7cb8a6aae5ebb6b3eacda01bba68 /lib/ccdbg-command.c | |
parent | 3cc8d11eb8d5d0b42141dd84a58d461287f59e3a (diff) |
Sometimes the link breaks and the GET_PC command returns garbage
Diffstat (limited to 'lib/ccdbg-command.c')
-rw-r--r-- | lib/ccdbg-command.c | 9 |
1 files changed, 8 insertions, 1 deletions
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 |