wait 500ms for target to halt upon connect.
[fw/openocd] / src / server / gdb_server.c
index cea5ad0db0046e8e4086dc66f84a6760e378ef2c..bbcff58c58b381b95ec350cfa08ade2595e05658 100644 (file)
@@ -509,6 +509,7 @@ int gdb_get_packet_inner(connection_t *connection, char *buffer, int *len)
                                my_checksum += character & 0xff;
                                buffer[count++] = character & 0xff;
                        }
+
                }
 
                *len = count;
@@ -678,6 +679,12 @@ int gdb_new_connection(connection_t *connection)
         * connect. 
         */
        target_halt(gdb_service->target);
+       /* FIX!!!! could extended-remote work better here?
+        * 
+        *  wait a tiny bit for halted state or we just continue. The
+        * GDB register packet will then contain garbage 
+        */
+       target_wait_state(gdb_service->target, TARGET_HALTED, 500);
        
        /* remove the initial ACK from the incoming buffer */
        if ((retval = gdb_get_char(connection, &initial_ack)) != ERROR_OK)