How to debug the Erlang Program

Source: Internet
Author: User

Debugging is a very important process in the Process of program development. For some debugging, it may be the most difficult step in the development process,
Mastering debugging tools and methods can improve the debugging efficiency.

Erlang's debugger is a GUI debugging tool. This document describes how to use this tool.

1. Compile
Only modules with debug_info added during compilation can be debugged.
Add the debug_info flag to Erlang shell as follows:
1> C (module, debug_info ).
An example of using ERlC is as follows:
ERlC + debug_info Ms. erl

2. Start
The debugger can be started through Debugger: Start () or IM ().
Start can be suspended mode, the default is global mode, that is, all known nodes this module

3. Specify the debugging Module
By default, there are no Debugging Processes. You can debug the processes that execute the Code only by specifying which modules need to be debugged,
The process specified as a debugging module is named as an interpreted module.
Choose "module-> interpret" from the menu item to select a file. If the file does not have the debug information, an error message is displayed,
After loading, you can view the source code through module-> View, and double-click the code line to set the breakpoint.

4. debugging
After a module is marked as interpreted, we can set a breakpoint for the code in this module, and the processes started afterwards will enter the debugging status.
You can also choose process> attach from the menu to attach a running process.

5. Special Cases
When we use the behavior of OTP, our automatic modules are all called back,
Running the OTP behavior code. We can see that the process is in the idle state.

Reprinted: http://blog.csdn.net/xperson/archive/2009/06/08/4250332.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.