[erlang-questions] Change in Semantics in dbg:c ?

Francesco Cesarini francesco@REDACTED
Sun Sep 7 12:02:42 CEST 2008


I was working through some old training material from 2001, testing the 
output on R12. I am getting significantly different behaviours 
in-between the releases which I was not expecting.

The example I use (Attached to the mail) spawn_links a process which 
goes into a receive loop. When the child receives a ping message, it 
spawns a new process which immediately fails with reason undef and loops 
on itself.

In the older release (Probably R9), tracing a function which does a 
spawn_link using dbg:c/4 setting the process trace flags and the set on 
spawn flags, I get all of the events and set on spawn works. More calls 
using dbg:c affecting the child process obviously demonstrate that the 
child inherited the trace flags.

Using R12, first thing I get is an unlinked trace event. Subsequent 
messages to the process do not generate any new trace events. In R12 
(possibly earlier), a quick look confirms my suspicions; an intermediate 
process has been inserted between the shell and the child, and when this 
process terminates, the unlink event is generated. Is this the intended 
behaviour? I would say the old behaviour is the correct one, as the 
documentation states that dbg:c/4 it is a traced variant of apply/3. If 
so, the unlink trace message should not be received, and the state (sos 
and sofl trace flags) should be maintained in-between calls. Either way, 
either the documentation is incorrect or the intermediary process should 
be removed. Which version would you like documented in the book?

Old Release (Probably R9):

2> Pid =  dbg:c(ping, start, [], [p, sos]).
<0.31.0>
(<0.21.0>) spawn <0.31.0>
(<0.21.0>) link <0.31.0>
3>  dbg:c(ping, send, [Pid], [p, sos]).   
(<0.31.0>) spawn <0.33.0>
pong
(<0.33.0>) exit {undef,[{crash,do_not_exist,[]}]}

R12:
4> Pid =  dbg:c(ping, start, [], [p, sos]).
(<0.41.0>) spawn <0.42.0> as ping:loop()
(<0.41.0>) link <0.42.0>
(<0.42.0>) getting_unlinked <0.41.0>
<0.42.0>
5> dbg:c(ping, send, [Pid], [p, sos]).   
pong
6>   

=ERROR REPORT==== 7-Sep-2008::10:42:42 ===
Error in process <0.48.0> with exit value: {undef,[{crash,do_not_exist,[]}]}

Suggestions?

Regards,
Francesco
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ping.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080907/94b8c588/attachment.ksh>


More information about the erlang-questions mailing list