Re: debuging postgres

Lists: pgsql-hackers
From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: debuging postgres
Date: 2004-08-23 16:27:24
Message-ID: cgd5tf$6q4$1@floppy.pyrenet.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,
in order to debug "step by step" the postmaster,
just to understand better the code, is it enough
to compile it after having exported:

CFLAGS='-O0 -g' ?

do you have any hint and/or tips ?

BTW what do you use for this task ?

Regards
Gaetano Mendola


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: debuging postgres
Date: 2004-08-24 01:14:21
Message-ID: 412A966D.8040200@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> in order to debug "step by step" the postmaster,
> just to understand better the code, is it enough
> to compile it after having exported:
>
> CFLAGS='-O0 -g' ?
>
> do you have any hint and/or tips ?
>
> BTW what do you use for this task ?

./configure --enable-debug

Chris


From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Subject: Re: debuging postgres
Date: 2004-08-24 11:29:43
Message-ID: 412B26A7.7020406@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Christopher Kings-Lynne wrote:

>> in order to debug "step by step" the postmaster,
>> just to understand better the code, is it enough
>> to compile it after having exported:
>>
>> CFLAGS='-O0 -g' ?
>>
>> do you have any hint and/or tips ?
>>
>> BTW what do you use for this task ?
>
>
> ./configure --enable-debug

Is this enough? I'm seeing that with --enable-debug only the
option -g is passed to the compiler and the option -O2 is
still there, is it not better compile with -O0 if you are
going to debug it?

Regards
Gaetano Mendola


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: debuging postgres
Date: 2004-08-24 16:42:22
Message-ID: 4919.1093365742@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Gaetano Mendola <mendola(at)bigfoot(dot)com> writes:
> Christopher Kings-Lynne wrote:
>> ./configure --enable-debug

> Is this enough? I'm seeing that with --enable-debug only the
> option -g is passed to the compiler and the option -O2 is
> still there, is it not better compile with -O0 if you are
> going to debug it?

If you want to single-step through the code a lot, then -O0 is good.
But are you really gonna do that so much? I do most of my tracing
at the level of function calls.

I tend to use -O1 as a compromise setting --- the code isn't totally
scrambled but it doesn't run like a dog either. (Also, for development
purposes, -O0 is evil because it disables certain useful warnings in
gcc.)

regards, tom lane


From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: debuging postgres
Date: 2004-08-24 18:39:37
Message-ID: 412B8B69.7020907@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:

> Gaetano Mendola <mendola(at)bigfoot(dot)com> writes:
>
>>Christopher Kings-Lynne wrote:
>>
>>>./configure --enable-debug
>
>
>>Is this enough? I'm seeing that with --enable-debug only the
>>option -g is passed to the compiler and the option -O2 is
>>still there, is it not better compile with -O0 if you are
>>going to debug it?
>
>
> If you want to single-step through the code a lot, then -O0 is good.
> But are you really gonna do that so much? I do most of my tracing
> at the level of function calls.

Of course not, but given that I don't know nothing I guess at the
beginning in order to see what is going on and understand how the code
work I need to "inspect" some variables some times.

> I tend to use -O1 as a compromise setting --- the code isn't totally
> scrambled but it doesn't run like a dog either. (Also, for development
> purposes, -O0 is evil because it disables certain useful warnings in
> gcc.)

Thank you for the advice.

Regards
Gaetano Mendola


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: debuging postgres
Date: 2004-08-25 01:41:27
Message-ID: 412BEE47.2080502@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> Is this enough? I'm seeing that with --enable-debug only the
> option -g is passed to the compiler and the option -O2 is
> still there, is it not better compile with -O0 if you are
> going to debug it?

Well, I use the following:

./configure --prefix=blah --enable-debug --enable-cassert
--enable-depend --with-openssl --with-perl --with-pam

(Or something like that)

My theory is that the more I compile in the more that gets tested :)

Chris