Re: Printing bitmap objects in the debugger - Mailing list pgsql-hackers

From Pavan Deolasee
Subject Re: Printing bitmap objects in the debugger
Date
Msg-id CABOikdPBN3LYxYjODF6n5UVCH5POO2kfSwnK-TWVq7hR1fgpKw@mail.gmail.com
Whole thread Raw
In response to Re: Printing bitmap objects in the debugger  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Printing bitmap objects in the debugger  (Pavan Deolasee <pavan.deolasee@gmail.com>)
List pgsql-hackers


On Thu, Sep 15, 2016 at 7:38 PM, Robert Haas <robertmhaas@gmail.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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Hash Indexes
Next
From: Christoph Berg
Date:
Subject: Re: OpenSSL 1.1 breaks configure and more