all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* better "pr" with gdb-6.4
@ 2006-02-05 18:40 Dan Nicolaescu
  2006-02-05 21:01 ` Kim F. Storm
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Nicolaescu @ 2006-02-05 18:40 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-02-08  3:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-05 18:40 better "pr" with gdb-6.4 Dan Nicolaescu
2006-02-05 21:01 ` 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

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.