Re: Printing bitmap objects in the debugger

From: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Printing bitmap objects in the debugger
Date: 2016-09-15 14:25:42
Message-ID: CABOikdPBN3LYxYjODF6n5UVCH5POO2kfSwnK-TWVq7hR1fgpKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 15, 2016 at 7:38 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

>
>
> This seems like a very complicated mechanism of substituting for a
> very simple patch.

I don't have objection to the patch per se. The point of posting this was
just to share other mechanisms that exists. BTW advantage of using debugger
scripts is that they also work while inspecting core dumps.

> Your LLDB script is about the same number of lines
> as Ashutosh's patch and only works for people who use LLDB.

Alvaro pointed out that gdb also have similar capabilities.

> Plus,
> once you write it, you've got to enter the Python interpreter to use
> it and then run three more lines of code that aren't easy to remember.
>
In contrast, with Ashutosh's proposed patch, you just write:
>
> p bms_to_char(bms_object)
>
>
I learnt this yesterday and I am sure there are easier ways to do the same
thing. I just don't know. For example, you can also do this:

(lldb) script print print_bms_members(lldb.frame.FindVariable ("a"))
nwords = 1 bitmap: 0x200

It's still slightly cumbersome, but better than entering the interpreter.

> ...and you're done. Now, I grant that his approach bloats the binary
> and yours does not, but nobody complains about pprint() bloating the
> binary.

Sure. I wasn't aware of existence of pprint() either and may be that's
enough from debugging perspective. When I tried that yesterday, the output
went to the logfile instead of coming on the debugger prompt. May be I did
something wrong or may be that's not inconvenient for those who use it
regularly.

So yeah, no objections to the patch. I was happy to discover what I did and
thought of sharing assuming others might find it useful too.

Thanks,
Pavan

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2016-09-15 14:33:11 Re: OpenSSL 1.1 breaks configure and more
Previous Message Andres Freund 2016-09-15 14:23:09 Re: Hash Indexes