public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Broken MI output
@ 2005-03-03 14:17 Karganov Konstantin
  2005-03-03 14:20 ` Bob Rossi
  0 siblings, 1 reply; 6+ messages in thread
From: Karganov Konstantin @ 2005-03-03 14:17 UTC (permalink / raw)
  To: gdb

Hello.

I tried to run hello-world application under "gdb -i=mi"
and got the following:

-------------------------
~"GNU gdb 6.3\n"
~"Copyright 2004 Free Software Foundation, Inc.\n"
~"GDB is free software, covered by the GNU General Public License, and you 
are\n"
~"welcome to change it and/or distribute copies of it under certain 
conditions.\n"
~"Type \"show copying\" to see the conditions.\n"
~"There is absolutely no warranty for GDB.  Type \"show warranty\" for 
details.\n"
~"This GDB was configured as \"i686-pc-linux-gnu\"..."
~"Using host libthread_db library \"/lib/libthread_db.so.1\".\n"
~"\n"
(gdb)
run
&"run\n"
 Hello world!
~"Current language:  auto; currently c\n"
^done,reason="exited-normally"
(gdb)
-------------------------

Two lines here are out of the grammar syntax: "run" line, that is only 
echo of the terminal, that doesnt go out of the debugger (presents only in 
debugger stdin) and the " Hello world!" line that is an application output 
mixed with MI output. The second line goes out of the debugger stdout and 
surely breaks MI-parser. 
Am I right that this is a bug ("@ c-string" format is missing) that needs 
to be fixed?

Thanks.

Konstantin.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Broken MI output
  2005-03-03 14:17 Broken MI output Karganov Konstantin
@ 2005-03-03 14:20 ` Bob Rossi
  2005-03-03 14:26   ` Karganov Konstantin
  0 siblings, 1 reply; 6+ messages in thread
From: Bob Rossi @ 2005-03-03 14:20 UTC (permalink / raw)
  To: Karganov Konstantin; +Cc: gdb

On Thu, Mar 03, 2005 at 05:10:35PM +0300, Karganov Konstantin wrote:
> Hello.
> 
> I tried to run hello-world application under "gdb -i=mi"
> and got the following:
> 
> -------------------------
> ~"GNU gdb 6.3\n"
> ~"Copyright 2004 Free Software Foundation, Inc.\n"
> ~"GDB is free software, covered by the GNU General Public License, and you 
> are\n"
> ~"welcome to change it and/or distribute copies of it under certain 
> conditions.\n"
> ~"Type \"show copying\" to see the conditions.\n"
> ~"There is absolutely no warranty for GDB.  Type \"show warranty\" for 
> details.\n"
> ~"This GDB was configured as \"i686-pc-linux-gnu\"..."
> ~"Using host libthread_db library \"/lib/libthread_db.so.1\".\n"
> ~"\n"
> (gdb)
> run
> &"run\n"
>  Hello world!
> ~"Current language:  auto; currently c\n"
> ^done,reason="exited-normally"
> (gdb)
> -------------------------
> 
> Two lines here are out of the grammar syntax: "run" line, that is only 
> echo of the terminal, that doesnt go out of the debugger (presents only in 
> debugger stdin) and the " Hello world!" line that is an application output 
> mixed with MI output. The second line goes out of the debugger stdout and 
> surely breaks MI-parser. 
> Am I right that this is a bug ("@ c-string" format is missing) that needs 
> to be fixed?

The echoing should be turned off from the GDB side. There are several
ways to do this. Are you communicating with GDB through a pipe, pty?

The inferior output needs to be redirected to another pty using the
console 'tty' command. This will "unmix" the inferior output and the MI
output.

Thanks,
Bob Rossi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Broken MI output
  2005-03-03 14:20 ` Bob Rossi
@ 2005-03-03 14:26   ` Karganov Konstantin
  2005-03-03 14:34     ` Bob Rossi
  0 siblings, 1 reply; 6+ messages in thread
From: Karganov Konstantin @ 2005-03-03 14:26 UTC (permalink / raw)
  To: Bob Rossi; +Cc: gdb

On Thu, 3 Mar 2005, Bob Rossi wrote:

> The echoing should be turned off from the GDB side. There are several
> ways to do this.
The echoing doesn't matter since it does't go from gdb stdout.

> Are you communicating with GDB through a pipe, pty?
Currently - through the pipe.

> The inferior output needs to be redirected to another pty using the
> console 'tty' command. This will "unmix" the inferior output and the MI
> output.
And if I don't want to redirect it to pty (or even can't)?
There is a special grammar rule (target-stream-output) for this case but 
it is not used! Why?..

