Erlang/OTP Forums

Author Message

<  Erlang questions mailing list  ~  [erlang-questions] UI Debugger

jverger
Posted: Wed Sep 06, 2006 12:24 pm Reply with quote
Joined: 06 Sep 2006 Posts: 3
Hi all,
I'm trying to debug an application that is running in our production
and development servers. I would like to debug it remotely, from my
own machine. I'm looking for a debugger, if possible with GUI ... if
not, pure text, pure console Smile))))

I have tried debugger (debugger:start().) but it looks that it cann't
debug remetely.
I don't get to make TDB to work,

I bet there are some usefull debuggers for remote servers. Any sugestions?

Thanks,


Jean
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message
taavi
Posted: Wed Sep 06, 2006 12:36 pm Reply with quote
User Joined: 28 Feb 2005 Posts: 30 Location: Estonia
> Hi all,
> I'm trying to debug an application that is running in our production
> and development servers. I would like to debug it remotely, from my
> own machine. I'm looking for a debugger, if possible with GUI ... if
> not, pure text, pure console Smile))))
>
> I have tried debugger (debugger:start().) but it looks that it cann't
> debug remetely.
> I don't get to make TDB to work,
>
> I bet there are some usefull debuggers for remote servers. Any
> sugestions?

Pure console:

erl -name myworkstation@example.com -setcookie secret_cookie -remsh
my_production_node@example.com

Remember to use ^G and the q for exiting. Otherwize using halt() or q()
stops production
node.

best regards,
taavi

_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message
jverger
Posted: Wed Sep 06, 2006 12:45 pm Reply with quote
Joined: 06 Sep 2006 Posts: 3
Hi,
thanks for your reply. I have already tried that. Following that
approach, I can login remotely (similar as ssh I believe) ...After
that .. what debugger can I run? debugger:start(). doesn't work since
is remote ... Sad I don't know how to make the X11 work remotely.

Ah, thanks for your comment on q(). , ^G and halt, something new I
learn today Smile

regards,

jean

On 9/6/06, Taavi Talvik <taavi@uninet.ee> wrote:
>
> > Hi all,
> > I'm trying to debug an application that is running in our production
> > and development servers. I would like to debug it remotely, from my
> > own machine. I'm looking for a debugger, if possible with GUI ... if
> > not, pure text, pure console Smile))))
> >
> > I have tried debugger (debugger:start().) but it looks that it cann't
> > debug remetely.
> > I don't get to make TDB to work,
> >
> > I bet there are some usefull debuggers for remote servers. Any
> > sugestions?
>
> Pure console:
>
> erl -name myworkstation@example.com -setcookie secret_cookie -remsh
> my_production_node@example.com
>
> Remember to use ^G and the q for exiting. Otherwize using halt() or q()
> stops production
> node.
>
> best regards,
> taavi
>
>
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message
mats
Posted: Wed Sep 06, 2006 12:55 pm Reply with quote
User Joined: 28 Feb 2005 Posts: 168 Location: budapest,hungary
Jean Verger wrote:

> I bet there are some usefull debuggers for remote servers. Any sugestions?

distel (jungerl.sourceforge.net) can connect to a remote machine. allows you
to use emacs as debugger GUI. not recommended for vi-users....

mats
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message MSN Messenger
vladdu
Posted: Wed Sep 06, 2006 1:00 pm Reply with quote
User Joined: 28 Feb 2005 Posts: 397 Location: Gothenburg, Sweden
On 9/6/06, Jean Verger <jean.verger@gmail.com> wrote:
> I bet there are some usefull debuggers for remote servers. Any sugestions?

Hi,

