gdb/ChangeLog 2016-03-24 Jan Kratochvil Code cleanup. * remote.c (packet_ok): Move it after remote_protocol_packets. diff --git a/gdb/remote.c b/gdb/remote.c index af0a08a..bb027cf 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1301,59 +1301,6 @@ packet_check_result (const char *buf) return PACKET_UNKNOWN; } -static enum packet_result -packet_ok (const char *buf, struct packet_config *config) -{ - enum packet_result result; - - if (config->detect != AUTO_BOOLEAN_TRUE - && config->support == PACKET_DISABLE) - internal_error (__FILE__, __LINE__, - _("packet_ok: attempt to use a disabled packet")); - - result = packet_check_result (buf); - switch (result) - { - case PACKET_OK: - case PACKET_ERROR: - /* The stub recognized the packet request. */ - if (config->support == PACKET_SUPPORT_UNKNOWN) - { - if (remote_debug) - fprintf_unfiltered (gdb_stdlog, - "Packet %s (%s) is supported\n", - config->name, config->title); - config->support = PACKET_ENABLE; - } - break; - case PACKET_UNKNOWN: - /* The stub does not support the packet. */ - if (config->detect == AUTO_BOOLEAN_AUTO - && config->support == PACKET_ENABLE) - { - /* If the stub previously indicated that the packet was - supported then there is a protocol error. */ - error (_("Protocol error: %s (%s) conflicting enabled responses."), - config->name, config->title); - } - else if (config->detect == AUTO_BOOLEAN_TRUE) - { - /* The user set it wrong. */ - error (_("Enabled packet %s (%s) not recognized by stub"), - config->name, config->title); - } - - if (remote_debug) - fprintf_unfiltered (gdb_stdlog, - "Packet %s (%s) is NOT supported\n", - config->name, config->title); - config->support = PACKET_DISABLE; - break; - } - - return result; -} - enum { PACKET_vCont = 0, PACKET_X, @@ -1496,6 +1443,59 @@ enum { static struct packet_config remote_protocol_packets[PACKET_MAX]; +static enum packet_result +packet_ok (const char *buf, struct packet_config *config) +{ + enum packet_result result; + + if (config->detect != AUTO_BOOLEAN_TRUE + && config->support == PACKET_DISABLE) + internal_error (__FILE__, __LINE__, + _("packet_ok: attempt to use a disabled packet")); + + result = packet_check_result (buf); + switch (result) + { + case PACKET_OK: + case PACKET_ERROR: + /* The stub recognized the packet request. */ + if (config->support == PACKET_SUPPORT_UNKNOWN) + { + if (remote_debug) + fprintf_unfiltered (gdb_stdlog, + "Packet %s (%s) is supported\n", + config->name, config->title); + config->support = PACKET_ENABLE; + } + break; + case PACKET_UNKNOWN: + /* The stub does not support the packet. */ + if (config->detect == AUTO_BOOLEAN_AUTO + && config->support == PACKET_ENABLE) + { + /* If the stub previously indicated that the packet was + supported then there is a protocol error. */ + error (_("Protocol error: %s (%s) conflicting enabled responses."), + config->name, config->title); + } + else if (config->detect == AUTO_BOOLEAN_TRUE) + { + /* The user set it wrong. */ + error (_("Enabled packet %s (%s) not recognized by stub"), + config->name, config->title); + } + + if (remote_debug) + fprintf_unfiltered (gdb_stdlog, + "Packet %s (%s) is NOT supported\n", + config->name, config->title); + config->support = PACKET_DISABLE; + break; + } + + return result; +} + /* Returns the packet's corresponding "set remote foo-packet" command state. See struct packet_config for more details. */