Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michal Ludvig <mludvig@suse.cz>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] remote debugging patches
Date: Mon, 11 Mar 2002 07:08:00 -0000	[thread overview]
Message-ID: <3C8CC863.8030206@suse.cz> (raw)
In-Reply-To: <3C8BBEFC.5040504@cygnus.com>

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

Andrew Cagney wrote:
> Yes fine, er almost.  Can you change the name of this to 
> ``DONT_WAIT_FOREVER_FLAG'' and suggest making it an enum. (so GDB can 
> print it :-)

Why DONT_WAIT_FOREWER? IMHO wait_forewer is correct, because 0 means 
don't wait forewer (the default) and 1 means yes, wait forever.

> If you're feeling really inspired (...), you could even introduce an 
> enum to handle both the DO and DONT cases.

OK, I changed it to enum called wait_forever_flag with values yes and 
no. Now it should be clear enough whether to wait or not. :-)
Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* +420 2 9654 5373   * http://www.suse.cz

[-- Attachment #2: gdb-remote-03111602.diff --]
[-- Type: text/plain, Size: 11057 bytes --]

Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.77
diff -u -r1.77 remote.c
--- remote.c	2002/02/27 01:18:39	1.77
+++ remote.c	2002/03/11 15:02:18
@@ -55,6 +55,9 @@
 
 #include "gdbcore.h" /* for exec_bfd */
 
+/* Set this default to 'yes' when you don't want to timeout getpkt() */
+static enum { no, yes } wait_forever_flag=no;
+
 /* Prototypes for local functions */
 static void cleanup_sigint_signal_handler (void *dummy);
 static void initialize_sigint_signal_handler (void);
@@ -1032,7 +1035,7 @@
   else
     sprintf (&buf[2], "%x", th);
   putpkt (buf);
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
   if (gen)
     general_thread = th;
   else
@@ -1052,7 +1055,7 @@
   else
     sprintf (buf, "T%08x", tid);
   putpkt (buf);
-  getpkt (buf, sizeof (buf), 0);
+  getpkt (buf, sizeof (buf), wait_forever_flag);
   return (buf[0] == 'O' && buf[1] == 'K');
 }
 
@@ -1550,7 +1553,7 @@
 
   pack_threadinfo_request (threadinfo_pkt, fieldset, threadid);
   putpkt (threadinfo_pkt);
-  getpkt (threadinfo_pkt, (rs->remote_packet_size), 0);
+  getpkt (threadinfo_pkt, (rs->remote_packet_size), wait_forever_flag);
   result = remote_unpack_thread_info_response (threadinfo_pkt + 2, threadid,
 					       info);
   return result;
@@ -1630,7 +1633,7 @@
   pack_threadlist_request (threadlist_packet,
 			   startflag, result_limit, nextthread);
   putpkt (threadlist_packet);
-  getpkt (t_response, (rs->remote_packet_size), 0);
+  getpkt (t_response, (rs->remote_packet_size), wait_forever_flag);
 
   *result_count =
     parse_threadlist_response (t_response + 2, result_limit, &echo_nextthread,
@@ -1740,7 +1743,7 @@
   char *buf = alloca (rs->remote_packet_size);
 
   putpkt ("qC");
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
   if (buf[0] == 'Q' && buf[1] == 'C')
     return pid_to_ptid (strtol (&buf[2], NULL, 16));
   else
@@ -1782,7 +1785,7 @@
     {
       putpkt ("qfThreadInfo");
       bufp = buf;
-      getpkt (bufp, (rs->remote_packet_size), 0);
+      getpkt (bufp, (rs->remote_packet_size), wait_forever_flag);
       if (bufp[0] != '\0')		/* q packet recognized */
 	{	
 	  while (*bufp++ == 'm')	/* reply contains one or more TID */
@@ -1796,7 +1799,7 @@
 	      while (*bufp++ == ',');	/* comma-separated list */
 	      putpkt ("qsThreadInfo");
 	      bufp = buf;
-	      getpkt (bufp, (rs->remote_packet_size), 0);
+	      getpkt (bufp, (rs->remote_packet_size), wait_forever_flag);
 	    }
 	  return;	/* done */
 	}
@@ -1837,7 +1840,7 @@
     {
       sprintf (bufp, "qThreadExtraInfo,%x", PIDGET (tp->ptid));
       putpkt (bufp);
-      getpkt (bufp, (rs->remote_packet_size), 0);
+      getpkt (bufp, (rs->remote_packet_size), wait_forever_flag);
       if (bufp[0] != 0)
 	{
 	  n = min (strlen (bufp) / 2, sizeof (display_buf));
@@ -1893,7 +1896,7 @@
   /* Now query for status so this looks just like we restarted
      gdbserver from scratch.  */
   putpkt ("?");
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 }
 \f
 /* Clean up connection to a remote debugger.  */
@@ -1921,7 +1924,7 @@
 
   putpkt ("qOffsets");
 
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
   if (buf[0] == '\000')
     return;			/* Return silently.  Stub doesn't support
@@ -2202,7 +2205,7 @@
   /* Invite target to request symbol lookups. */
 
   putpkt ("qSymbol::");
-  getpkt (reply, (rs->remote_packet_size), 0);
+  getpkt (reply, (rs->remote_packet_size), wait_forever_flag);
   packet_ok (reply, &remote_protocol_qSymbol);
 
   while (strncmp (reply, "qSymbol:", 8) == 0)
@@ -2218,7 +2221,7 @@
 		 paddr_nz (SYMBOL_VALUE_ADDRESS (sym)),
 		 &reply[8]);
       putpkt (msg);
-      getpkt (reply, (rs->remote_packet_size), 0);
+      getpkt (reply, (rs->remote_packet_size), wait_forever_flag);
     }
 }
 
