Re: Computer VARSIZE_ANY(PTR) during debugging

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Computer VARSIZE_ANY(PTR) during debugging
Дата
Msg-id CAM3SWZRcOuEMmBFyYUeip=vww-HjU5WJY_DhhQ5dCSMyGOzxJg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Computer VARSIZE_ANY(PTR) during debugging  (Greg Stark <stark@mit.edu>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Computer VARSIZE_ANY(PTR) during debugging
Следующее
От: Gibheer
Дата:
Сообщение: Re: Backup throttling