Trace a particular record with dbg:fun2ms

Kaiduan Xie <>
Thu Jul 9 19:24:39 CEST 2009


Thanks a lot, Magnus. I misunderstood that a record is a single variable too.

kaiduan

On Thu, Jul 9, 2009 at 10:20 AM, Magnus
Henoch<> wrote:
> 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