Thanks.
Konstantin.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Broken MI output
  2005-03-03 14:26   ` Karganov Konstantin
@ 2005-03-03 14:34     ` Bob Rossi
  2005-03-03 15:02       ` Karganov Konstantin
  0 siblings, 1 reply; 6+ messages in thread
From: Bob Rossi @ 2005-03-03 14:34 UTC (permalink / raw)
  To: Karganov Konstantin; +Cc: gdb

On Thu, Mar 03, 2005 at 05:20:51PM +0300, Karganov Konstantin wrote:
> On Thu, 3 Mar 2005, Bob Rossi wrote:
> 
> > The echoing should be turned off from the GDB side. There are several
> > ways to do this.
> The echoing doesn't matter since it does't go from gdb stdout.
> 
> > Are you communicating with GDB through a pipe, pty?
> Currently - through the pipe.
> 
> > The inferior output needs to be redirected to another pty using the
> > console 'tty' command. This will "unmix" the inferior output and the MI
> > output.
> And if I don't want to redirect it to pty (or even can't)?
> There is a special grammar rule (target-stream-output) for this case but 
> it is not used! Why?..

I've never dealt with that, but I assume it's when GDB is talking to a
target program, not a normal program on the host.

A target program most likely has a special form of I/O, which is
redirected through GDB. A program running on the host outputs directly
to the terminal, and it's impossible for GDB to know anything about it.

Unless of course, GDB puts a pty between the inferior and itself. 

Thanks,
Bob Rossi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Broken MI output
  2005-03-03 14:34     ` Bob Rossi
@ 2005-03-03 15:02       ` Karganov Konstantin
  2005-03-03 15:06         ` Bob Rossi
  0 siblings, 1 reply; 6+ messages in thread
From: Karganov Konstantin @ 2005-03-03 15:02 UTC (permalink / raw)
  To: Bob Rossi; +Cc: gdb

On Thu, 3 Mar 2005, Bob Rossi wrote:

> A target program most likely has a special form of I/O, which is
If gdb was attached to running process - yes, the program has own IO from 
the starting time and gdb/MI has it's own IO - all is fine here.

> redirected through GDB. A program running on the host outputs directly
> to the terminal, and it's impossible for GDB to know anything about it.
But if the debuggee is started inside gdb it shares the same tty with the 
debugger.
The problem of breaking MI grammar with inferior output, can be solved 
adding a pipe to/from the inferior, monitoring the pipe and quoting target 
output. 

> When GDB is in MI mode, why couldn't it put a pty between the inferior
> and itself.
And redirect it to the same terminal, where gdb is started? Or where?

The only reasonable solution I see here is to have distinct ttys for a 
inferior (that is controlled by the operator) and for gdb (that is 
controlled by a GUI using MI).

Konstantin.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Broken MI output
  2005-03-03 15:02       ` Karganov Konstantin
@ 2005-03-03 15:06         ` Bob Rossi
  0 siblings, 0 replies; 6+ messages in thread
From: Bob Rossi @ 2005-03-03 15:06 UTC (permalink / raw)
  To: Karganov Konstantin; +Cc: gdb

On Thu, Mar 03, 2005 at 05:55:11PM +0300, Karganov Konstantin wrote:
> On Thu, 3 Mar 2005, Bob Rossi wrote:
> 
> > A target program most likely has a special form of I/O, which is
> If gdb was attached to running process - yes, the program has own IO from 
> the starting time and gdb/MI has it's own IO - all is fine here.
> 
> > redirected through GDB. A program running on the host outputs directly
> > to the terminal, and it's impossible for GDB to know anything about it.
> But if the debuggee is started inside gdb it shares the same tty with the 
> debugger.
> The problem of breaking MI grammar with inferior output, can be solved 
> adding a pipe to/from the inferior, monitoring the pipe and quoting target 
> output. 

GDB doesn't currently create pty's for the inferior. So this would be a feature 
request that I've asked about here, 
   http://sources.redhat.com/ml/gdb/2005-03/msg00024.html

> > When GDB is in MI mode, why couldn't it put a pty between the inferior
> > and itself.
> And redirect it to the same terminal, where gdb is started? Or where?
> 
> The only reasonable solution I see here is to have distinct ttys for a 
> inferior (that is controlled by the operator) and for gdb (that is 
> controlled by a GUI using MI).

I don't really know of a project that use's the MI and doesn't give the
inferior it's own tty to work with.

Thanks,
Bob Rossi

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-03-03 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-03 14:17 Broken MI output Karganov Konstantin
2005-03-03 14:20 ` Bob Rossi
2005-03-03 14:26   ` Karganov Konstantin
2005-03-03 14:34     ` Bob Rossi
2005-03-03 15:02       ` Karganov Konstantin
2005-03-03 15:06         ` Bob Rossi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).