@@ -2304,7 +2307,7 @@
       /* Tell the remote that we are using the extended protocol.  */
       char *buf = alloca (rs->remote_packet_size);
       putpkt ("!");
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
     }
 #ifdef SOLIB_CREATE_INFERIOR_HOOK
   /* FIXME: need a master target_open vector from which all 
@@ -2418,7 +2421,7 @@
       /* Tell the remote that we are using the extended protocol.  */
       char *buf = alloca (rs->remote_packet_size);
       putpkt ("!");
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
     }
 #ifdef SOLIB_CREATE_INFERIOR_HOOK
   /* FIXME: need a master target_open vector from which all 
@@ -2601,7 +2604,7 @@
 	      *p++ = 0;
 
 	      putpkt (buf);
-	      getpkt (buf, (rs->remote_packet_size), 0);
+	      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
 	      if (packet_ok (buf, &remote_protocol_E) == PACKET_OK)
 		return;
@@ -2619,7 +2622,7 @@
 	      *p++ = 0;
 
 	      putpkt (buf);
-	      getpkt (buf, (rs->remote_packet_size), 0);
+	      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
 	      if (packet_ok (buf, &remote_protocol_e) == PACKET_OK)
 		return;
@@ -2690,7 +2693,7 @@
 	      *p++ = 0;
 
 	      putpkt (buf);
-	      getpkt (buf, (rs->remote_packet_size), 0);
+	      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
 	      if (packet_ok (buf, &remote_protocol_E) == PACKET_OK)
 		goto register_event_loop;
@@ -2708,7 +2711,7 @@
 	      *p++ = 0;
 
 	      putpkt (buf);
-	      getpkt (buf, (rs->remote_packet_size), 0);
+	      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
 	      if (packet_ok (buf, &remote_protocol_e) == PACKET_OK)
 		goto register_event_loop;
@@ -3439,7 +3442,7 @@
       if (remote_debug)
 	fprintf_unfiltered (gdb_stdlog,
 			    "Bad register packet; fetching a new packet\n");
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
     }
 
   /* Reply describes registers byte by byte, each byte encoded as two
@@ -3695,7 +3698,7 @@
 	*p = '\0';
 	
 	putpkt_binary (buf, (int) (p - buf));
-	getpkt (buf, (rs->remote_packet_size), 0);
+	getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
 	if (buf[0] == '\0')
 	  {
@@ -3837,7 +3840,7 @@
     }
   
   putpkt_binary (buf, (int) (p - buf));
-  getpkt (buf, sizeof_buf, 0);
+  getpkt (buf, sizeof_buf, wait_forever_flag);
   
   if (buf[0] == 'E')
     {
@@ -3902,7 +3905,7 @@
       *p = '\0';
 
       putpkt (buf);
-      getpkt (buf, sizeof_buf, 0);
+      getpkt (buf, sizeof_buf, wait_forever_flag);
 
       if (buf[0] == 'E')
 	{
@@ -3980,7 +3983,7 @@
       data_long = extract_unsigned_integer (data, len);
       sprintf (buf, "t%x:%x,%x", startaddr, data_long, mask_long);
       putpkt (buf);
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
       if (buf[0] == '\0')
 	{
 	  /* The stub doesn't support the 't' request.  We might want to
@@ -4069,7 +4072,7 @@
 	     long sizeof_buf)
 {
   putpkt (buf);
-  getpkt (buf, sizeof_buf, 0);
+  getpkt (buf, sizeof_buf, wait_forever_flag);
 
   if (buf[0] == 'E')
     error ("Remote failure reply: %s", buf);
@@ -4658,7 +4661,7 @@
       sprintf (p, ",%d", bp_size);
       
       putpkt (buf);
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
       switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_SOFTWARE_BP]))
 	{
@@ -4711,7 +4714,7 @@
       sprintf (p, ",%d", bp_size);
       
       putpkt (buf);
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
       return (buf[0] == 'E');
     }
@@ -4766,7 +4769,7 @@
   sprintf (p, ",%x", len);
   
   putpkt (buf);
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
   switch (packet_ok (buf, &remote_protocol_Z[packet]))
     {
@@ -4802,7 +4805,7 @@
   p += hexnumstr (p, (ULONGEST) addr);
   sprintf (p, ",%x", len);
   putpkt (buf);
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
   switch (packet_ok (buf, &remote_protocol_Z[packet]))
     {
@@ -4840,7 +4843,7 @@
   sprintf (p, ",%x", len);
 
   putpkt (buf);
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
 
   switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_HARDWARE_BP]))
     {
@@ -4878,7 +4881,7 @@
   sprintf (p, ",%x", len);
 
   putpkt(buf);
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
   
   switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_HARDWARE_BP]))
     {
@@ -5011,7 +5014,7 @@
       bfd_get_section_contents (exec_bfd, s, sectdata, 0, size);
       host_crc = crc32 ((unsigned char *) sectdata, size, 0xffffffff);
 
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
       if (buf[0] == 'E')
 	error ("target memory fault, section %s, range 0x%08x -- 0x%08x",
 	       sectname, lma, lma + size);
@@ -5102,7 +5105,7 @@
   if (i < 0)
     return i;
 
-  getpkt (outbuf, *bufsiz, 0);
+  getpkt (outbuf, *bufsiz, wait_forever_flag);
 
   return 0;
 }
@@ -5141,7 +5144,7 @@
     {
       /* XXX - see also tracepoint.c:remote_get_noisy_reply() */
       buf[0] = '\0';
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
       if (buf[0] == '\0')
 	error ("Target does not support this command\n");
       if (buf[0] == 'O' && buf[1] != 'K')
