This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patchv2 1/2] Workaround gdbserver<7.7 for setfs
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Gary Benson <gbenson at redhat dot com>
- Date: Thu, 24 Mar 2016 23:32:20 +0100
- Subject: [patchv2 1/2] Workaround gdbserver<7.7 for setfs
- Authentication-results: sourceware.org; auth=none
- References: <20160319201842 dot GA16540 at host1 dot jankratochvil dot net> <56F13963 dot 9040204 at redhat dot com> <20160322131604 dot GA24312 at host1 dot jankratochvil dot net> <56F14F1E dot 5010606 at redhat dot com> <20160323211547 dot GA17400 at host1 dot jankratochvil dot net> <20160324220933 dot GA27445 at host1 dot jankratochvil dot net>
There was a bug in patchv1.
gdb/ChangeLog
2016-03-24 Jan Kratochvil <jan.kratochvil@redhat.com>
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. */