[erlang-questions] dbg:tracer() aborts on binary match

Jon Meredith jmeredith@REDACTED
Tue Aug 5 00:07:58 CEST 2008


Hi,

I'm writing a small parser for reading log lines.  When it didn't do  
what I expected I tried to use dbg:tracer() to see where it was going  
wrong and it aborted.  Here is the cut down minimal test case.

I'm expecting it to match and then try and call parse_headers with Hdr  
added to the Hdrs list, but instead the VM aborts.  Am I doing  
something wrong/strange?

Many thanks, Jon.

%% Abort when running dbg:tracer().
%%
%% 1> binbug:bug().
%% size_object: matchstate term not allowedAbort trap

-module(binbug).
-export([bug/0,
          parse_headers/4]).

parse_headers(<<"\\r\\n", T/binary>>, Hdr, Hdrs, Toks) ->
     parse_headers(T, <<>>, [Hdr | Hdrs], Toks).

bug() ->
     dbg:tracer(),
     dbg:p(all, call),
     dbg:tpl(?MODULE, []),
     parse_headers(<<"\\r\\n]">>, <<"hdr1">>, [], []).



More information about the erlang-questions mailing list