Re: Computer VARSIZE_ANY(PTR) during debugging

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Computer VARSIZE_ANY(PTR) during debugging
Дата
Msg-id 20130731021434.GE19053@alap2.anarazel.de
обсуждение исходный текст
Ответ на Computer VARSIZE_ANY(PTR) during debugging  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-hackers
Hi,

On 2013-06-26 13:27:15 +0900, Amit Langote wrote:
> Is it possible to compute VARSIZE_ANY(PTR) during debugging?
>
> ---------------------------------------------------------
> #define VARSIZE_ANY(PTR) \
>         (VARATT_IS_1B_E(PTR) ? VARSIZE_1B_E(PTR) : \
>          (VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR) : \
>           VARSIZE_4B(PTR)))
>
> #define VARATT_IS_1B_E(PTR) \
>         ((((varattrib_1b *) (PTR))->va_header) == 0x80)
> -----------------------------------------------------------
>
> I tried using above expression, but it gives following:
>
> (gdb) p ((((varattrib_1b *) ( tp+off ))->va_header) == 0x80)
> No symbol "varattrib_1b" in current context.

FWIW, for me, just replacing typedefs in such cases by the actual
struct's name often works. Unfortunately varattrib_1b is an anonymous
struct, but that's easy enough to change.
In HEAD it seems enough to replace the usages in VARTAG_SIZE by the
actual structs. Like in the attached patch.

If you compile postgres with -g3 or higher, it will include most macro
definitions in the binary. If you then additionally define:
macro define __builtin_offsetof(T, F) ((int) &(((T *) 0)->F))
macro define __extension__

In your .gdbinit, many macros work OOTB.

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY.
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Computer VARSIZE_ANY(PTR) during debugging