<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>Thanks for the response. </div><div><br></div><div>I'm trying to look for the (unescaped) character string \r\n (0x5c 0x72 0x5c 0x6e) from inside a squid access log with HTTP header information delimited by \r\n. I think I've escaped it correctly.</div><div><br></div><div>Here's an alternative version with the escaping ambiguity removed.</div><div><br></div><div><div>%% Abort when running dbg:tracer().</div><div>%%</div><div>%% 1> binbug:bug().</div><div>%% size_object: matchstate term not allowedAbort trap</div><div><br></div><div>-module(binbug2).</div><div>-export([bug/0,</div><div> parse_headers/4]).</div><div><br></div><div>parse_headers(<<92:8, 114:8, 92:8, 110:8, T/binary>>, Hdr, Hdrs, Toks) -></div><div> parse_headers(T, <<>>, [Hdr | Hdrs], Toks).</div><div><br></div><div>bug() -></div><div> dbg:tracer(),</div><div> dbg:p(all, call),</div><div> dbg:tpl(?MODULE, []),</div><div> parse_headers(<<92:8, 114:8, 92:8, 110:8, 10:8>>, <<>>, [], []).</div><div><br></div></div><div><br></div><div><br></div><div>Jon</div><div><br><div><div>On Aug 5, 2008, at 1:27 AM, Hynek Vychodil wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">There is wrong escaping off topic. It should be:<br><br>parse_headers(<<"\r\n", T/binary>>, Hdr, Hdrs, Toks) -><br> parse_headers(T, <<>>, [Hdr | Hdrs], Toks).<br> <br> bug() -><br> dbg:tracer(),<br> dbg:p(all, call),<br> dbg:tpl(?MODULE, []),<br> parse_headers(<<"\r\n]">>, <<"hdr1">>, [], []).<br><br><br><div class="gmail_quote">On Tue, Aug 5, 2008 at 12:07 AM, Jon Meredith <span dir="ltr"><<a href="mailto:jmeredith@thehive.com">jmeredith@thehive.com</a>></span> wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br> <br> I'm writing a small parser for reading log lines. When it didn't do<br> what I expected I tried to use dbg:tracer() to see where it was going<br> wrong and it aborted. Here is the cut down minimal test case.<br> <br> I'm expecting it to match and then try and call parse_headers with Hdr<br> added to the Hdrs list, but instead the VM aborts. Am I doing<br> something wrong/strange?<br> <br> Many thanks, Jon.<br> <br> %% Abort when running dbg:tracer().<br> %%<br> %% 1> binbug:bug().<br> %% size_object: matchstate term not allowedAbort trap<br> <br> -module(binbug).<br> -export([bug/0,<br> parse_headers/4]).<br> <br> parse_headers(<<"\\r\\n", T/binary>>, Hdr, Hdrs, Toks) -><br> parse_headers(T, <<>>, [Hdr | Hdrs], Toks).<br> <br> bug() -><br> dbg:tracer(),<br> dbg:p(all, call),<br> dbg:tpl(?MODULE, []),<br> parse_headers(<<"\\r\\n]">>, <<"hdr1">>, [], []).<br> _______________________________________________<br> erlang-questions mailing list<br> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br> </blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil<br> </div></blockquote></div><br></div></body></html>