Trace a particular record with dbg:fun2ms

Magnus Henoch <>
Thu Jul 9 16:20:44 CEST 2009


Kaiduan Xie <> writes:

> 6> dbg:fun2ms(fun(#person{firstname = F, lastname = L}) when F ==
> "erlanger" -> true end).
> Error: dbg:fun2ms requires fun with single variable or list parameter
> {error,transform_error}

The function passed to dbg:fun2ms takes a single argument, the _list_ of
the arguments to the traced function - in this case, a list with a
single element.  Like this:

5> dbg:fun2ms(fun([#person{firstname = F, lastname = L}]) when F ==
"erlanger" -> true end).
[{[#person{firstname = '$1',lastname = '$2'}],
  [{'==','$1',"erlanger"}],
  [true]}]

-- 
Magnus Henoch, 
Erlang Training and Consulting
http://www.erlang-consulting.com/


More information about the erlang-questions mailing list