Cocos2d-x Android iOS crash dump

Source: Internet
Author: User

Signal processing on Android and iOS platforms to print LUA stack information at crash time for easy analysis of bugs
static void Dumphandler (int cause, siginfo_t * info, void *uap) {cclog ("Crash Dump:");    ccluaengine* pengine = ccluaengine::d efaultengine ();    Me_tracestack (Pengine->getluastack ()->getluastate ()); Exit (1);}    static void Setupcrashreport () {struct sigaction sa;    Sa.sa_sigaction = Dumphandler;    Sigemptyset (&sa.sa_mask); Sa.sa_flags = Sa_siginfo; for (int i=0; i<knumsignals; ++i) {if (Sigaction (Ksignals[i], &sa, NULL) = =-1) cclog ("Sigaction [%d] failed", i); } if (Sigaction (SIGSEGV, &sa, 0)) {cclog ("setup Sigaction");}} #define Setup_crash_report () {Setupcrashreport ();}        void Me_tracestack (Lua_state *l) {lua_print (L);    int level;    Lua_debug ar;    Std::string T;        Char buff[1024]; for (level = 1; level<11; ++level) {if (Lua_getstack (L, Level, &ar)) {Lua_getinfo (L,            "Snl", &ar); sprintf (Buff, "frame%d \n%s:%d in function [%s],%d\n", Level, AR.SHORT_SRC, Ar.currentline, AR. Name, ar.linedefined);        T + = buff;            } else {sprintf (buff, "frame%d \nunknown\n", level);        T + = buff; }} cclog ("Lua frame stack:\n%s", t.c_str ());}

Cocos2d-x Android iOS crash dump

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.