[erlang-questions] How to configure otp for a debug build (with otp_build)?
Winston Smith
smith.winston.101@REDACTED
Sat Sep 10 06:02:25 CEST 2011
On Fri, Sep 9, 2011 at 4:47 AM, Gustav Simonsson
<gustav.simonsson@REDACTED> wrote:
> There is a line with "CFLAGS=" in the xcomp file where you can add flags to gcc,
> such as debug options found in
> http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Debugging-Options.html#Debugging-Options
I think there's more to it than that. At the very least, you need to
swap the -O2 (or whatever Erlang builds with by default) for -g and
also define -DDEBUG, but there's also the fact that you don't want
symbols stripped for a debug build. So a debug version is something
that really has to be "embraced" by otp_build. After some digging, I
found the following notes:
http://www.erlang.org/doc/installation_guide/INSTALL.html#How-to-Build-a-Debug-Enabled-Erlang-RunTime-System
These basically that say that after configuring to go into
$ERL_TOP/erts/emulator and run:
make debug FLAVOR=plain
But for an xcomp (cross compile) configuration, this simply built a
debug version of the host system's Erlang (not the target systems
which is what I need). Note that in this case, the host system is my
Ubuntu 11.04 x64 system, the target is my AVR32 Linux board. I found
that if you invoke make as follows, then it'll build a debug version
for the target (not the host!):
make debug FLAVOR=plain TARGET=avr32-atmel-linux-gnu
Since my segmentation fault seems to be related to inet_gethost, I
found that this wasn't building a debug version of inet_gethost, so I
also had to go into $ERL_TOP/erts/etc/common and run the same make
command, again as follows:
make debug FLAVOR=plain TARGET=avr32-atmel-linux-gnu
In order to get a debug version of inet_gethost. Note that this
make-debug invocation does in fact produce unstripped debug
executables which is a necessity for debugging.
I don't know how successful this was/will be [in terms of tracking
down my segmentation fault], but I'm about to start testing it now
...!
Thanks!
Winston.
More information about the erlang-questions
mailing list