Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: "Paweł Sikora" <pluto@agmk.net>
Cc: gdb@sourceware.org
Subject: Re: overloading 'print' command.
Date: Thu, 14 May 2009 23:17:00 -0000	[thread overview]
Message-ID: <8ac60eac0905141617g1db278e5l906eef8f5b899ed4@mail.gmail.com> (raw)
In-Reply-To: <QXEMlZRc.1242301597.2053650.pluto@agmk.net>

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

It is significantly more powerful than what you can do with simple 'define'.

Cheers,
-- 
Paul Pluzhnikov


  reply	other threads:[~2009-05-14 23:17 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 [this message]
2009-05-15  7:06   ` Eli Zaretskii
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=8ac60eac0905141617g1db278e5l906eef8f5b899ed4@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=gdb@sourceware.org \
    --cc=pluto@agmk.net \
    /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