>From the debugger's user guide
(http://www.erlang.org/doc/doc-5.5.1/lib/debugger-3.1/doc/html/part_frame.html):

1.11 Debugging Remote Nodes
By using debugger:start/1, it can be specified if Debugger should be
started in local or global mode.

debugger:start(local | global)

If no argument is provided, Debugger is started in global mode.

In local mode, code is interpreted only at the current node. In global
mode, code is interpreted at all known nodes. Processes at other nodes
executing interpreted code will automatically be shown in the Monitor
window and can be attached to like any other debugged process.

It is possible, but definitely not recommended to start Debugger in
global mode on more than one node in a network, as they will interfer
with each other leading to inconsistent behaviour.

regards,
Vlad
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message
asergey
Posted: Wed Sep 06, 2006 1:19 pm Reply with quote
User Joined: 12 Mar 2005 Posts: 313
Jean Verger wrote:
> Hi,
> thanks for your reply. I have already tried that. Following that
> approach, I can login remotely (similar as ssh I believe) ...After
> that .. what debugger can I run? debugger:start(). doesn't work since
> is remote ... Sad I don't know how to make the X11 work remotely.
>
> Ah, thanks for your comment on q(). , ^G and halt, something new I
> learn today Smile
>
> regards,
>
> jean

Aside from using the dubbuger interface, another way to debug a program
on a production node is to use the dbg's tracing facility.

Below you can find a sample user_default.erl file that you can load on a
remote system using "~/.erlang" file:

$ cat .erlang
code:load_abs("/opt/erlang/usr/user_default").

It'll expand the shell with convenient tracing shortcuts. The tracing
output will be printed to the screen. Run help() at the shell to ensure
that the module is loaded:

[serge@devlinuxpro: ~]
$ erl
Erlang (BEAM) emulator version 5.5 [source] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.5 (abort with ^G)
1> help().
...
** user extended commands **
dbgtc(File) -- use dbg:trace_client() to read data from File
dbgon(M) -- enable dbg tracer on all funs in module M
dbgon(M,Fun) -- enable dbg tracer for module M and function F
dbgon(M,File) -- enable dbg tracer for module M and log to File
dbgadd(M) -- enable call tracer for module M
dbgadd(M,F) -- enable call tracer for function M:F
dbgdel(M) -- disable call tracer for module M
dbgdel(M,F) -- disable call tracer for function M:F
dbgoff() -- disable dbg tracer (calls dbg:stop/0)

Note that tracing (as well as debugging) does slow down performance, and
may have significant impact on performance of a production node unless
you know what you are doing.

Regards,

Serge

--------------------------------------------

-module(user_default).
-author('serge@hq.idt.net').

-export([help/0,dbgtc/1, dbgon/1, dbgon/2,
dbgadd/1, dbgadd/2, dbgdel/1, dbgdel/2, dbgoff/0]).

-import(io, [format/1]).

help() ->
shell_default:help(),
format("** user extended commands **~n"),
format("dbgtc(File) -- use dbg:trace_client() to read data from
File\n"),
format("dbgon(M) -- enable dbg tracer on all funs in module M\n"),
format("dbgon(M,Fun) -- enable dbg tracer for module M and
function F\n"),
format("dbgon(M,File) -- enable dbg tracer for module M and log to
File\n"),
format("dbgadd(M) -- enable call tracer for module M\n"),
format("dbgadd(M,F) -- enable call tracer for function M:F\n"),
format("dbgdel(M) -- disable call tracer for module M\n"),
format("dbgdel(M,F) -- disable call tracer for function M:F\n"),
format("dbgoff() -- disable dbg tracer (calls dbg:stop/0)\n"),
format("l() -- load all changed modules\n"),
format("nl() -- load all changed modules on all known
nodes\n"),
format("mm() -- list modified modules\n"),
true.

dbgtc(File) ->
Fun = fun({trace,_,call,{M,F,A}}, _) ->
io:format("call: ~w:~w~w~n", [M,F,A]);
({trace,_,return_from,{M,F,A},R}, _) ->
io:format("retn: ~w:~w/~w -> ~w~n", [M,F,A,R]);
(A,B) ->
io:format("~w: ~w~n", [A,B])
end,
dbg:trace_client(file, File, {Fun, []}).

dbgon(Module) ->
case dbg:tracer() of
{ok,_} ->
dbg:p(all,call),
dbg:tpl(Module, [{'_',[],[{return_trace}]}]),
ok;
Else ->
Else
end.

dbgon(Module, Fun) when is_atom(Fun) ->
{ok,_} = dbg:tracer(),
dbg:p(all,call),
dbg:tpl(Module, Fun, [{'_',[],[{return_trace}]}]),
ok;

dbgon(Module, File) when is_list(File) ->
{ok,_} = dbg:tracer(file, dbg:trace_port(file, File)),
dbg:p(all,call),
dbg:tpl(Module, [{'_',[],[{return_trace}]}]),
ok.

dbgadd(Module) ->
dbg:tpl(Module, [{'_',[],[{return_trace}]}]),
ok.

dbgadd(Module, Fun) ->
dbg:tpl(Module, Fun, [{'_',[],[{return_trace}]}]),
ok.

dbgdel(Module) ->
dbg:ctpl(Module),
ok.

dbgdel(Module, Fun) ->
dbg:ctpl(Module, Fun),
ok.

dbgoff() ->
dbg:stop().

_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum