all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
Subject: better "pr" with gdb-6.4
Date: Sun, 05 Feb 2006 10:40:24 -0800	[thread overview]
Message-ID: <200602051840.k15IeONe013609@scanner2.ics.uci.edu> (raw)


Using "pr" when debugging is a bit inconvenient because one has to do:

p VARIABLE
pr 

Instead it would be nicer to just do:
pr VARIABLE

Well, with gdb-6.4 this is possible, thanks to a new variable ($argc)
that holds the number of arguments passed to a command. "pr" can now
be written like this to support both versions shown above:

define pr
  if ($argc == 0)
     set debug_print ($)
  elif ($argc == 1)
     set debug_print ($arg0)
  end
end

Processing even more arguments can be done by adding more "elif"
  elif ($argc == 2)
     set debug_print ($arg0)
     set debug_print ($arg1)

Unfortunately AFAIK it is not possible to do it in a simpler way
(there's no equivalent of Bourne shell's "shift" and the positional
arguments cannot be accessed through a variable that can be
incremented in a loop).

I don't know enough about autoconf to integrate the above in the build
system, but maybe some of you might be useful as a local hack until
properly integrated in emacs....

        --dan

             reply	other threads:[~2006-02-05 18:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-05 18:40 Dan Nicolaescu [this message]
2006-02-05 21:01 ` better "pr" with gdb-6.4 Kim F. Storm
2006-02-07  0:04   ` Dan Nicolaescu
2006-02-07  2:39     ` Nick Roberts
2006-02-07  9:08       ` Kim F. Storm
2006-02-07  9:52         ` Miles Bader
2006-02-07 10:48           ` Nick Roberts
2006-02-07 10:25         ` Nick Roberts
2006-02-07 10:51           ` Kim F. Storm
2006-02-08  3:34             ` Nick Roberts
2006-02-07 12:38           ` Andreas Schwab

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=200602051840.k15IeONe013609@scanner2.ics.uci.edu \
    --to=dann@ics.uci.edu \
    /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.