Determine where a match fails

Gunilla Arendt gunilla@REDACTED
Thu Jan 5 09:34:08 CET 2006


Have you tried the interpreter/Debugger?

Compile the modules with the 'debug_info' option, then interpret them:

1> int:i(Mod).
or
1> int:i([Mod1, ..., ModN]).
or
start the Debugger (debugger:start()) and use its GUI.

Then run your program. When the error occurs, start the Debugger and
double-click the terminated process. This will open an Attach Process
window showing on which line in which module the process terminated *)
and you can use the 'Up' button to traverse the call chain leading
to the error.

*) ...provided that the process did terminate while executing
interpreted code... If the process is a gen_server or similar, the error
will be caught and the process will terminate while in (uninterpreted)
gen_server code. In this case, using the Debugger for stepping through
the code may be an alternative.

/ Gunilla

Dave Smith wrote:
> Greetings,
> 
> Is there a way to determine the File/Line where a badmatch error is  
> generated? Obviously, you get a stack trace with the function call,  but 
> more often than not, that's not quite descriptive enough, since  all you 
> get is the value that didn't match...something.
> 
> Any guidance would be appreciated. :)
> 
> Thanks.
> 
> D.
> 
> 




More information about the erlang-questions mailing list