From: Øyvind H. <go...@us...> - 2009-10-12 09:29:26
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "". The branch, master has been updated via 3e6512fe5708d2b38e01dcab7246ac01b994d5a3 (commit) via 9ccdc02b8d6d5aebd948626a95e942504b6a21fc (commit) via 6b72f2486be59dbfea53e511aaf1adfb5fa68f05 (commit) from 6451563ce849929e43de1c3d72359846c8141375 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3e6512fe5708d2b38e01dcab7246ac01b994d5a3 Merge: 9ccdc02 6451563 Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Oct 12 09:28:56 2009 +0200 Merge commit 'origin/master' commit 9ccdc02b8d6d5aebd948626a95e942504b6a21fc Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Oct 12 09:27:27 2009 +0200 If halt times out, stop GDB. Allows e.g. manual reset via monitor commands. diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 00de5fc..ad09a0e 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2194,10 +2194,13 @@ int gdb_input_inner(connection_t *connection) retval = target_halt(target); if (retval != ERROR_OK) { - /* stop this debug session */ target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT); } gdb_con->ctrl_c = 0; + } else + { + LOG_INFO("The target is not running when halt was requested, stopping GDB."); + target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT); } } diff --git a/src/target/target.c b/src/target/target.c index ced09e9..8bb9371 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -378,24 +378,57 @@ target_t* get_current_target(command_context_t *cmd_ctx) int target_poll(struct target_s *target) { + int retval; + /* We can't poll until after examine */ if (!target_was_examined(target)) { /* Fail silently lest we pollute the log */ return ERROR_FAIL; } - return target->type->poll(target); + + retval = target->type->poll(target); + if (retval != ERROR_OK) + return retval; + + if (target->halt_issued) + { + if (target->state == TARGET_HALTED) + { + target->halt_issued = false; + } else + { + long long t = timeval_ms() - target->halt_issued_time; + if (t>1000) + { + target->halt_issued = false; + LOG_INFO("Halt timed out, wake up GDB."); + target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT); + } + } + } + + return ERROR_OK; } int target_halt(struct target_s *target) { + int retval; /* We can't poll until after examine */ if (!target_was_examined(target)) { LOG_ERROR("Target not examined yet"); return ERROR_FAIL; } - return target->type->halt(target); + + retval = target->type->halt(target); + if (retval != ERROR_OK) + return retval; + + target->halt_issued = true; + target->halt_issued_time = timeval_ms(); + + return ERROR_OK; } int target_resume(struct target_s *target, int current, uint32_t address, int handle_breakpoints, int debug_execution) @@ -4236,6 +4269,8 @@ static int target_create(Jim_GetOptInfo *goi) target->display = 1; + target->halt_issued = false; + /* initialize trace information */ target->trace_info = malloc(sizeof(trace_t)); target->trace_info->num_trace_points = 0; diff --git a/src/target/target.h b/src/target/target.h index 6547d4d..0f8be6f 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -148,6 +148,8 @@ typedef struct target_s int display; /* display async info in telnet session. Do not display * lots of halted/resumed info when stepping in debugger. */ + bool halt_issued; /* did we transition to halted state? */ + long long halt_issued_time; /* Note time when halt was issued */ } target_t; enum target_event commit 6b72f2486be59dbfea53e511aaf1adfb5fa68f05 Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Oct 12 09:25:08 2009 +0200 Supply default reset_config statement to make target scripts useful standalone and provide sensible default diff --git a/tcl/target/imx31.cfg b/tcl/target/imx31.cfg index ad99975..f579d6e 100644 --- a/tcl/target/imx31.cfg +++ b/tcl/target/imx31.cfg @@ -1,7 +1,7 @@ # imx31 config # -reset_config trst_and_srst +reset_config trst_and_srst srst_nogate if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME diff --git a/tcl/target/imx35.cfg b/tcl/target/imx35.cfg index 446eef6..800e142 100644 --- a/tcl/target/imx35.cfg +++ b/tcl/target/imx35.cfg @@ -1,6 +1,9 @@ # imx35 config # +reset_config trst_and_srst srst_nogate + + if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME } else { ----------------------------------------------------------------------- Summary of changes: src/server/gdb_server.c | 5 ++++- src/target/target.c | 39 +++++++++++++++++++++++++++++++++++++-- src/target/target.h | 2 ++ tcl/target/imx31.cfg | 2 +- tcl/target/imx35.cfg | 3 +++ 5 files changed, 47 insertions(+), 4 deletions(-) hooks/post-receive -- |