File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,30 @@ void myMessageOutput( QtMsgType type, const char *msg )
254
254
{
255
255
fprintf ( stderr, " Fatal: %s\n " , msg );
256
256
#if defined(linux) && !defined(ANDROID)
257
- ( void ) write ( STDERR_FILENO, " Stacktrace (run through c++filt):\n " , 34 );
257
+ if ( access ( " /usr/bin/c++filt" , X_OK) )
258
+ {
259
+ ( void ) write ( STDERR_FILENO, " Stacktrace (c++filt NOT FOUND):\n " , 32 );
260
+ }
261
+ else
262
+ {
263
+ int fd[2 ];
264
+
265
+ if ( pipe (fd)==0 && fork ()==0 )
266
+ {
267
+ close ( STDIN_FILENO );
268
+ close ( fd[1 ] );
269
+ dup ( fd[0 ] );
270
+ execl ( " /usr/bin/c++filt" , " c++filt" , (char *) 0 );
271
+ exit (1 );
272
+ }
273
+
274
+ ( void ) write ( STDERR_FILENO, " Stacktrace (piped through c++filt):\n " , 36 );
275
+
276
+ close ( STDERR_FILENO );
277
+ close ( fd[0 ] );
278
+ dup ( fd[1 ] );
279
+ }
280
+
258
281
void *buffer[256 ];
259
282
int nptrs = backtrace ( buffer, sizeof ( buffer ) / sizeof ( *buffer ) );
260
283
backtrace_symbols_fd ( buffer, nptrs, STDERR_FILENO );
You can’t perform that action at this time.
0 commit comments