summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-04-13 13:29:33 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-04-13 13:29:33 +0000
commitf62ba3550762cded4a857e2c2763b3c2f6436e5d (patch)
treef890713f20a1fa4583dc3faf0d37053b9647620d
parent7280d4a2c74f444e81d5a2df8b77a2f184f5e6d1 (diff)
downloadopenocd+libswd-f62ba3550762cded4a857e2c2763b3c2f6436e5d.tar.gz
openocd+libswd-f62ba3550762cded4a857e2c2763b3c2f6436e5d.tar.bz2
openocd+libswd-f62ba3550762cded4a857e2c2763b3c2f6436e5d.tar.xz
openocd+libswd-f62ba3550762cded4a857e2c2763b3c2f6436e5d.zip
More robust handling of unknown target state for step/continue packet.
git-svn-id: svn://svn.berlios.de/openocd/trunk@573 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/server/gdb_server.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 3e4ba824..bd247b01 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -1855,12 +1855,24 @@ int gdb_input_inner(connection_t *connection)
case 'c':
case 's':
{
- /* We're running/stepping, in which case we can
- * forward log output until the target is halted */
- gdb_connection_t *gdb_con = connection->priv;
- gdb_con->frontend_state = TARGET_RUNNING;
- log_add_callback(gdb_log_callback, connection);
- gdb_step_continue_packet(connection, target, packet, packet_size);
+ if (target->state != TARGET_HALTED)
+ {
+ /* If the target isn't in the halted state, then we can't
+ * step/continue. This might be early setup, etc.
+ */
+ char sig_reply[4];
+ snprintf(sig_reply, 4, "T%2.2x", 2);
+ gdb_put_packet(connection, sig_reply, 3);
+ } else
+ {
+ /* We're running/stepping, in which case we can
+ * forward log output until the target is halted
+ */
+ gdb_connection_t *gdb_con = connection->priv;
+ gdb_con->frontend_state = TARGET_RUNNING;
+ log_add_callback(gdb_log_callback, connection);
+ gdb_step_continue_packet(connection, target, packet, packet_size);
+ }
}
break;
case 'v':