[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [HACKERS] Computer VARSIZE_ANY(PTR) during debugging
From:       Peter Geoghegan <pg () heroku ! com>
Date:       2013-07-31 2:31:44
Message-ID: CAM3SWZRcOuEMmBFyYUeip=vww-HjU5WJY_DhhQ5dCSMyGOzxJg () mail ! gmail ! com
[Download RAW message or body]

On Tue, Jul 30, 2013 at 10:33 AM, Greg Stark <stark@mit.edu> wrote:
> I think there's some magic in gdb for this but I'm not sure how to
> make it happen. If you figure it out I would think it would be
> generally useful and we should find a way to put it in the source tree
> so it works for everyone.

You can write custom pretty printers for varlena types using GDB's
pretty printers (Python bindings expose this stuff). You can even
differentiate between text and bytea, even though they're both just
typedefs for varlena. I've done this myself in the past, but
unfortunately I don't control the source code. I can tell you that the
bindings are excellent, though.

I was even able to do things like printing output more or less
equivalent to what MemoryContextStats() dumps, but directly from GDB
(i.e I could walk the tree of memory contexts), even though there is a
bunch of private macros involved - I essentially re-rewrote
AllocSetStats() in weirdly C-like Python.

-- 
Peter Geoghegan


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic