]> git.gag.com Git - fw/openocd/commitdiff
More robust handling of unknown target state for step/continue packet.
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 13 Apr 2008 13:29:33 +0000 (13:29 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 13 Apr 2008 13:29:33 +0000 (13:29 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@573 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/server/gdb_server.c

index 3e4ba8248acda76c14e0b73a656aad33c6a9143a..bd247b01cfbdb02012c8ae57ac5dbe65081d0910 100644 (file)
@@ -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':