@subheading Compiling LilyPond for use with gdb
In order to use gdb with LilyPond, it is necessary to compile
-LilyPond with debugging information. This is accomplished by running
-the following commands in the main LilyPond source directory.
+LilyPond with debugging information. This is the current default
+mode of compilation. Often debugging becomes more complicated
+when the compiler has optimised variables and function calls away.
+In that case it may be helpful to run the following command in the
+main LilyPond source directory:
@example
-./configure --disable-optimising
+./configure --disable-optimising
make
@end example
-This will create a version of LilyPond containing debugging
-information that will allow the debugger to tie the source code
-to the compiled code.
+This will create a version of LilyPond with minimal optimization
+which will allow the debugger to access all variables and step
+through the source code in-order. It may not accurately reproduce
+bugs encountered with the optimized version, however.
You should not do @var{make install} if you want to use a debugger
with LilyPond. The @var{make install} command will strip debugging
In order for the Graphviz tool to work, config.make must be modified.
It is probably a good idea to first save a copy of config.make under
-a different name. Then, edit config.make by removing every occurrence
-of @option{-DNDEBUG}.
+a different name.
+
+In order to have the required functionality available, LilyPond
+needs to be compiled with the option @option{-DDEBUG}. You can
+achieve this by configuring with
+
+@example
+./configure --enable-checking
+@end example
@item Rebuilding LilyPond
The pdf file can then be viewed with any pdf viewer.
-When compiled without @option{-DNDEBUG}, lilypond may run slower
-than normal. The original configuration can be restored by either
-renaming the saved copy of @code{config.make} or rerunning
-@code{configure}. Then rebuild lilypond with
+When compiled with @option{-DDEBUG}, lilypond may run slower
+than normal. The original configuration can be restored by rerunning
+@code{./configure} with @option{--disable-checking}. Then
+rebuild lilypond with
@example
make -C lily clean && make -C lily
CXXFLAGS=${CXXFLAGS-$CFLAGS}
LDFLAGS=${LDFLAGS-""}
optimise_b=yes
+ checks_b=no
profile_b=no
debug_b=yes
pipe_b=yes
[compile with debugging info. Default: on])],
[debug_b=$enableval])
+ AC_ARG_ENABLE(checking,
+ [AS_HELP_STRING([--enable-checking],
+ [compile with expensive run-time checks. Default: off])],
+ [checks_b=$enableval])
+
AC_ARG_ENABLE(optimising,
[AS_HELP_STRING([--enable-optimising],
[compile with optimising. Default: on])],
[pipe_b=$enableval])
if test "$optimise_b" = yes; then
- AC_DEFINE(NDEBUG)
- DEFINES="$DEFINES -DNDEBUG"
OPTIMIZE=" -O2 -finline-functions"
+ # following two lines are compatibility while Patchy has not
+ # yet learnt about --enable-checking. But once it has, we
+ # don't want -DDEBUG twice, so we omit it here if it is going
+ # to get added anyway later.
+ elif test "$checks_b" != yes; then
+ DEFINES="$DEFINES -DDEBUG"
+ fi
+
+ if test "$checks_b" = yes; then
+ DEFINES="$DEFINES -DDEBUG"
fi
if test $profile_b = yes; then
}
void OK () const
{
-#ifndef NDEBUG
+#ifdef DEBUG
for (vsize i = 2; i <= size (); i++)
assert (compare (elt (i / 2), elt (i)) <= 0);
#endif
/*
leads to dubious crashes - libstdc++ bug?
*/
-#ifndef NDEBUG
+#ifdef DEBUG
#define _GLIBCXX_DEBUG 1
#endif
#endif
/*
leads to dubious crashes - libstdc++ bug?
*/
-#ifndef NDEBUG
+#ifdef DEBUG
#define _GLIBCXX_DEBUG 1
#endif
#endif
Context *
Context::where_defined (SCM sym, SCM *value) const
{
-#ifndef NDEBUG
+#ifdef DEBUG
if (profile_property_accesses)
note_property_access (&context_property_lookup_table, sym);
#endif
bool
Context::here_defined (SCM sym, SCM *value) const
{
-#ifndef NDEBUG
+#ifdef DEBUG
if (profile_property_accesses)
note_property_access (&context_property_lookup_table, sym);
#endif
SCM
Context::internal_get_property (SCM sym) const
{
-#ifndef NDEBUG
+#ifdef DEBUG
if (profile_property_accesses)
note_property_access (&context_property_lookup_table, sym);
#endif
{
}
-#ifndef NDEBUG
+#ifdef DEBUG
static SCM creation_callback = SCM_EOL;
LY_DEFINE (ly_set_grob_creation_callback, "ly:set-grob-creation-callback",
1, 0, 0, (SCM cb),
int line,
char const *fun)
{
-#ifdef NDEBUG
+#ifndef DEBUG
(void)file;
(void)line;
(void)fun;
assert (grob);
announce_grob (grob, cause);
-#ifndef NDEBUG
+#ifdef DEBUG
if (ly_is_procedure (creation_callback))
scm_apply_0 (creation_callback,
scm_list_n (grob->self_scm (), scm_from_utf8_string (file),
extern bool debug_property_callbacks;
-#ifndef NDEBUG
+#ifdef DEBUG
static void
print_property_callback_stack ()
{
int line,
char const *fun)
{
-#ifndef NDEBUG
+#ifdef DEBUG
if (ly_is_procedure (modification_callback))
scm_apply_0 (modification_callback,
scm_list_n (self_scm (),
SCM
Grob::internal_get_property_data (SCM sym) const
{
-#ifndef NDEBUG
+#ifdef DEBUG
if (profile_property_accesses)
note_property_access (&grob_property_lookup_table, sym);
#endif
{
SCM val = get_property_data (sym);
-#ifndef NDEBUG
+#ifdef DEBUG
if (scm_is_eq (val, ly_symbol2scm ("calculation-in-progress")))
{
programming_error (to_string ("cyclic dependency: calculation-in-progress encountered for #'%s (%s)",
*/
*alist = scm_assq_set_x (*alist, sym, marker);
-#ifndef NDEBUG
+#ifdef DEBUG
if (debug_property_callbacks)
grob_property_callback_stack = scm_cons (scm_list_3 (self_scm (), sym, proc), grob_property_callback_stack);
#endif
false, 0, 0);
}
-#ifndef NDEBUG
+#ifdef DEBUG
if (debug_property_callbacks)
grob_property_callback_stack = scm_cdr (grob_property_callback_stack);
#endif
}
else
{
-#ifndef NDEBUG
+#ifdef DEBUG
if (ly_is_procedure (cache_callback))
scm_apply_0 (cache_callback,
scm_list_n (self_scm (),
#define set_object(x, y) internal_set_object (ly_symbol2scm (x), y)
#define del_property(x) internal_del_property (ly_symbol2scm (x))
-#ifndef NDEBUG
+#ifdef DEBUG
/*
TODO: include modification callback support here, perhaps
through intermediate Grob::instrumented_set_property( .. __LINE__ ).
// least some, so they are apparently not protected in spite of being
// included in the GC scans. So it would appear that scanning smobs
// is not equivalent to marking them. Ugh.
-#if !defined(NDEBUG) && !GUILEV2
+#if defined(DEBUG) && !GUILEV2
#define ASSERT_LIVE_IS_ALLOWED(arg) \
do { \
static parsed_dead pass_here; \
const Real epsilon = 0.01;
-#ifndef NDEBUG
+#ifdef DEBUG
/* remove consecutive duplicate points */
for (vsize i = 0; i < points.size (); i++)
{
SCM
Prob::internal_get_property (SCM sym) const
{
-#ifndef NDEBUG
+#ifdef DEBUG
if (profile_property_accesses)
note_property_access (&prob_property_lookup_table, sym);
#endif