docs: Update debugging docs to mention Meson build options

The behaviour of the Meson build has changed a little vs what we did in
autotools. In autotools, --enable-debug was a tristate (yes, no,
undefined), with all three options resulting in different macro
definitions.

In Meson, we have a bistate of --buildtype={debug,debugoptimized} vs
--buildtype=(anything else). There is no way to automatically define
G_DISABLE_ASSERT or G_DISABLE_CHECKS while building GLib — you need to
define them in your CPPFLAGS in your environment instead.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-01-09 12:17:52 +00:00
parent 7cff1b2265
commit 855aea45c6
2 changed files with 8 additions and 7 deletions

View File

@ -4,7 +4,7 @@ Traps (G_BREAKPOINT) and traces for the debuging
Some code portions contain trap variables that can be set during Some code portions contain trap variables that can be set during
debugging time if G_ENABLE_DEBUG has been defined upon compilation debugging time if G_ENABLE_DEBUG has been defined upon compilation
(use the --enable-debug=yes option to configure for this, macros.txt (use the --buildtype=debug option to configure for this, macros.txt
covers more details). covers more details).
Such traps lead to immediate code halts to examine the current Such traps lead to immediate code halts to examine the current
program state and backtrace. program state and backtrace.

View File

@ -3,13 +3,14 @@
GLib's configure options and corresponding macros GLib's configure options and corresponding macros
================================================= =================================================
--enable-debug=no --buildtype={plain,release,minsize,custom}
-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS
--enable-debug=minimum [default for stable branches]
none none
--enable-debug=yes [default for development branches] --buildtype={debug,debugoptimized} [debugoptimized is the default]
-DG_ENABLE_DEBUG -g -DG_ENABLE_DEBUG -g
Available to define yourself:
-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS
Besides these, there are some local feature specific options, but my main Besides these, there are some local feature specific options, but my main
focus here is to concentrate on macros that affect overall GLib behaviour focus here is to concentrate on macros that affect overall GLib behaviour
and/or third party code. and/or third party code.
@ -22,8 +23,8 @@ G_DISABLE_ASSERT
The g_assert() and g_assert_not_reached() become non-functional The g_assert() and g_assert_not_reached() become non-functional
with this define. The motivation is to speed up end-user apps by with this define. The motivation is to speed up end-user apps by
avoiding expensive checks. avoiding expensive checks.
This macro can affect third-party code. --enable-debug=no will only This macro can affect third-party code. Defining it when building GLib
disable the assertion macros for GLib itself, but third-party code will only disable the assertion macros for GLib itself, but third-party code
that passes -DG_DISABLE_ASSERT to the compiler upon its own build that passes -DG_DISABLE_ASSERT to the compiler upon its own build
will end up with the non-functional variants after including glib.h will end up with the non-functional variants after including glib.h
as well. as well.