Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: [MI] Prevent program output from mixing with "^running".
Date: Fri, 06 Nov 2009 14:28:00 -0000	[thread overview]
Message-ID: <200911061728.12893.vladimir@codesourcery.com> (raw)

[-- Attachment #1: Type: Text/Plain, Size: 343 bytes --]


We have run into a case where the output of the programm being
debugger got inserted between the MI token and "^running", confusing
the frontend quite considerably. This was on Windows, so pseudoterminals
are not a solution. I've checked in this patch to address this.
There's no testcase, since reproducing this is tricky.


Thanks,
Volodya

[-- Attachment #2: token-final.diff --]
[-- Type: text/x-patch, Size: 1389 bytes --]

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.11035
diff -u -p -r1.11035 ChangeLog
--- gdb/ChangeLog	5 Nov 2009 23:18:00 -0000	1.11035
+++ gdb/ChangeLog	6 Nov 2009 14:24:59 -0000
@@ -1,3 +1,12 @@
+2009-11-06  Vladimir Prus  <vladimir@codesourcery.com>
+
+        Prevent program output from mix with "^running".
+
+	gdb/
+	* mi/mi-interp.c (mi_on_resume): Output token
+	and "^running" together, so that nothing else gets
+	in between.
+
 2009-11-05  Daniel Jacobowitz  <dan@codesourcery.com>
 
 	* dwarf2read.c (struct dwarf2_cu): Remove ranges_offset and
Index: gdb/mi/mi-interp.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-interp.c,v
retrieving revision 1.51
diff -u -p -r1.51 mi-interp.c
--- gdb/mi/mi-interp.c	19 Oct 2009 09:51:42 -0000	1.51
+++ gdb/mi/mi-interp.c	6 Nov 2009 14:24:59 -0000
@@ -438,9 +438,8 @@ mi_on_resume (ptid_t ptid)
      In future (MI3), we'll be outputting "^done" here.  */
   if (!running_result_record_printed && mi_proceeded)
     {
-      if (current_token)
-	fputs_unfiltered (current_token, raw_stdout);
-      fputs_unfiltered ("^running\n", raw_stdout);
+      fprintf_unfiltered (raw_stdout, "%s^running\n",
+			  current_token ? current_token : "");
     }
 
   if (PIDGET (ptid) == -1)

             reply	other threads:[~2009-11-06 14:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-06 14:28 Vladimir Prus [this message]
2009-11-06 14:51 ` Joel Brobecker

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=200911061728.12893.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.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