Re: Patch - Debug builds without optimization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Patch - Debug builds without optimization
Дата
Msg-id 28526.1322633114@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Patch - Debug builds without optimization  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Patch - Debug builds without optimization  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> I have applied the attached patch to mention the debugger.  OK?

>         Server developers should consider using the configure options 
>         <option>--enable-cassert</> and <option>--enable-debug</> to enhance the
>         ability to detect and debug server errors.  They should also consider
> !       running configure with <literal>CFLAGS="-O0 -g"</> if using a debugger.

I still think this is basically useless.  If we're going to mention the
topic at all, we should provide enough information to be helpful, which
this does not.  Furthermore, it's concretely wrong in that it suggests
you need to say -g when --enable-debug already does that, and that it
fails to note that all this advice is gcc-specific.

I suggest wording along these lines:
When developing code inside the server, it's recommended touse the configure options --enable-cassert, which turns on
manyrun-timeerror checks, and --enable-debug, which improves theusefulness of debugging tools.
 
If you use gcc, it's best to build with an optimization levelof at least -O1, because using level -O0 disables some
importantcompilerwarnings (such as use of an uninitialized variable).However, nonzero optimization levels can
complicatedebuggingbecause stepping through the compiled code will usually notmatch up one-to-one with source code
lines. If you get confusedwhile trying to debug optimized code, recompile the specificfile(s) of interest with -O0.  An
easyway to do this with theUnix makefiles is "make PROFILE=-O0 file.o".
 
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Reserved words and delimited identifiers
Следующее
От: Greg Smith
Дата:
Сообщение: Re: Word-smithing doc changes