Hi all,
While trying to implement recording on the Fuze+ I stumbled upon a very
nasty bug which took me quite a few hours do track, so I would like to make
you aware of it and ask for advise. To cut the long story short: if you
compile rockbox in DEBUG, any attempt to record something will result in a
crash.

If you compile rockbox in debug mode (select Debug in tools/configure), the
following will happen:

* -DDEBUG will be added to GCCOPTS in Makefile
* the codec "vtable" will get an additional field in firmware build:
(lib/rbcodec/codecs/codecs.h):
#if defined(DEBUG) || defined(SIMULATOR)
    void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
#endif
* the rbcodec makefile will undefine DEBUG:
(lib/rbcodec/codecs/codecs.make):
 CODECFLAGS += -UDEBUG -DNDEBUG
* the codecs will be built without the additional field in codec vtable and
without DEBUG
* the encoder codecs will be broken because all the encoder specific
functions are *after* debugf in the "vtable", but the playback ones will be
fine thus you probably won't notice it.
* this will result in a very hard to debug crash when trying to record

The question I have now is: why on earth rbcodecs.make undefine DEBUG ? The
obvious fix would be to remove this but since I don't understand why it was
introduced in the first place I don't want to break something else.

Thanks,

Amaury Pouly

Reply via email to