Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Denis PILAT <denis.pilat@st.com>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Target stderr not displayed thru MI
Date: Thu, 01 Dec 2005 13:57:00 -0000	[thread overview]
Message-ID: <438F011F.7050403@st.com> (raw)
In-Reply-To: <17294.2894.345752.773239@kahikatea.snap.net.nz>

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



Nick Roberts wrote:

 >
 > > Nick,
 > >
 > > The mi->err is used for displaying debugger errors, not the error coming
 > > from the target execution.
 > > The main problem with MI is that we can not distinguish target stdout
 > > from target stderr.
 >
 >In that case, can you create a new MI channel? e.g.
 >
 >
 >
I'm not sure creating a new mi stream is on fashion, but I'm not opposed
to that.

My original problem was the following:
  >   When debugging a program thru Eclipse or any front end using MI,
  >   the stderr of the debugged program is lost.
  >   This problem occures only on remote targets since native ones don't
  >   use MI stream for output.

Your solution won't fix my problem since current Eclipse uses MI 1 and will
never recognize the new prefix.
What we can do is creating a new error stream mi->targerr but with a prefix
that will be:
- the same than the mi->targ for MI 1 and 2, means "@"
- a new one like you proposed for MI versoin > 2: "#" for instance.


I attach a new patch in that sense. It does not include the documentation patch 
  about MI new stream but it's just to give you an idea.
Any comment ?

Denis



[-- Attachment #2: mi-interp.patch --]
[-- Type: text/plain, Size: 1481 bytes --]

2005-12-01  Denis Pilat  <denis.pilat@st.com>

	* mi-interp.c (mi_interpreter_resume): Route target error through the MI.
	(struct mi_interp): Add field targerr.
	(mi_interpreter_init): Initialize mi target error stream.

Index: mi/mi-interp.c
===================================================================
--- mi/mi-interp.c	(revision 224)
+++ mi/mi-interp.c	(working copy)
@@ -40,6 +40,7 @@
   struct ui_file *err;
   struct ui_file *log;
   struct ui_file *targ;
+  struct ui_file *targerr;
   struct ui_file *event_channel;
 
   /* This is the interpreter for the mi... */
@@ -86,6 +87,15 @@
   mi->err = mi_console_file_new (raw_stdout, "&", '"');
   mi->log = mi->err;
   mi->targ = mi_console_file_new (raw_stdout, "@", '"');
+
+  /* MI 1 and 2 target error stream use the same steam prefix "@" in oder
+     to ensure backward compatibility with old frondtend, MI 3 uses
+     a new prefix "#" */
+  if (mi_version (uiout) > 2)
+    mi->targerr = mi_console_file_new (raw_stdout, "#", '"');
+  else
+    mi->targerr = mi_console_file_new (raw_stdout, "@", '"');
+
   mi->event_channel = mi_console_file_new (raw_stdout, "=", 0);
 
   return mi;
@@ -119,6 +129,8 @@
   gdb_stdlog = mi->log;
   /* Route target output through the MI. */
   gdb_stdtarg = mi->targ;
+  /* Route target error through the MI error stream. */
+  gdb_stdtargerr = mi->targerr;
 
   /* Replace all the hooks that we know about.  There really needs to
      be a better way of doing this... */


  parent reply	other threads:[~2005-12-01 13:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 14:15 Nick Roberts
2005-11-30 18:57 ` [PATCH] " Denis PILAT
2005-11-30 19:03   ` Bob Rossi
2005-11-30 19:55     ` Daniel Jacobowitz
     [not found]   ` <17294.2894.345752.773239@kahikatea.snap.net.nz>
2005-12-01 13:57     ` Denis PILAT [this message]
2005-12-01 14:06       ` Bob Rossi
2005-12-01 14:32         ` Daniel Jacobowitz
2005-12-01 16:20           ` Denis PILAT
2005-12-01 22:49           ` Nick Roberts
2005-12-02  1:26             ` Jim Blandy
2005-12-05 20:50             ` Denis PILAT
2005-12-06  6:09               ` Nick Roberts
2005-12-06 10:49                 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2005-11-30  2:47 Denis PILAT
2005-11-30 13:51 ` Jim Blandy

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=438F011F.7050403@st.com \
    --to=denis.pilat@st.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=nickrob@snap.net.nz \
    /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