[fpc-devel] threads crash on FreeBSD 9 RC1, FPC 2.6RC1

Helmut Hartl helmut.hartl at firmos.at
Wed Nov 9 20:58:01 CET 2011


Am 09.11.11 14:12, schrieb Pierre Free Pascal:
>> while testing our code on freebsd 9RC1/32 bit with fpc 2.6rc1
>> it seems that all programs compiled on that system using threads crash
>> with an "Illegal Instruction 4 (core dumped)" error.
>> Binaries compiled on Freebsd 8.2/32 and transferred to the 9RC1 box work,
>> which is a bit strange.
>    There is no warranty that an executable for a given version
> will work on a later...
>    If only one system call interface is changed, this is enough to break
> everything!
>
What made me wonder was, that the (old) binary compiled on 8.2 still 
worked on 9.0RC1
after the upgrade from 8.2 -> 9.0 (same machine) while the new one 
compiled with the same
compiler after the upgrade crashed.
If I copy back the new binary (same source) to a 8.2 machine it fails 
with a linker failure
unresolved symbol "sem_init".  But thats only a observation that i am 
too dumb to
understand atm, and maybe unrelated to the main problem.

My (quick) deduction from the output below was that somewhow the 
initialisation of the memory
managment for the new thread gone bad, as the crash seems to be in the 
new thread.
Hence I changed the memorymanager to cmem and the problem goes away, now our
software works and passes it's testsuites.

>> Any ideas ?
>> ....
>>
>    What does
> (gdb) x /10i $rip
> (or $eip if it is an i386 executable)
> give as output?
Here what Is what I have got on that:

[helly at f932 /usr/home/helly/pascal/fpctest]$ /usr/local/bin/gdb73.1 
./project_test
GNU gdb (GDB) 7.3.1 [GDB v7.3.1 for FreeBSD]
Copyright (C) 2011 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 "i386-portbld-freebsd9.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/home/helly/pascal/fpctest/project_test...done.
(gdb) r
Starting program: /usr/home/helly/pascal/fpctest/project_test
[New LWP 100461]

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to LWP 100461]
0x280a0e71 in r_debug_state () from /usr/libexec/ld-elf.so.1
(gdb) c
Continuing.
[New Thread 28404300 (LWP 100461)]
test
[New Thread 28404900 (LWP 100465)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 28404900 (LWP 100465)]
0x0805c34d in WAITFREE_VAR (PMCV=0x282d10a4) at 
/usr/home/helly/pascal/fpc_fixes_2_6/rtl/inc/heap.inc:1084
1084      pmcv^.next_var := pmcv^.freelists^.waitvar;
(gdb) bt full
#0  0x0805c34d in WAITFREE_VAR (PMCV=0x282d10a4) at 
/usr/home/helly/pascal/fpc_fixes_2_6/rtl/inc/heap.inc:1084
No locals.
#1  0x282d10b0 in ?? ()
No symbol table info available.
#2  0x280ec46a in ?? () from /lib/libthr.so.3
No symbol table info available.
#3  0x00000000 in ?? ()
No symbol table info available.
(gdb) x /10i $eip
=> 0x805c34d <WAITFREE_VAR+21>:    mov    0xa0(%eax),%eax
    0x805c353 <WAITFREE_VAR+27>:    mov    %eax,0xc(%ebx)
    0x805c356 <WAITFREE_VAR+30>:    mov    0x4(%ebx),%eax
    0x805c359 <WAITFREE_VAR+33>:    mov    %ebx,0xa0(%eax)
    0x805c35f <WAITFREE_VAR+39>:    mov    $0x80e5698,%eax
    0x805c364 <WAITFREE_VAR+44>:    call   0x805cd28 <LEAVECRITICALSECTION>
    0x805c369 <WAITFREE_VAR+49>:    mov    (%esp),%ebx
    0x805c36c <WAITFREE_VAR+52>:    add    $0x4,%esp
    0x805c36f <WAITFREE_VAR+55>:    ret
    0x805c370 <SYSFREEMEM_FIXED>:    sub    $0xc,%esp
(gdb)




More information about the fpc-devel mailing list