Discussion:
[Bug tui/14332] New: Output from inferior confuses gdbtui
joachim.protze at zih dot tu-dresden.de
2012-07-05 13:09:46 UTC
Permalink
http://sourceware.org/bugzilla/show_bug.cgi?id=14332

Bug #: 14332
Summary: Output from inferior confuses gdbtui
Product: gdb
Version: 7.4
Status: NEW
Severity: normal
Priority: P2
Component: tui
AssignedTo: ***@sourceware.org
ReportedBy: ***@zih.tu-dresden.de
Classification: Unclassified


Created attachment 6510
--> http://sourceware.org/bugzilla/attachment.cgi?id=6510
print 20 lines of "hello world!"

To reproduce:
gcc -g hello2.c -o hello
gdb -ex run -tui ./hello

The first "Hello World!\n" is overwritten by the gdb output, therefore the
printf is in a for-loop.

Two symptoms can be viewed:

- the \n produces a line feed only, no carriage return

- the output of the inferior is not fetched and reported in the output
subscreen
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
palves at redhat dot com
2015-07-02 13:04:51 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=14332

Pedro Alves <palves at redhat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |palves at redhat dot com

--- Comment #1 from Pedro Alves <palves at redhat dot com> ---
Can't see how to get around with unless we create a new pty master/slave for
the inferior, instead of having it share the terminal with gdb.
--
You are receiving this mail because:
You are on the CC list for the bug.
palves at redhat dot com
2015-07-02 13:05:34 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=14332

Pedro Alves <palves at redhat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |netheril96 at gmail dot com

--- Comment #2 from Pedro Alves <palves at redhat dot com> ---
*** Bug 17476 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-09-02 22:52:09 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=14332

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
It would be interesting to specify how this would all work.

First, it seems like having gdb make a new pty and set TERM=dumb
would not be extremely hard. This would allow capturing of
the output.

I am not sure how the input side would work. Put the terminal
into raw mode and send the characters immediately? Then what about
C-c? (Perhaps obviously I do not know much about ptys.)

Perhaps this should be done in gdb/common so that it can be reused
by gdbserver.


In the TUI it would even be possible to emulate a real terminal
in a curses window. I found libraries that would make this simpler:

https://github.com/deadpixi/libtmt
https://www.freedesktop.org/wiki/Software/libtsm/

The first seems simplest. I'd been hoping that GNU screen would have
some kind of library mode we could reuse, but it doesn't seem to;
though an alternative approach might be to script screen a bit.

However, activating this mode seems tricky because it seems like it
wouldn't make sense from the CLI.
--
You are receiving this mail because:
You are on the CC list for the bug.
palves at redhat dot com
2018-09-03 11:39:24 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=14332

--- Comment #4 from Pedro Alves <palves at redhat dot com> ---
Take a look at this branch:
https://github.com/palves/gdb/commits/palves/tty-always-separate-session

Most of the branch is about infrastructure making GDB make a new pty for the
inferior and then marshalling input/output between the inferior's pty and
gdb's.
That allows fixing a set of problems, including being able to Ctrl-C when the
inferior is stopped in a non-interruptible syscall (I think we could interrupt
it with PTRACE_INTERRUPT), or when the inferior is ignoring SIGINT with
SIG_IGN.

The tui patch on top is a hack, of course. We'd need to come up with a cleaner
interface.

(The fork-child related changes in the branch need better abstracting too.)
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...