[erlang-questions] Debugging c code when interoperating with erlang

Richard Evans <>
Tue Jun 14 13:13:36 CEST 2011

I have a c program which interoperates with erlang, following the guidelines
described in Joe Armstrong's book and in the erlang docs:

Everything works nicely, but I sometimes have problems debugging the c

Specifically: if I attach the debugger to the c process, with breakpoints
*already* added, then I can debug the c code fine. But if I attach the
debugger to the c process, and *then* add extra breakpoints, this causes the
erlang calling code to break.

It gives the error:
** exception error: bad argument
     in function  server:call_port/1

The call_port function is the standard one:

   call_port(Msg) ->

    server ! {call, self(), Msg},


        {server, Result} ->


Do you guys know why this would happen? (I am using Xcode 4.0, Mac OSX 10.6,
Erlang R14B01).

A further question: if my c code crashes, the erlang node hangs; I have to
run again to reproduce the problem. Is it possible to get the erlang node to
print out a dump or anything?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110614/1b41edf8/attachment.html>

More information about the erlang-questions mailing list