From: Eli Zaretskii <eliz@gnu.org>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: pluto@agmk.net, gdb@sourceware.org
Subject: Re: overloading 'print' command.
Date: Fri, 15 May 2009 07:06:00 -0000 [thread overview]
Message-ID: <83preargj6.fsf@gnu.org> (raw)
In-Reply-To: <8ac60eac0905141617g1db278e5l906eef8f5b899ed4@mail.gmail.com>
> Date: Thu, 14 May 2009 16:17:07 -0700
> From: Paul Pluzhnikov <ppluzhnikov@google.com>
> Cc: gdb@sourceware.org
>
> 2009/5/14 PaweÂł Sikora <pluto@agmk.net>:
>
> > I'd like to ask about overloading gdb's 'print' command.
> > e.g. I've defined a macro 'ps' for printing std::string:
> >
> > define ps
> > p $arg0.c_str()
> > end
> >
> > Now, I'd like to avoid calling 'ps' and just use the 'p' command
> > in top-macros for printing more complex data structures.
> > Is it possible in gdb to register some hooks for type-based
> > printing?
>
> Support for doing *exactly* this is coming to mainline GDB, but you can
> get it now from the archer-tromey-python branch:
> http://sourceware.org/gdb/wiki/PythonGdb
But I think what the OP wants does not justify waiting a few months
until GDB 7 is released.
To the OP: yes, you should be able to use the user-defined hooks
machinery to do what you want. If you define a command called
`hook-print', it will be run before `print', and if you define a
command called `hookpost-print', it will be run after `print'. See
the node "Hooks" in the GDB manual for more information on hooks.
next prev parent reply other threads:[~2009-05-15 7:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 11:46 Paweł Sikora
2009-05-14 23:17 ` Paul Pluzhnikov
2009-05-15 7:06 ` Eli Zaretskii [this message]
2009-05-15 14:07 ` Paul Pluzhnikov
2009-05-15 14:42 ` Eli Zaretskii
2009-05-15 15:53 ` Joel Brobecker
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=83preargj6.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb@sourceware.org \
--cc=pluto@agmk.net \
--cc=ppluzhnikov@google.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