diff options
author | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-03-07 21:49:16 +0000 |
---|---|---|
committer | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-03-07 21:49:16 +0000 |
commit | c78b4fe426c35f638e5575b59ec89d0e794263af (patch) | |
tree | a2f9b71545a8c90b2a91967f2d263238e456742a /src/server | |
parent | 29fc9b2596a4c92c5512d305b1addb4a8c224e26 (diff) | |
download | openocd+libswd-c78b4fe426c35f638e5575b59ec89d0e794263af.tar.gz openocd+libswd-c78b4fe426c35f638e5575b59ec89d0e794263af.tar.bz2 openocd+libswd-c78b4fe426c35f638e5575b59ec89d0e794263af.tar.xz openocd+libswd-c78b4fe426c35f638e5575b59ec89d0e794263af.zip |
- Improves error handling upon GDB connect
- switch to synchronous halt during connect. This fixes the bug
where poll() was not invoked between halt() and servicing the
'g' register packet
- halt() no longer returns error code when target is already halted, just
logs a warning. Only the halt() implementation can say anything
meaningful about why a halt() failed, so error messages are pushed
up to halt()
- fixed soft_reset_halt infinite loop bug in arm7_9_common.c. The rest
of the implementations are still busted.
- by using USER() instead of command_print() the log gets the
source + line #. Nice.
- no longer invoke exit() if soft_reset_halt fails. A reset can often
fix the problem.
git-svn-id: svn://svn.berlios.de/openocd/trunk@475 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/gdb_server.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 1fac4697..f01d638f 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -684,13 +684,19 @@ int gdb_new_connection(connection_t *connection) * GDB connection will fail if e.g. register read packets fail, * otherwise resetting/halting the target could have been left to GDB init * scripts + * + * DANGER!!!! + * We need a synchronous halt, lest connect will fail. + * Also there is no guarantee that poll() will be invoked + * between here and serving the first packet, so the halt() + * statement above is *NOT* sufficient */ - if (((retval = gdb_service->target->type->halt(gdb_service->target)) != ERROR_OK) && - (retval != ERROR_TARGET_ALREADY_HALTED)) + if ((retval = gdb_service->target->type->halt(gdb_service->target)) != ERROR_OK) { ERROR("error(%d) when trying to halt target, falling back to \"reset\"", retval); command_run_line(connection->cmd_ctx, "reset"); } + command_run_line(connection->cmd_ctx, "halt"); /* remove the initial ACK from the incoming buffer */ if ((retval = gdb_get_char(connection, &initial_ack)) != ERROR_OK) @@ -1462,6 +1468,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i log_add_callback(gdb_log_callback, connection); target_call_timer_callbacks(); command_run_line(cmd_ctx, cmd); + target_call_timer_callbacks(); log_remove_callback(gdb_log_callback, connection); free(cmd); } |