gdb_server: suggest user to prefer GDB extended mode
[fw/openocd] / src / server / gdb_server.c
index 0e0b595c6982cccd1e20e9fe5e34a22709526715..17042fbf5ea350a0a886904da0ff358de8378c68 100644 (file)
@@ -3228,6 +3228,7 @@ static int gdb_input_inner(struct connection *connection)
        int packet_size;
        int retval;
        struct gdb_connection *gdb_con = connection->priv;
+       static bool warn_use_ext;
 
        target = get_target_from_connection(connection);
 
@@ -3304,6 +3305,12 @@ static int gdb_input_inner(struct connection *connection)
                                        break;
                                case '?':
                                        gdb_last_signal_packet(connection, packet, packet_size);
+                                       /* '?' is sent after the eventual '!' */
+                                       if (!warn_use_ext && !gdb_con->extended_protocol) {
+                                               warn_use_ext = true;
+                                               LOG_WARNING("Prefer GDB command \"target extended-remote %s\" instead of \"target remote %s\"",
+                                                                       connection->service->port, connection->service->port);
+                                       }
                                        break;
                                case 'c':
                                case 's':