diff options
author | Hsiangkai Wang <hsiangkai@gmail.com> | 2013-03-06 09:39:52 +0800 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2013-08-07 21:01:43 +0000 |
commit | 399561eafa747e71202d00985206b65868142afb (patch) | |
tree | e4479569d46e3f0ac495f8078568eb518606b312 /src/target | |
parent | 0a4c8990c29e61fd0c2796486519cdb256b8da3b (diff) |
gdb_server: add target_debug_reason for program exit detection
Currently, there is no way to notify gdb that program has exited.
Add new target_debug_reason called DBG_REASON_EXIT to notify gdb
the condition has occured. If the debug reason is DBG_REASON_EXIT,
gdb_server will send 'W' packet to tell gdb the process has exited.
Change-Id: I7a371da292716a3e6ac4cc2c31b009a651fe047a
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1242
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/nds32.c | 8 | ||||
-rw-r--r-- | src/target/target.c | 1 | ||||
-rw-r--r-- | src/target/target.h | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/target/nds32.c b/src/target/nds32.c index c4bd63aa..50d6e3b9 100644 --- a/src/target/nds32.c +++ b/src/target/nds32.c @@ -1921,7 +1921,13 @@ int nds32_examine_debug_reason(struct nds32 *nds32) &instruction)) return ERROR_FAIL; - target->debug_reason = DBG_REASON_BREAKPOINT; + /* hit 'break 0x7FFF' */ + if ((instruction.info.opc_6 == 0x32) && + (instruction.info.sub_opc == 0xA) && + (instruction.info.imm == 0x7FFF)) { + target->debug_reason = DBG_REASON_EXIT; + } else + target->debug_reason = DBG_REASON_BREAKPOINT; } break; case NDS32_DEBUG_DATA_ADDR_WATCHPOINT_PRECISE: diff --git a/src/target/target.c b/src/target/target.c index 442f0d9f..1fe89eb4 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -228,6 +228,7 @@ static const Jim_Nvp nvp_target_debug_reason[] = { { .name = "watchpoint-and-breakpoint", .value = DBG_REASON_WPTANDBKPT }, { .name = "single-step" , .value = DBG_REASON_SINGLESTEP }, { .name = "target-not-halted" , .value = DBG_REASON_NOTHALTED }, + { .name = "program-exit" , .value = DBG_REASON_EXIT }, { .name = "undefined" , .value = DBG_REASON_UNDEFINED }, { .name = NULL, .value = -1 }, }; diff --git a/src/target/target.h b/src/target/target.h index ee282b19..44f382a2 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -83,7 +83,8 @@ enum target_debug_reason { DBG_REASON_WPTANDBKPT = 3, DBG_REASON_SINGLESTEP = 4, DBG_REASON_NOTHALTED = 5, - DBG_REASON_UNDEFINED = 6 + DBG_REASON_EXIT = 6, + DBG_REASON_UNDEFINED = 7, }; enum target_endianness { |