@@ -5182,7 +5185,7 @@
   puts_filtered ("\n");
   putpkt (args);
 
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
   puts_filtered ("received: ");
   print_packet (buf);
   puts_filtered ("\n");
@@ -5430,7 +5433,7 @@
     error ("Command can only be used when connected to the remote target.");
 
   putpkt ("qfProcessInfo");
-  getpkt (buf, (rs->remote_packet_size), 0);
+  getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
   if (buf[0] == 0)
     return;			/* Silently: target does not support this feature. */
 
@@ -5441,7 +5444,7 @@
     {
       remote_console_output (&buf[1]);
       putpkt ("qsProcessInfo");
-      getpkt (buf, (rs->remote_packet_size), 0);
+      getpkt (buf, (rs->remote_packet_size), wait_forever_flag);
     }
 }
 

  reply	other threads:[~2002-03-11 15:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-10 10:34 Michal Ludvig
2002-03-10 11:35 ` Daniel Jacobowitz
2002-03-10 11:43   ` Michal Ludvig
2002-03-10 14:30     ` Daniel Jacobowitz
2002-03-11  6:54       ` Michal Ludvig
2002-03-11  7:37         ` Daniel Jacobowitz
2002-03-11 18:22         ` Andrew Cagney
2002-03-11 18:47           ` Daniel Jacobowitz
2002-03-13  6:14             ` Michal Ludvig
2002-03-13  7:48               ` Andreas Schwab
2002-03-13  8:17                 ` Michal Ludvig
2002-03-13  8:34                   ` Andrew Cagney
2002-03-13  9:53                   ` Andreas Schwab
2002-03-13 11:09                     ` Michal Ludvig
2002-03-13 12:24                       ` Andreas Schwab
2002-03-13  9:07               ` Daniel Jacobowitz
2002-03-10 12:16 ` Andrew Cagney
2002-03-11  7:08   ` Michal Ludvig [this message]
2002-03-11  7:37     ` Daniel Jacobowitz
2002-03-11  8:06       ` Michal Ludvig
2002-03-11  8:12         ` Daniel Jacobowitz
2002-03-11  8:38           ` Michal Ludvig
2002-03-11  8:34         ` Andrew Cagney
2002-03-11  7:53     ` Andrew Cagney
2002-03-11  9:12       ` Michal Ludvig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C8CC863.8030206@suse.cz \
    --to=mludvig@suse.cz \
    --cc=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox