<div>You might need to pause the whole VM if you don't want things to crash when you have timers waiting. See, as an example, gen_server:call/2 has a default timeout of 5 seconds, after which the caller dies. If you're pausing a server to observe it through a breakpoint, then the caller will crash (unless you're damn fast to step through the code). Now if the two processes are linked together, you just crashed the process you were stepping through and the debugger failed you.<br>
</div><div><br></div><div>It's why I said it's mostly good for sequential code. If you've got side-effect going around and stuff inter-connected, timeouts and crashes can hurt your ability to use the debugger. Be careful about it, tracing might be your only option many times.</div>
<br><div class="gmail_quote">On Sun, Oct 23, 2011 at 9:41 AM, Kaiduan Xie <span dir="ltr"><<a href="mailto:kaiduanx@gmail.com">kaiduanx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
No, we do not need to pause the entire VM to debug a process, we just<br>
pause the particular process.<br>
<br>
In C/C++/Java, we all can step-through an multi-thread program,<br>
<div><div class="h5"><br>
On Sun, Oct 23, 2011 at 9:06 AM, Fred Hebert <<a href="mailto:mononcqc@gmail.com">mononcqc@gmail.com</a>> wrote:<br>
> Stepping through the code works okay when you've got only sequential code,<br>
> but if you have a lot of code sensitive to timers and concurrency, then<br>
> stepping through the code of one process will mess with all the timers<br>
> currently running for other processes. As far as I know, there is no<br>
> debugging facility letting you pause the entire VM at once.<br>
><br>
> On Sun, Oct 23, 2011 at 1:31 AM, Kaiduan Xie <<a href="mailto:kaiduanx@gmail.com">kaiduanx@gmail.com</a>> wrote:<br>
>><br>
>> I like and use trace, but my fellow developers are hard-cored JAVA<br>
>> developers, they want to be able to step through the code.<br>
>><br>
>> /Kaiduan<br>
>><br>
>> On Sun, Oct 23, 2011 at 1:27 AM, Chandru<br>
>> <<a href="mailto:chandrashekhar.mullaparthi@gmail.com">chandrashekhar.mullaparthi@gmail.com</a>> wrote:<br>
>> > On 21 October 2011 17:30, Kaiduan Xie <<a href="mailto:kaiduanx@gmail.com">kaiduanx@gmail.com</a>> wrote:<br>
>> >><br>
>> >> Hi,<br>
>> >><br>
>> >> We need to debug an Erlang server running in an embedded system where<br>
>> >> no GUI is available. We can attach an Erlang shell to the server from<br>
>> >> a remote box with GUI. Can we use debugger on GUI box to remote debug<br>
>> >> the server on embedded system? Can someone share the experience?<br>
>> >><br>
>> ><br>
>> > You can use the in built trace facilities? I personally use dbg whenever<br>
>> > I<br>
>> > need to look at a running system and figure out what is happening. Some<br>
>> > care<br>
>> > is needed on what parts of the system you trace to make sure you don't<br>
>> > swamp<br>
>> > the system with traces. I have rendered a few systems unsuable because<br>
>> > of<br>
>> > the volume of tracing if the wrong trace pattern is chosen :) I<br>
>> > typically<br>
>> > use something like this:<br>
>> ><br>
>> > dbg:tracer(port, dbg:trace_port(file, "trace_file.dbg")).<br>
>> > dbg:p(all,call).<br>
>> > dbg:tp(module, function, dbg:fun2ms(fun(_) -> return_trace() end)).<br>
>> ><br>
>> > Traces will now start to be written to the file trace_file.dbg<br>
>> ><br>
>> > Once you've collected enough traces:<br>
>> > dbg:ctp().<br>
>> > dbg:flush_trace_port().<br>
>> ><br>
>> > You can then examine the trace file (binary file) using commands in dbg.<br>
>> > I<br>
>> > use the attached module to convert it to plain text.<br>
>> ><br>
>> > Or you can take a look at redbug: <a href="https://code.google.com/p/eper/" target="_blank">https://code.google.com/p/eper/</a><br>
>> ><br>
>> > cheers<br>
>> > Chandru<br>
>> ><br>
>> ><br>
>> _______________________________________________<br>
>> erlang-questions mailing list<br>
>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
><br>
</div></div></blockquote></div><br>