David Brownell <david-b@pacbell.net>More Thumb2 disassembly:
[openocd.git] / src / server / gdb_server.c
index 008971535280fbd24d44212125337305222d7011..48144f2665a3048b6d81398c8cbc9d21df8615af 100644 (file)
@@ -2,7 +2,7 @@
  *   Copyright (C) 2005 by Dominic Rath                                    *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
- *   Copyright (C) 2007,2008 Øyvind Harboe                                 *
+ *   Copyright (C) 2007,2008 Øyvind Harboe                                 *
  *   oyvind.harboe@zylin.com                                               *
  *                                                                         *
  *   Copyright (C) 2008 by Spencer Oliver                                  *
@@ -319,7 +319,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                        break;
                if ((retval = gdb_get_char(connection, &reply)) != ERROR_OK)
                        return retval;
-               if (reply == '$'){
+               if (reply == '$') {
                        /* fix a problem with some IAR tools */
                        gdb_putback_char(connection, reply);
                        LOG_DEBUG("Unexpected start of new packet");
@@ -402,7 +402,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                                log_remove_callback(gdb_log_callback, connection);
                                LOG_WARNING("negative reply, retrying");
                        }
-                       else if (reply == '$'){
+                       else if (reply == '$') {
                                LOG_ERROR("GDB missing ack(1) - assumed good");
                                gdb_putback_char(connection, reply);
                                return ERROR_OK;
@@ -413,7 +413,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                                return ERROR_SERVER_REMOTE_CLOSED;
                        }
                }
-               else if (reply == '$'){
+               else if (reply == '$') {
                        LOG_ERROR("GDB missing ack(2) - assumed good");
                        gdb_putback_char(connection, reply);
                        return ERROR_OK;
@@ -671,7 +671,7 @@ static void gdb_frontend_halted(struct target_s *target, connection_t *connectio
 {
        gdb_connection_t *gdb_connection = connection->priv;
 
-       /* In the GDB protocol when we are stepping or coninuing execution,
+       /* In the GDB protocol when we are stepping or continuing execution,
         * we have a lingering reply. Upon receiving a halted event
         * when we have that lingering packet, we reply to the original
         * step or continue packet.
@@ -803,6 +803,10 @@ int gdb_new_connection(connection_t *connection)
        target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_ATTACH);
 
        gdb_actual_connections++;
+       LOG_DEBUG("New GDB Connection: %d, Target %s, state: %s",
+                 gdb_actual_connections,
+                 gdb_service->target->cmd_name,
+                 target_state_name(gdb_service->target));
 
        return ERROR_OK;
 }
@@ -812,7 +816,16 @@ int gdb_connection_closed(connection_t *connection)
        gdb_service_t *gdb_service = connection->service->priv;
        gdb_connection_t *gdb_connection = connection->priv;
 
+       /* we're done forwarding messages. Tear down callback before
+        * cleaning up connection.
+        */
+       log_remove_callback(gdb_log_callback, connection);
+
        gdb_actual_connections--;
+       LOG_DEBUG("GDB Close, Target: %s, state: %s, gdb_actual_connections=%d", 
+                 gdb_service->target->cmd_name,
+                 target_state_name(gdb_service->target),
+                 gdb_actual_connections);
 
        /* see if an image built with vFlash commands is left */
        if (gdb_connection->vflash_image)
@@ -835,9 +848,10 @@ int gdb_connection_closed(connection_t *connection)
                LOG_ERROR("BUG: connection->priv == NULL");
        }
 
+
        target_unregister_event_callback(gdb_target_callback_event_handler, connection);
+
        target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_END);
-       log_remove_callback(gdb_log_callback, connection);
 
        target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_DETACH);
 
@@ -2036,12 +2050,12 @@ int gdb_input_inner(connection_t *connection)
                /* terminate with zero */
                packet[packet_size] = 0;
 
-               if (LOG_LEVEL_IS(LOG_LVL_DEBUG)){
-                       if (packet[0] == 'X'){
+               if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
+                       if (packet[0] == 'X') {
                                // binary packets spew junk into the debug log stream
                                char buf[ 50 ];
                                int x;
-                               for (x = 0 ; (x < 49) && (packet[x] != ':') ; x++){
+                               for (x = 0 ; (x < 49) && (packet[x] != ':') ; x++) {
                                        buf[x] = packet[x];
                                }
                                buf[x] = 0;
@@ -2242,9 +2256,7 @@ int handle_gdb_port_command(struct command_context_s *cmd_ctx, char *cmd, char *
                return ERROR_OK;
        }
 
-       /* only if the port wasn't overwritten by cmdline */
-       if (gdb_port == 0)
-               gdb_port = strtoul(args[0], NULL, 0);
+       gdb_port = strtoul(args[0], NULL, 0);
 
        return ERROR_OK;
 }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)