Forum > General

Segfault at the very end of the program

(1/19) > >>

TCH:
My program suddenly started to throw SIGSEGV when i close my program. I tried to debug it, i had put a breakpoint at the beginning of the main form's Close action and then with F7, i stepped forward. I reached the "end." at the end of the program and then i got the segfault. If i don't debug, just quit, the debugger will stands in RaiseGDBException at line 902 of LCLProc.

How can i track where the segfault happens and how can i track from where my program jumped into RaiseGDBException?

And during stepping and then removing the breakpoints and continuing it throwed a SIGFPE. Maybe it's not my program at all, but it's one of the external shared objects, the program uses?

I tried to do strace externally:
--- Code: ---[FORMS.PP] ExceptionOccurred
  Sender=EAccessViolation
  Exception=Access violation
  Stack trace:
  $000000000049973D
  $0000000000430640
  $0000000000560D84 line 1576 of include/canvas.inc
  $0000000000556DC8 line 83 of include/bitmapcanvas.inc
  $0000000000430640
  $00000000005558E8 line 57 of include/custombitmap.inc
  $0000000000430640
  $000000000069F3FD line 32 of include/customimage.inc
  $000000000049C21D
  $0000000000639269 line 4857 of include/control.inc
  $0000000000627B98 line 6579 of include/wincontrol.inc
  $000000000063B97F line 54 of include/customcontrol.inc
  $000000000044881F line 338 of include/scrollingwincontrol.inc
  $00000000004499A1 line 208 of include/customform.inc
  $0000000000430640
  $0000000000445AF6 line 1850 of forms.pp
TApplication.HandleException Access violation
  Stack trace:
  $000000000049973D
  $0000000000430640
  $0000000000560D84 line 1576 of include/canvas.inc
  $0000000000556DC8 line 83 of include/bitmapcanvas.inc
  $0000000000430640
  $00000000005558E8 line 57 of include/custombitmap.inc
  $0000000000430640
  $000000000069F3FD line 32 of include/customimage.inc
  $000000000049C21D
  $0000000000639269 line 4857 of include/control.inc
  $0000000000627B98 line 6579 of include/wincontrol.inc
  $000000000063B97F line 54 of include/customcontrol.inc
  $000000000044881F line 338 of include/scrollingwincontrol.inc
  $00000000004499A1 line 208 of include/customform.inc
  $0000000000430640
  $0000000000445AF6 line 1850 of forms.pp
Exception at 000000000049973D: EAccessViolation:
Access violation.
--- End code ---

And i tried an older binary of my program which did not do this segfault thing, but now that does it too, so if the error is in my code, then it was there that time.
It only does this, since my last apt-get update && apt-get upgrade. (Debian 8, AMD64) That's why i ask, if it can be some of the external libs and if yes, how can i tell.

jamie:
Start you program but don't do anything, then just terminate it..

if it completes ok, then you need to do different steps in your program to reproduce it.

You can also place a break point in the main file at different steps of the Application to see
if it makes it at the base of the Main unit, if it does and faults after that, then look in the
finalization sections of all units you have made. place break points at the start of each.

balazsszekely:
@THC
http://wiki.freepascal.org/Creating_a_Backtrace_with_GDB

TCH:
@jamie: If i terminate it immediately, then it works of course. It's something in the depths of my program, but before the last system update it did not do it...

The segfault happens after the "end."

@GetMem:
--- Code: ---root@Csabi:/media/ROOTDIR/lw/ytfe# gdb ./ytfe
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./ytfe...done.
(gdb) run
Starting program: /media/ROOTDIR/lw/ytfe/ytfe
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff09a0700 (LWP 24940)]
[New Thread 0x7ffff059f700 (LWP 24941)]
[New Thread 0x7fffebfff700 (LWP 24942)]
[New Thread 0x7fffebbfe700 (LWP 24943)]
[New Thread 0x7fffeb7fd700 (LWP 24944)]
[New Thread 0x7fffeb3bc700 (LWP 24945)]
[New Thread 0x7fffeaf09700 (LWP 24946)]
[New Thread 0x7fffeaa56700 (LWP 24947)]
[New Thread 0x7fffea655700 (LWP 24948)]
[New Thread 0x7fffea070700 (LWP 24949)]
[Thread 0x7fffebfff700 (LWP 24942) exited]
[Thread 0x7fffeaf09700 (LWP 24946) exited]
[Thread 0x7fffebbfe700 (LWP 24943) exited]
[Thread 0x7fffeb7fd700 (LWP 24944) exited]
[Thread 0x7fffeaa56700 (LWP 24947) exited]
[Thread 0x7fffeb3bc700 (LWP 24945) exited]
[Thread 0x7fffea655700 (LWP 24948) exited]
[Thread 0x7fffea070700 (LWP 24949) exited]
[Thread 0x7ffff09a0700 (LWP 24940) exited]
[Thread 0x7ffff059f700 (LWP 24941) exited]

Program received signal SIGSEGV, Segmentation fault.
0x000000000049976d in CLASSES$_$TPERSISTENT_$__$$_FPONOTIFYOBSERVERS$TOBJECT$TFPOBSERVEDOPERATION$POINTER ()
(gdb) bt
#0  0x000000000049976d in CLASSES$_$TPERSISTENT_$__$$_FPONOTIFYOBSERVERS$TOBJECT$TFPOBSERVEDOPERATION$POINTER ()
#1  0x0000000000000000 in ?? ()
(gdb) quit
A debugging session is active.

        Inferior 1 [process 24936] will be killed.

Quit anyway? (y or n) y
root@Csabi:/media/ROOTDIR/lw/ytfe#
--- End code ---
Do you see any interesting or suspicious?

balazsszekely:
Do you use threads in your application? It looks like one or more threads are still running. Just before you close the application, you should signal each thread that is time to quit, then wait until they are terminated.
It also can be a gdb issue. What if you run your application outside the IDE(no debugging)?

Navigation

[0] Message Index

[#] Next page

Go to full version