Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Michael Snyder <msnyder@vmware.com>
Cc: gdb@sourceware.org
Subject: Re: [RFC] Let "gcore" command accept a suffix argument
Date: Mon, 30 Nov 2009 18:44:00 -0000	[thread overview]
Message-ID: <m3aay4t08q.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4B11DA3C.3000203@vmware.com> (Michael Snyder's message of "Sat, 	28 Nov 2009 18:19:40 -0800")

>>>>> "Michael" == Michael Snyder <msnyder@vmware.com> writes:

Michael> I can't find the reference message, but I have a recollection
Michael> about somebody asking why some gdb command (may have been 'gcore')
Michael> couldn't accept a gdb internal variable so that the filename could
Michael> in effect be "computed", or disambiguated, to avoid overwriting.

It isn't just gcore.  This lack of reflectivity comes up every week, for
different commands, on the gdb irc channel.  Our standard answers are
(1) use Python, and (2) you can do it more horribly using set logging
and shell.

Michael> 1) So -- what if 'gcore' were to accept an optional second
Michael> argument which, if present, would be treated as an integer and
Michael> suffixed to the gcore filename?

I don't like it very much, I think because it is a specific solution to
a general problem.

Michael> Yes, I know, we could do the same thing with Python, but
Michael> I'm not convinced that that is an argument against doing it
Michael> stand alone (maybe for users who don't want to learn python).

I'm not that sympathetic to users who don't want to learn about the
facilities that gdb provides.  That said, presumably some versions of
gdb won't enable python, and it would make sense to provide some
solution to those users as well.

As a counter-proposal, consider an "eval" command.  It would substitute
any $foo in its argument before invoking the real command.  Your example
would be:

set $a = 0
eval gcore foo.$a
set $a = $a + 1

A "$$" in the argument would be converted to a single "$", so users
could also defer convenience variable evaluation when needed.

"eval" itself isn't more than a few lines of Python ;)

Tom


      parent reply	other threads:[~2009-11-30 17:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 13:39 Michael Snyder
2009-11-30 16:22 ` Hui Zhu
2009-11-30 17:04   ` Joel Brobecker
2009-11-30 18:53     ` Tom Tromey
2009-11-30 19:06     ` Michael Snyder
2009-11-30 20:16       ` Joel Brobecker
2009-11-30 20:25         ` Michael Snyder
2009-11-30 20:31           ` Joel Brobecker
2009-11-30 20:46             ` Michael Snyder
2009-12-10  2:28               ` Hui Zhu
2009-11-30 18:44 ` Tom Tromey [this message]

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=m3aay4t08q.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=msnyder@vmware.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