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

Hynek Vychodil <>
Tue Aug 5 09:27:30 CEST 2008


There is wrong escaping off topic. It should be:

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">>, [], []).


On Tue, Aug 5, 2008 at 12:07 AM, Jon Meredith <> wrote:

> 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">>, [], []).
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080805/e025bf08/attachment.html>


More information about the erlang-questions mailing list