Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: Re: GDB needs a --cmdline option
Date: Wed, 05 Sep 2001 00:15:00 -0000	[thread overview]
Message-ID: <871z3doune.fsf@cygnus.com> (raw)
In-Reply-To: <Pine.SOL.3.91.1000507154133.21631E-100000@cse.cygnus.com>

>>>>> "Mo" == Mo DeJong <mdejong@cygnus.com> writes:

Mo> I have been running into a problem with gdb that it seems would be
Mo> nicely solved with a new command line option --cmdline.

Mo> Now if there is a problem with the gcj executable, I would want to
Mo> use gdb to debug it. The problem is I want to debug it in the
Mo> context of the Makefile run, not just by itself on the command
Mo> line.

Mo> gdb gcj --cmdline "-C *.java gnu/gcj/convert/*.java gnu/gcj/*.java"

I agree that something like this is needed.  But I am not that fond of
this incarnation.  I particularly don't like the quoting on the
command line above.

I'd like to see gdb have two additional modes: `invisible' mode, and
the one you suggest.  You would activate it something like this:

  gdb --invisible -- gcj -C *.java ...
OR
  gdb -- gdb -C *.java ...

Everything after the `--' are command-line arguments for the inferior.
Note that you put the program's name after the `--' -- this lets you
insert the `gdb' command into an existing command-line without editing
(an important property if you are doing this programmatically).

In invisible mode, gdb would connect its stdin, stdout, and stderr
directly to the inferior, do whatever initialization it needed, and
then run the program without user interaction.  (The I/O stuff is
needed because it lets you insert "gdb --invisible" into a pipeline.)

If the program crashed, or hit a breakpoint (gdb would still read
.gdbinit), then gdb would create its user interface: open a window,
connect to the user's terminal, whatever.

In non-invisible mode, gdb would start interactively as usual.

A long time ago (1992!) I used a debugger that had this feature.  It
was wonderful.  It eliminated an annoying step from the debugging
process.

In my situation I had a server launching various client programs,
which would then communicate with the server via stdin/stdout.  This
feature let me insert "sdb ..." into the client launch command and
debug the program in its natural environment.

These days I see a nice use for this feature in gcc.  When I debug
gcj, I often run `gcj -v blah blah blah', and the extract the jc1
command line from that output.  This is a pain, particularly if the
command-lines are long.  I'd much rather add a little debugging
feature to gcc that would let me tell it to run `gdb --invisible' on
the jc1 invocation.  Then, as Mo says, I could even do it via the make
command line.


Now it occurs to me that the visible/invisible split might not be the
best one.  It might be better to always go interactive, but still
connect the stdio streams (and any other open file descriptors, though
this is less important) to the inferior.  People can always just "r"
from there, perhaps via .gdbinit if they wanted.

Tom


       reply	other threads:[~2001-09-05  0:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.SOL.3.91.1000507154133.21631E-100000@cse.cygnus.com>
2001-09-05  0:15 ` Tom Tromey [this message]
     [not found]   ` <20000508131024.42535@cse.cygnus.com>
     [not found]     ` <3916FBE7.ECD328A5@cygnus.com>
2000-05-08 11:16       ` Mark Kettenis
     [not found] <Pine.LNX.4.10.10005101250570.18782-100000@abomination.cygnus.com>
     [not found] ` <3919C9EA.95DEC4A5@cygnus.com>
2001-09-05  0:15   ` Tom Tromey
     [not found]   ` <200005111321.JAA13143@indy.delorie.com>
     [not found]     ` <391AB98E.D80A537@cygnus.com>
2001-09-05  0:15       ` Tom Tromey
     [not found] <Pine.SOL.3.91.1000511131403.14281B-100000@cse.cygnus.com>
     [not found] ` <391B1780.23185181@cygnus.com>
2001-09-05  0:15   ` Tom Tromey

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=871z3doune.fsf@cygnus.com \
    --to=tromey@cygnus.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