Dustmite can't handle my memory segfault

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 20 14:33:59 PDT 2016


I'm struggling with finding a memory management problem in my 
latest array container (non-RC just C++-style) at

https://github.com/nordlow/phobos-next/blob/master/src/array_ex.d

When I run the program separately my terminal spits out


*** Error in `./array_ex': corrupted double-linked list: 
0x0000000001c3a2b0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7fc0bb3be725]
...
./array_ex[0x4a3b7f]
...
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fc0bb367830]
./array_ex[0x401ef9]
======= Memory map: ========
00400000-004fe000 r-xp 00000000 08:05 5379197                     
        /home/per/Work/justd/phobos-next/src/array_ex
004fe000-004ff000 r--p 000fd000 08:05 5379197                     
        /home/per/Work/justd/phobos-next/src/array_ex
004ff000-00515000 rw-p 000fe000 08:05 5379197                     
        /home/per/Work/justd/phobos-next/src/array_ex
00515000-00516000 rw-p 00000000 00:00 0
01c2f000-02001000 rw-p 00000000 00:00 0                           
        [heap]
7fc0b4000000-7fc0b4021000 rw-p 00000000 00:00 0
7fc0b4021000-7fc0b8000000 ---p 00000000 00:00 0
7fc0bb347000-7fc0bb507000 r-xp 00000000 08:05 2410363             
        /lib/x86_64-linux-gnu/libc-2.23.so
7fc0bb507000-7fc0bb706000 ---p 001c0000 08:05 2410363             
        /lib/x86_64-linux-gnu/libc-2.23.so
7fc0bb706000-7fc0bb70a000 r--p 001bf000 08:05 2410363             
        /lib/x86_64-linux-gnu/libc-2.23.so
7fc0bb70a000-7fc0bb70c000 rw-p 001c3000 08:05 2410363             
        /lib/x86_64-linux-gnu/libc-2.23.so
7fc0bb70c000-7fc0bb710000 rw-p 00000000 00:00 0
7fc0bb710000-7fc0bb726000 r-xp 00000000 08:05 2369742             
        /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc0bb726000-7fc0bb925000 ---p 00016000 08:05 2369742             
        /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc0bb925000-7fc0bb926000 r--p 00015000 08:05 2369742             
        /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc0bb926000-7fc0bb927000 rw-p 00016000 08:05 2369742             
        /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc0bb927000-7fc0bb92e000 r-xp 00000000 08:05 2410358             
        /lib/x86_64-linux-gnu/librt-2.23.so
7fc0bb92e000-7fc0bbb2d000 ---p 00007000 08:05 2410358             
        /lib/x86_64-linux-gnu/librt-2.23.so
7fc0bbb2d000-7fc0bbb2e000 r--p 00006000 08:05 2410358             
        /lib/x86_64-linux-gnu/librt-2.23.so
7fc0bbb2e000-7fc0bbb2f000 rw-p 00007000 08:05 2410358             
        /lib/x86_64-linux-gnu/librt-2.23.so
7fc0bbb2f000-7fc0bbb47000 r-xp 00000000 08:05 2410362             
        /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc0bbb47000-7fc0bbd46000 ---p 00018000 08:05 2410362             
        /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc0bbd46000-7fc0bbd47000 r--p 00017000 08:05 2410362             
        /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc0bbd47000-7fc0bbd48000 rw-p 00018000 08:05 2410362             
        /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc0bbd48000-7fc0bbd4c000 rw-p 00000000 00:00 0
7fc0bbd4c000-7fc0bbd72000 r-xp 00000000 08:05 2410359             
        /lib/x86_64-linux-gnu/ld-2.23.so
7fc0bbe42000-7fc0bbf46000 rw-p 00000000 00:00 0
7fc0bbf6e000-7fc0bbf71000 rw-p 00000000 00:00 0
7fc0bbf71000-7fc0bbf72000 r--p 00025000 08:05 2410359             
        /lib/x86_64-linux-gnu/ld-2.23.so
7fc0bbf72000-7fc0bbf73000 rw-p 00026000 08:05 2410359             
        /lib/x86_64-linux-gnu/ld-2.23.so
7fc0bbf73000-7fc0bbf74000 rw-p 00000000 00:00 0
7ffdbd0cc000-7ffdbd0ee000 rw-p 00000000 00:00 0                   
        [stack]
7ffdbd1f9000-7ffdbd1fb000 r--p 00000000 00:00 0                   
        [vvar]
7ffdbd1fb000-7ffdbd1fd000 r-xp 00000000 00:00 0                   
        [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0           
        [vsyscall]
Interrupted (SIGABRT


The problem here is that I can't even pipe the call to a file; 
neither

     ./array_ex > dump

nor

     ./array_ex 2> dump

succeeds in creating any file. This might be the reason why my 
Dustmite call


dustmite --no-redirect src "dmd -main -unittest -g -debug \
     array_ex container_traits searching_ex && \
     ./array_ex 2>&1 | grep -qF double-linked"


stops and spits out


Aborted (core dumped)
No
object.Exception at dustmite.d(270): Initial test fails
----------------
??:? _Dmain [0x5c6be8]
??:? 
_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv 
[0x62544e]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) [0x625398]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).runAll() [0x62540a]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) [0x625398]
??:? _d_run_main [0x625309]
??:? main [0x61732d]
??:? __libc_start_main [0xaf26b82f]
[


It seems there is some special behaviour of not being able to 
redirect the ouputs of stdout and stderr here.
What to do?

I need your help here, I'm complete stuck. Vladimir?


Note: The problem should be reproducable by cloning

     https://github.com/nordlow/phobos-next.git

and doing the call to DustMite at the root of this checkout.


More information about the Digitalmars-d-learn mailing list