[erlang-questions] Debugger bug!

Gordon Guthrie <>
Tue Dec 12 22:37:35 CET 2006


I seem to be hitting a debugger bug in R10B.

I have the following function:

%%%-----------------------------------------------------------------------------
%%% File        : bug.erl
%%% Author      : Gordon Guthrie <>
%%% Description :
%%%
%%% Created     : 12 Dec 2006 by Gordon Guthrie
<>
%%%               Module chopped down to reproduce the bug in a small
function
%%%-----------------------------------------------------------------------------
-module(bug).

-export([apply/2]).

apply(Function,List)->
    {Vals,RefTree,Errors,Refs}={[1,2],[],[],[]},
    case Errors of
	[] -> try {erlang:apply(util,list_to_atom(Function),Vals),
		   RefTree,Errors,Refs}
	      catch
		  exit:Reason ->
		      {0,RefTree,[{exit,Reason}|Errors],Refs};
		    error:Reason ->
		      {0,RefTree,[{error,Reason}|Errors],Refs}
	      end;
	Other -> {0,RefTree,Errors,Refs} % Don't calc if there is an error
    end.


In the shell it compiles fine with debugging on - and then a quick start
of the toolbar...

6> c(bug, [debug_info]).
./bug.erl:13: Warning: variable 'List' is unused
./bug.erl:24: Warning: variable 'Other' is unused
7>toolbar:start().

Then using the toolbar to load the debugger and try and interpret the beam
file and it all blows up...

{'try',16,
       [{tuple,16,
               [{call,16,
                      {remote,16,{atom,16,erlang},{atom,16,apply}},
                      [{atom,16,util},
                       {call,16,
                             {remote,16,
                                     {atom,16,erlang},
                                     {atom,16,list_to_atom}},
                             [{var,16,'Function'}]},
                       {var,16,'Vals'}]},
                {var,17,'RefTree'},
                {var,17,'Errors'},
                {var,17,'Refs'}]}],
       [],
       [{clause,19,
                [{tuple,19,[{atom,19,exit},{var,19,'Reason'},{var,19,'_'}]}],
                [],
                [{tuple,20,
                        [{integer,20,0},
                         {var,20,'RefTree'},

********Snipped*******************

=ERROR REPORT==== 12-Dec-2006::21:29:25 ===
** Generic server dbg_iserver terminating
** Last message in was {load,bug,
                             "/opt/erlang_apps/bug/bug.erl",
                             <<131,104,5,100,0,18,105,110,116,101,114,112,114,101,116,101,114,95,109,111,100,117,108,101,108,0,0,0,3,104,2,100,0,5,97,112,112,108,121,97,2,104,2,100,0,11,109,111,100,117,108,101,95,105,110,102,111,97,0,104,2,100,0,11,109,111,100,117,108,101,95,105,110,102,111,97,1,106,104,2,100,0,15,114,97,119,95,97,98,115,116,114,97,99,116,95,118,49,108,0,0,0,5,104,4,100,0,9,97,116

********Snipped*******************

** When Server state == {state,43,[],[],false,all,[]}
** Reason for termination ==
** {{badmatch,{dbg_iload,{unknown_expr,
                             {'try',16,
                                    [{tuple,
                                         16,
                                         [{call,
                                              16,
                                              {remote,
                                                  16,
                                                  {atom,16,erlang},


********Snipped*******************

Gordon



More information about the erlang-questions mailing list