Erlang Online Generation CrashDump

Source: Internet
Author: User

Generally catch dump 4 ways: 1.     Erlang:halt ("Abort"). 2. Under Erlang shell, enter CTRL C + "uppercase a" 3. Wait for the process to crash itself generate dump 4.KILL-SIGUSR1 <pid> (can be used when the shell is inaccessible) but 4 ways no need no  De crash off, what if I just want to sapshot a process state for analysis? Find the answer in Google Groups, now the link can not find, share:
Crash_dump ()Date=erlang:list_to_binary (Rfc1123_local_date ()), Header= Binary:list_to_bin ([<< "=erl_crash_dump:0.2\n" >>,Date,<< "\nsystem version:" >>]), Ets=ets_info (), report=Binary:list_to_bin ([Header,erlang:list_to_binary (Erlang:system_info (system_version)), Erlang:system_info (info), Erlang:system_info (procs), Ets,erlang:system_info (Dist),<< "=loaded_modules\n" >>, Binary:replace (Erlang:system_info (loaded), << "\ n" >>,<< "\n=mod:" >>, [Global]]), File:write_file ("Erl_crash.dump", Report). Ets_info ()-Binary:list_to_bin ([Ets_table_info (T)|| t<-Ets:all ()]). Ets_table_info (table)-Info=Ets:info (Table), Owner=erlang:list_to_binary (Erlang:pid_to_list (Proplists:get_value (Owner,info)), Tablen=erlang:list_to_binary (Erlang:atom_to_list (Proplists:get_value (Name,info))), name=erlang:list_to_binary (Erlang:atom_to_list (Proplists:get_value (Name,info)), Objects=erlang:list_to_binary (Erlang:integer_to_list (Proplists:get_value (Size,info)), Binary:list_to_bin ([<< "=ets:" >>,Owner,<< "\ntable:" >>,TableN,<< "\nname:" >>, Name,<< "\nobjects:" >>,Objects,<< "\ n" >>]). Rfc1123_local_date ()-rfc1123_local_date (Os:timestamp ()). Rfc1123_local_date ({a,b,c})-Rfc1123_local_date (Calendar:now_to_local_time ({a,b,c})); Rfc1123_local_date ({{yyyy,mm,dd},{hour,min,sec}}) -Daynumber=Calendar:day_of_the_week ({yyyy,mm,dd}), Lists:flatten (Io_lib:format ("~s, ~2.2.0w ~3.s ~4.4.0w ~2.2.0w:~2.2.0w:~2.2.0w GMT", [Httpd_util:day (Daynumber), Dd,httpd_util:month (MM), yyyy,hour,min,sec])); Rfc1123_local_date (Epoch) whenErlang:is_integer (Epoch)rfc1123_local_date (calendar:gregorian_seconds_to_datetime (Epoch+62167219200)).

Erlang's crash dump is a text file of a process detail snapshot, in which a similar file is stitched together, and Crash_dumpviewer will have a warning, but it still works.

Reference: Erl_crash.dump generation of Erlang and how to interpret it

Erlang Online Generation CrashDump

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.