Fatal exceptions logging

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 317
Joined: Tue Oct 18, 2016 2:31 pm

Re: Fatal exceptions logging

Post by alys666 » Sun Nov 24, 2019 3:49 pm

it's ubuntu 16.04/Intel, desktop, not rasberry.
yes i've built wxWIdgets, but nothing special, with very common settings..just for dynamic link libraries.
compiler - g++.
ubuntu 16.04, wxWidgets 3.0.4

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4227
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Fatal exceptions logging

Post by ONEEYEMAN » Sun Nov 24, 2019 8:47 pm

Hi,
What is your exact configure line?

Thank you.

alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 317
Joined: Tue Oct 18, 2016 2:31 pm

Re: Fatal exceptions logging

Post by alys666 » Mon Nov 25, 2019 12:55 am

muscle. i wrote a simple function of "native" stack dump using c++ stdlib.

Code: Select all

#include <execinfo.h>

void dumpStack(){
	const int max_entries = 1000; //let we try to unwind 1000 frames deep stack
	void* lbuf[max_entries]; //buffer for stack frames entries
	int lcnt = backtrace(lbuf, max_entries); //get frames pointers
	char **lstr = backtrace_symbols(lbuf,lcnt); //get symbolic info(text) for entries
	if(!lstr) return; //if no success - return
	for(int i=0; i<lcnt;++i){ //dump entries to stdout
		std::cout<<"-->"<<lstr[i]<<"\n";
	}
	free(lstr); //free allocated buffer
}
wxWidgets use this functions to unwind the stack.
works well for my system.
ubuntu 16.04, wxWidgets 3.0.4

Big Muscle
Experienced Solver
Experienced Solver
Posts: 82
Joined: Sun Jun 27, 2010 6:18 pm

Re: Fatal exceptions logging

Post by Big Muscle » Mon Nov 25, 2019 12:49 pm

I tested your function to generate the log on crash and the output is very similar. __default_sa_restorer is last line of the backtrace. I can now say that the issue is not WX-related.
./COurApp() [0x80acc]
./COurApp() [0x81cc4]
./COurApp() [0x400680]
/lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer+0) [0x75fb5120]
But when generated directly in the code (instead of crash) then it is different:
./COurApp() [0x6fac8]
./COurApp() [0x41d1e0]
./COurApp() [0x41ed4c]
./COurApp() [0x41f100]
./COurApp() [0x41f270]
./COurApp() [0x420c1c]
./COurApp() [0xdd3cc]
If it works in your case then it must be g++ ARM-specific issue. I have never seen this behaviour on any other platform either.
The WX build was configured with plain "./configure".

Even google returns lot of stack traces ending with __default_sa_restorer on ARM. Then I found this topic https://stackoverflow.com/questions/315 ... m-platform - it advises to use "-funwind-tables -fasynchronous-unwind-tables" and it seems to be working! :)

alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 317
Joined: Tue Oct 18, 2016 2:31 pm

Re: Fatal exceptions logging

Post by alys666 » Mon Nov 25, 2019 3:39 pm

it looks like your gcc does not store unwinding info by default.
or may be you have some specific gcc options.
ubuntu 16.04, wxWidgets 3.0.4

Big Muscle
Experienced Solver
Experienced Solver
Posts: 82
Joined: Sun Jun 27, 2010 6:18 pm

Re: Fatal exceptions logging

Post by Big Muscle » Mon Nov 25, 2019 5:33 pm

It is Raspbian, I have not change anything according to gcc.

Post Reply