all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org, Nick Roberts <nickrob@snap.net.nz>
Subject: gdb-mi and debugging interactive programs
Date: Sun, 12 Aug 2012 21:12:43 +0300	[thread overview]
Message-ID: <83fw7s6ktg.fsf@gnu.org> (raw)

Can someone (Nick?) who knows the details of how gdb-mi and GDB set up
the standard handles of both GDB itself and the debuggee please look
at bug #12163?

  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12163

(The end of the discussion is in bug 12180, for some reason.)

I only studied this in detail on MS-Windows, and there the situation
looks hopeless (unless one uses "set new-console on" before running
the debuggee) when you try to debug a program that reads stdin and
writes its stdout.  It seems like gdb-mi sends commands to GDB
regardless of whether GDB is ready to receive them.  AFAIK, the only
safe time to send a command to GDB is after we receive the "(gdb) "
prompt.  But gdb-mi does not do that, it generally sends commands like
"-thread-info" whenever it feels like it.  That causes those commands
to be read by the debuggee as input, instead of giving the user chance
to type input.  And if the user eventually succeeds to type input for
the program, gdb-mi wraps it in "-interpreter-exec console", which of
course ruins the whole interaction.

Similarly with output: if the debuggee happens to output text that
looks like GDB/MI output records, gdb-mi interprets that as if it came
from GDB.  E.g., try debugging a program that writes something like
'*stopped,reason="exited"' to its stdout: in my experiments, gdb-mi
decided that the program exited.

How is this supposed to work? how is gdb-mi supposed to distinguish
between I/O with GDB and I/O with a program being debugged?  That is,
if the user types some text into the gud buffer, how can gdb-mi know
whether to send it to GDB or to the debuggee?  What am I missing here?

TIA



             reply	other threads:[~2012-08-12 18:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-12 18:12 Eli Zaretskii [this message]
2012-08-13 17:42 ` gdb-mi and debugging interactive programs Eli Zaretskii

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=83fw7s6ktg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.