Re: Noob Hints on testing and debugging?

From: "Dave Page" <dpage(at)pgadmin(dot)org>
To: "James Mansion" <james(at)mansionfamily(dot)plus(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Noob Hints on testing and debugging?
Date: 2008-03-12 08:47:11
Message-ID: 937d27e10803120147h24662898tbd6dfa451cd5bf73@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 12, 2008 at 7:21 AM, James Mansion
<james(at)mansionfamily(dot)plus(dot)com> wrote:
> Are there any hints and tips anywhere on practical issues for testing
> and debugging changes to a backend?
>
> (eg how to run it up and feed it SQL ideally without running a
> postmaster and execing a back end)
>
> I'm using VS2008 on XP by choice, and I'd like to investigate supporting
> something closely related to
> the Firebird 2.1 trigger on transaction commmit and rollback.

I've yet to try 2008, but 2005 works beautifully when debugging the
server - even stepping into non-core code is simple (I spent some time
in the plpgsql debugger plugin for example).

The hard part can be attaching the debugger to the appropriate
backend. You can either introduce a startup delay (there's a backend
command line option for that iirc), or if you want to break at a
specific point, I sometimes add a loop to the code along the lines of:

int x=0;
while (!x)
Sleep(100);

When the backend hits that point, attach the debugger, break
execution, and set x to a value in the locals window. Then you can
step through the code from that point.

--
Dave Page
EnterpriseDB UK Ltd: http://www.enterprisedb.com
PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2008-03-12 09:31:08 Re: Re: [COMMITTERS] pgsql: Add: > o Add SQLSTATE severity to PGconn return status > >
Previous Message Magnus Hagander 2008-03-12 08:22:28 Re: Re: [COMMITTERS] pgsql: Add: > o Add SQLSTATE severit yto PGconn return status > >