• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Révisionec1b7090bba48a7a03355b7f76609b58d89c3887 (tree)
l'heure2006-04-01 03:15:57
AuteurDaniel Jacobowitz <drow@fals...>
CommiterDaniel Jacobowitz

Message de Log

qPacketInfo support for the branch (pending for mainline)

Change Summary

Modification

--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -189,8 +189,21 @@ static void show_packet_config_cmd (struct packet_config *config);
189189
190190 static void update_packet_config (struct packet_config *config);
191191
192+static void set_remote_protocol_packet_cmd (char *args, int from_tty,
193+ struct cmd_list_element *c);
194+
195+static void show_remote_protocol_packet_cmd (struct ui_file *file,
196+ int from_tty,
197+ struct cmd_list_element *c,
198+ const char *value);
199+
192200 void _initialize_remote (void);
193201
202+/* For "set remote" and "show remote". */
203+
204+static struct cmd_list_element *remote_set_cmdlist;
205+static struct cmd_list_element *remote_show_cmdlist;
206+
194207 /* Description of the remote protocol. Strictly speaking, when the
195208 target is open()ed, remote.c should create a per-target description
196209 of the remote protocol using that target's architecture.
@@ -229,6 +242,10 @@ struct remote_state
229242 /* This is the maximum size (in chars) of a non read/write packet.
230243 It is also used as a cap on the size of read/write packets. */
231244 long remote_packet_size;
245+
246+ /* This flag is set if we negotiated packet size explicitly (and
247+ can bypass various heuristics). */
248+ int explicit_packet_size;
232249 };
233250
234251
@@ -457,10 +474,13 @@ get_memory_packet_size (struct memory_packet_config *config)
457474 if (config->size > 0
458475 && what_they_get > config->size)
459476 what_they_get = config->size;
460- /* Limit it to the size of the targets ``g'' response. */
461- if ((rs->actual_register_packet_size) > 0
462- && what_they_get > (rs->actual_register_packet_size))
463- what_they_get = (rs->actual_register_packet_size);
477+
478+ /* Limit it to the size of the targets ``g'' response unless we have
479+ permission from the stub to use a larger packet size. */
480+ if (!rs->explicit_packet_size
481+ && rs->actual_register_packet_size > 0
482+ && what_they_get > rs->actual_register_packet_size)
483+ what_they_get = rs->actual_register_packet_size;
464484 }
465485 if (what_they_get > MAX_REMOTE_PACKET_SIZE)
466486 what_they_get = MAX_REMOTE_PACKET_SIZE;
@@ -596,6 +616,7 @@ struct packet_config
596616 char *title;
597617 enum auto_boolean detect;
598618 enum packet_support support;
619+ int must_be_reported;
599620 };
600621
601622 /* Analyze a packet's return value and update the packet config
@@ -659,11 +680,8 @@ static void
659680 add_packet_config_cmd (struct packet_config *config,
660681 char *name,
661682 char *title,
662- cmd_sfunc_ftype *set_func,
663- show_value_ftype *show_func,
664- struct cmd_list_element **set_remote_list,
665- struct cmd_list_element **show_remote_list,
666- int legacy)
683+ int legacy,
684+ int must_be_reported)
667685 {
668686 char *set_doc;
669687 char *show_doc;
@@ -673,6 +691,7 @@ add_packet_config_cmd (struct packet_config *config,
673691 config->title = title;
674692 config->detect = AUTO_BOOLEAN_AUTO;
675693 config->support = PACKET_SUPPORT_UNKNOWN;
694+ config->must_be_reported = must_be_reported;
676695 set_doc = xstrprintf ("Set use of remote protocol `%s' (%s) packet",
677696 name, title);
678697 show_doc = xstrprintf ("Show current use of remote protocol `%s' (%s) packet",
@@ -681,17 +700,18 @@ add_packet_config_cmd (struct packet_config *config,
681700 cmd_name = xstrprintf ("%s-packet", title);
682701 add_setshow_auto_boolean_cmd (cmd_name, class_obscure,
683702 &config->detect, set_doc, show_doc, NULL, /* help_doc */
684- set_func, show_func,
685- set_remote_list, show_remote_list);
703+ set_remote_protocol_packet_cmd,
704+ show_remote_protocol_packet_cmd,
705+ &remote_set_cmdlist, &remote_show_cmdlist);
686706 /* set/show remote NAME-packet {auto,on,off} -- legacy. */
687707 if (legacy)
688708 {
689709 char *legacy_name;
690710 legacy_name = xstrprintf ("%s-packet", name);
691711 add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
692- set_remote_list);
712+ &remote_set_cmdlist);
693713 add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
694- show_remote_list);
714+ &remote_show_cmdlist);
695715 }
696716 }
697717
@@ -762,6 +782,7 @@ packet_ok (const char *buf, struct packet_config *config)
762782 enum {
763783 PACKET_vCont = 0,
764784 PACKET_X,
785+ PACKET_qOffsets,
765786 PACKET_qSymbol,
766787 PACKET_P,
767788 PACKET_p,
@@ -1827,14 +1848,20 @@ get_offsets (void)
18271848 CORE_ADDR text_addr, data_addr, bss_addr;
18281849 struct section_offsets *offs;
18291850
1851+ if (remote_protocol_packets[PACKET_qOffsets].support == PACKET_DISABLE)
1852+ return;
1853+
18301854 putpkt ("qOffsets");
18311855 getpkt (buf, rs->remote_packet_size, 0);
18321856
1833- if (buf[0] == '\000')
1834- return; /* Return silently. Stub doesn't support
1835- this command. */
1836- if (buf[0] == 'E')
1857+ switch (packet_ok (buf, &remote_protocol_packets[PACKET_qOffsets]))
18371858 {
1859+ case PACKET_OK:
1860+ break;
1861+ case PACKET_UNKNOWN:
1862+ return; /* Return silently. Stub doesn't support
1863+ this command. */
1864+ case PACKET_ERROR:
18381865 warning (_("Remote failure reply: %s"), buf);
18391866 return;
18401867 }
@@ -2034,6 +2061,108 @@ Some events may be lost, rendering further debugging impossible."));
20342061 }
20352062
20362063 static void
2064+remote_query_packet_info (void)
2065+{
2066+ struct remote_state *rs = get_remote_state ();
2067+ char *reply, *next;
2068+ int i;
2069+
2070+ reply = alloca (rs->remote_packet_size);
2071+
2072+ putpkt ("qPacketInfo");
2073+ getpkt (reply, rs->remote_packet_size, 0);
2074+
2075+ next = reply;
2076+ while (*next)
2077+ {
2078+ enum packet_support is_supported;
2079+ char *p, *end, *name_end;
2080+
2081+ p = next;
2082+ end = strchr (p, ';');
2083+ if (end == NULL)
2084+ {
2085+ end = p + strlen (p);
2086+ next = end;
2087+ }
2088+ else
2089+ {
2090+ if (end == p)
2091+ {
2092+ warning (_("empty item in \"qPacketInfo\" response"));
2093+ continue;
2094+ }
2095+
2096+ *end = '\0';
2097+ next = end + 1;
2098+ }
2099+
2100+ name_end = strchr (p, '=');
2101+ if (name_end)
2102+ {
2103+ /* This is a name=value entry. */
2104+ char *value;
2105+
2106+ value = name_end + 1;
2107+ *name_end = '\0';
2108+
2109+ if (strcmp (p, "PacketSize") == 0)
2110+ {
2111+ int packet_size;
2112+ char *value_end;
2113+
2114+ packet_size = strtol (value, &value_end, 16);
2115+ if (*value != '\0' && *value_end == '\0')
2116+ {
2117+ /* MERGE WARNING: This needs the infinite length
2118+ incoming packet support, which in turn needs us
2119+ to adjust rs->buf_size here. */
2120+ if (packet_size >= MAX_REMOTE_PACKET_SIZE)
2121+ {
2122+ warning (_("limiting remote suggested packet size (%d bytes) to %d"),
2123+ packet_size, MAX_REMOTE_PACKET_SIZE);
2124+ packet_size = MAX_REMOTE_PACKET_SIZE;
2125+ }
2126+ rs->remote_packet_size = packet_size;
2127+ rs->explicit_packet_size = 1;
2128+
2129+ continue;
2130+ }
2131+ }
2132+
2133+ /* Should we even warn about this? For testing, at least, yes. */
2134+ warning (_("unrecognized item \"%s=%s\" in \"qPacketInfo\" response"),
2135+ p, value);
2136+ continue;
2137+ }
2138+
2139+ if (end[-1] != '+' && end[-1] != '-')
2140+ {
2141+ warning (_("unrecognized item \"%s\" in \"qPacketInfo\" response"), p);
2142+ continue;
2143+ }
2144+
2145+ is_supported = (end[-1] == '+') ? PACKET_ENABLE : PACKET_DISABLE;
2146+ end[-1] = '\0';
2147+
2148+ for (i = 0; i < PACKET_MAX; i++)
2149+ if (strcmp (remote_protocol_packets[i].name, p) == 0)
2150+ {
2151+ if (remote_protocol_packets[i].support == PACKET_SUPPORT_UNKNOWN)
2152+ remote_protocol_packets[i].support = is_supported;
2153+ break;
2154+ }
2155+ }
2156+
2157+ /* Default some unmentioned packets to unsupported. */
2158+ for (i = 0; i < PACKET_MAX; i++)
2159+ if (remote_protocol_packets[i].must_be_reported
2160+ && remote_protocol_packets[i].support == PACKET_SUPPORT_UNKNOWN)
2161+ remote_protocol_packets[i].support = PACKET_DISABLE;
2162+}
2163+
2164+
2165+static void
20372166 remote_open_1 (char *name, int from_tty, struct target_ops *target,
20382167 int extended_p, int async_p)
20392168 {
@@ -2095,6 +2224,11 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target,
20952224 use_threadinfo_query = 1;
20962225 use_threadextra_query = 1;
20972226
2227+ /* The first packet we send to the target is the optional "supported
2228+ packets" request. If the target can answer this, it will tell us
2229+ which later probes to skip. */
2230+ remote_query_packet_info ();
2231+
20982232 /* Without this, some commands which require an active target (such
20992233 as kill) won't work. This variable serves (at least) double duty
21002234 as both the pid of the target process (if it has such), and as a
@@ -3138,7 +3272,7 @@ fetch_registers_using_g (void)
31383272 error (_("remote 'g' packet reply is too large: %s"), buf);
31393273 if (buf_len % 2 != 0)
31403274 error (_("Remote 'g' packet reply is of odd length: %s"), buf);
3141- if (REGISTER_BYTES_OK_P () && !REGISTER_BYTES_OK (i))
3275+ if (REGISTER_BYTES_OK_P () && !REGISTER_BYTES_OK (buf_len / 2))
31423276 error (_("Remote 'g' packet reply is too short: %s"), buf);
31433277
31443278 /* Save the size of the packet sent to us by the target. It is used
@@ -5485,9 +5619,6 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
54855619 extended_async_remote_ops.to_mourn_inferior = extended_remote_mourn;
54865620 }
54875621
5488-static struct cmd_list_element *remote_set_cmdlist;
5489-static struct cmd_list_element *remote_show_cmdlist;
5490-
54915622 static void
54925623 set_remote_cmd (char *args, int from_tty)
54935624 {
@@ -5665,95 +5796,47 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
56655796 &setlist, &showlist);
56665797
56675798 add_packet_config_cmd (&remote_protocol_packets[PACKET_X],
5668- "X", "binary-download",
5669- set_remote_protocol_packet_cmd,
5670- show_remote_protocol_packet_cmd,
5671- &remote_set_cmdlist, &remote_show_cmdlist,
5672- 1);
5799+ "X", "binary-download", 1, 0);
56735800
56745801 add_packet_config_cmd (&remote_protocol_packets[PACKET_vCont],
5675- "vCont", "verbose-resume",
5676- set_remote_protocol_packet_cmd,
5677- show_remote_protocol_packet_cmd,
5678- &remote_set_cmdlist, &remote_show_cmdlist,
5679- 0);
5802+ "vCont", "verbose-resume", 0, 0);
5803+
5804+ add_packet_config_cmd (&remote_protocol_packets[PACKET_qOffsets],
5805+ "qOffsets", "load-offsets", 0, 0);
56805806
56815807 add_packet_config_cmd (&remote_protocol_packets[PACKET_qSymbol],
5682- "qSymbol", "symbol-lookup",
5683- set_remote_protocol_packet_cmd,
5684- show_remote_protocol_packet_cmd,
5685- &remote_set_cmdlist, &remote_show_cmdlist,
5686- 0);
5808+ "qSymbol", "symbol-lookup", 0, 0);
56875809
56885810 add_packet_config_cmd (&remote_protocol_packets[PACKET_P],
5689- "P", "set-register",
5690- set_remote_protocol_packet_cmd,
5691- show_remote_protocol_packet_cmd,
5692- &remote_set_cmdlist, &remote_show_cmdlist,
5693- 1);
5811+ "P", "set-register", 1, 0);
56945812
56955813 add_packet_config_cmd (&remote_protocol_packets[PACKET_p],
5696- "p", "fetch-register",
5697- set_remote_protocol_packet_cmd,
5698- show_remote_protocol_packet_cmd,
5699- &remote_set_cmdlist, &remote_show_cmdlist,
5700- 1);
5814+ "p", "fetch-register", 1, 0);
57015815
57025816 add_packet_config_cmd (&remote_protocol_packets[PACKET_Z0],
5703- "Z0", "software-breakpoint",
5704- set_remote_protocol_packet_cmd,
5705- show_remote_protocol_packet_cmd,
5706- &remote_set_cmdlist, &remote_show_cmdlist,
5707- 0);
5817+ "Z0", "software-breakpoint", 0, 0);
57085818
57095819 add_packet_config_cmd (&remote_protocol_packets[PACKET_Z1],
5710- "Z1", "hardware-breakpoint",
5711- set_remote_protocol_packet_cmd,
5712- show_remote_protocol_packet_cmd,
5713- &remote_set_cmdlist, &remote_show_cmdlist,
5714- 0);
5820+ "Z1", "hardware-breakpoint", 0, 0);
57155821
57165822 add_packet_config_cmd (&remote_protocol_packets[PACKET_Z2],
5717- "Z2", "write-watchpoint",
5718- set_remote_protocol_packet_cmd,
5719- show_remote_protocol_packet_cmd,
5720- &remote_set_cmdlist, &remote_show_cmdlist,
5721- 0);
5823+ "Z2", "write-watchpoint", 0, 0);
57225824
57235825 add_packet_config_cmd (&remote_protocol_packets[PACKET_Z3],
5724- "Z3", "read-watchpoint",
5725- set_remote_protocol_packet_cmd,
5726- show_remote_protocol_packet_cmd,
5727- &remote_set_cmdlist, &remote_show_cmdlist,
5728- 0);
5826+ "Z3", "read-watchpoint", 0, 0);
57295827
57305828 add_packet_config_cmd (&remote_protocol_packets[PACKET_Z4],
5731- "Z4", "access-watchpoint",
5732- set_remote_protocol_packet_cmd,
5733- show_remote_protocol_packet_cmd,
5734- &remote_set_cmdlist, &remote_show_cmdlist,
5735- 0);
5829+ "Z4", "access-watchpoint", 0, 0);
57365830
57375831 add_packet_config_cmd (&remote_protocol_packets[PACKET_qPart_auxv],
5738- "qPart_auxv", "read-aux-vector",
5739- set_remote_protocol_packet_cmd,
5740- show_remote_protocol_packet_cmd,
5741- &remote_set_cmdlist, &remote_show_cmdlist,
5742- 0);
5832+ "qPart:auxv", "read-aux-vector", 0, 0);
57435833
57445834 add_packet_config_cmd (&remote_protocol_packets[PACKET_qPart_features],
5745- "qPart_features", "target-features",
5746- set_remote_protocol_packet_cmd,
5747- show_remote_protocol_packet_cmd,
5748- &remote_set_cmdlist, &remote_show_cmdlist,
5749- 0);
5835+ "qPart:features", "target-features", 0, 1);
57505836
57515837 add_packet_config_cmd (&remote_protocol_packets[PACKET_qGetTLSAddr],
57525838 "qGetTLSAddr", "get-thread-local-storage-address",
5753- set_remote_protocol_packet_cmd,
5754- show_remote_protocol_packet_cmd,
5755- &remote_set_cmdlist, &remote_show_cmdlist,
5756- 0);
5839+ 0, 0);
57575840
57585841 /* Keep the old ``set remote Z-packet ...'' working. Each individual
57595842 Z sub-packet has its own set and show commands, but users may