I have a c program which interoperates with erlang, following the guidelines described in Joe Armstrong's book and in the erlang docs: <a href="http://www.erlang.org/doc/tutorial/c_port.html#id56436">http://www.erlang.org/doc/tutorial/c_port.html#id56436</a><div>
<br></div><div>Everything works nicely, but I sometimes have problems debugging the c code. </div><div><br></div><div>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. </div>
<div><br></div><div>It gives the error:</div><div>** exception error: bad argument</div><div> in function server:call_port/1</div><div><br></div><div>The call_port function is the standard one:</div><div><br></div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}
</style>
<p class="p1">call_port(Msg) -> </p>
<p class="p1"> server ! {call, self(), Msg},</p>
<p class="p1"> receive</p>
<p class="p1"> {server, Result} -></p>
<p class="p1"> Result</p>
<div><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; "> end.</span> </div><div><br></div><div><meta charset="utf-8">Do you guys know why this would happen? (I am using Xcode 4.0, Mac OSX 10.6, Erlang R14B01).</div>
<div><br></div><div>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? </div><div><br></div>
<div>thanks,</div><div>Richard</div>