qcrashhandler.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/kernel/qcrashhandler.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10QtCrashHandler QSegfaultHandler::callback = 0;-
11-
12-
13-
14-
15-
16static void print_backtrace(FILE *outb)-
17{-
18 void *stack[128];-
19 int stack_size = backtrace(stack, sizeof(stack) / sizeof(void *));-
20 char **stack_symbols = backtrace_symbols(stack, stack_size);-
21 fprintf(outb, "Stack [%d]:\n", stack_size);-
22 if(FILE *cppfilt = popen("c++filt", "rw")
FILE *cppfilt ...++filt", "rw")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
23 dup2(fileno(outb), fileno(cppfilt));-
24 for(int i = stack_size-1; i>=0
i>=0Description
TRUEnever evaluated
FALSEnever evaluated
; --i)
0
25 fwrite(stack_symbols[i], 1, strlen(stack_symbols[i]), cppfilt);
never executed: fwrite(stack_symbols[i], 1, strlen(stack_symbols[i]), cppfilt);
0
26 pclose(cppfilt);-
27 }
never executed: end of block
else {
0
28 for(int i = stack_size-1; i>=0
i>=0Description
TRUEnever evaluated
FALSEnever evaluated
; --i)
0
29 fprintf(outb, "#%d %p [%s]\n", i, stack[i], stack_symbols[i]);
never executed: fprintf(outb, "#%d %p [%s]\n", i, stack[i], stack_symbols[i]);
0
30 }
never executed: end of block
0
31}-
32static void init_backtrace(char **, int)-
33{-
34}-
35void qt_signal_handler(int sig)-
36{-
37 signal(sig, ((__sighandler_t) 0));-
38 if(QSegfaultHandler::callback
QSegfaultHandler::callbackDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
39 (*QSegfaultHandler::callback)();-
40 _exit(1);-
41 }
never executed: end of block
0
42 FILE *outb = stderr;-
43 if(char *crash_loc = ::getenv("QT_CRASH_OUTPUT")
char *crash_lo...CRASH_OUTPUT")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
44 if(FILE *new_outb = fopen(crash_loc, "w")
FILE *new_outb...rash_loc, "w")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
45 fprintf(stderr, "Crash (backtrace written to %s)!!!\n", crash_loc);-
46 outb = new_outb;-
47 }
never executed: end of block
0
48 }
never executed: end of block
else {
0
49 fprintf(outb, "Crash!!!\n");-
50 }
never executed: end of block
0
51 print_backtrace(outb);-
52 if(outb != stderr
outb != stderrDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
53 fclose(outb);
never executed: fclose(outb);
0
54 _exit(1);-
55}
never executed: end of block
0
56-
57-
58void-
59QSegfaultHandler::initialize(char **argv, int argc)-
60{-
61 init_backtrace(argv, argc);-
62-
63 struct sigaction SignalAction;-
64 SignalAction.sa_flags = 0;-
65 SignalAction.__sigaction_handler.sa_handler = qt_signal_handler;-
66 sigemptyset(&SignalAction.sa_mask);-
67 sigaction(11, &SignalAction, __null);-
68 sigaction(7, &SignalAction, __null);-
69}
never executed: end of block
0
70-
71-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9