Debugging

Graham St Jack Graham.StJack at internode.on.net
Tue Jul 13 22:17:14 PDT 2010


On Tue, 13 Jul 2010 21:38:09 +0000, Graham St Jack wrote:

> On Tue, 13 Jul 2010 03:55:08 -0400, bearophile wrote:
> 
>> Graham St Jack:
>>> How do I profile a D2 program? When I try -profile in dmd, the
>>> resultant executable crashes with a segfault when I try to run it.
>> 
>> Are you able to produce a small test case of this bug?
>> 
>> Bye,
>> bearophile
> 
> Small test cases don't crash. I will spend a bit of time experimenting
> with my way-too-big test case to find out why it crashes when run after
> being compiled with -profile, and post my results here.
> 
> One thing I noticed was that the trace.log file doesn't demangle the
> names properly either.

Here is a gdb stacktrace from a program that was compiled with -profile 
and -gc. The program is too big to post here, but it works just fine 
without the -profile. Note that the problem seems to be something to do 
with variant and/or concurrency. I don't like my chances, but I will dig 
deeper.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf7521b70 (LWP 32218)]
0x080834cc in trace_epi ()
(gdb) bt
#0  0x080834cc in trace_epi ()
#1  0x0806ee56 in _trace_epi_n ()
#2  0xf7520ee4 in ?? ()
#3  0x08057b4d in 
_D3std7variant17__T8VariantNVk24Z8VariantN59__T7handlerTS3std8typecons24__T5TupleTC3bob7NewFileZ5TupleZ7handlerFE3std7variant17__T8VariantNVk24Z8VariantN4OpIDPG24hPvZi 
(parm=0xf7520eac, pStore=0x0, 
    selector=3) at /home/grahams/local/dmd2/linux/bin/../../src/phobos/
std/variant.d:248
#4  0x08061310 in 
_D3std7variant17__T8VariantNVk24Z8VariantN62__T10convertsToTS3std8typecons23__T5TupleTC3bob6ActionZ5TupleZ10convertsToMFZb 
(this=0xf7520ec8)
    at /home/grahams/local/dmd2/linux/bin/../../src/phobos/std/
variant.d:584
#5  0x080607ec in 
_D3std11concurrency10MessageBox130__T3getTDFS3std11concurrency3TidZvTDFC3bob6ActionZvTDFC3bob7NewFileZvTDFAyaZvTDFC3bob11UpdatedFileZvTDFC3bob11ScannedFileZvTDFbZvZ3getMFDFS3std11concurrency3TidZvDFC3bob6ActionZvDFC3bob7NewFileZvDFAyaZvDFC3bob11UpdatedFileZvDFC3bob11ScannedFileZvDFbZvZv9onUserMsgMFS3std11concurrency7MessageZb 
(this=0xf7521038, msg=...)
    at /home/grahams/local/dmd2/linux/bin/../../src/phobos/std/
concurrency.d:360
#6  0x08061213 in 
_D3std11concurrency10MessageBox130__T3getTDFS3std11concurrency3TidZvTDFC3bob6ActionZvTDFC3bob7NewFileZvTDFAyaZvTDFC3bob11UpdatedFileZvTDFC3bob11ScannedFileZvTDFbZvZ3getMFDFS3std11concurrency3TidZvDFC3bob6ActionZvDFC3bob7NewFileZvDFAyaZvDFC3bob11UpdatedFileZvDFC3bob11ScannedFileZvDFbZvZv4scanMFKS3std11concurrency36__T4ListTS3std11concurrency7MessageZ4ListZb 
(this=0xf7521038, list=0xf7d26dc8)
    at /home/grahams/local/dmd2/linux/bin/../../src/phobos/std/
concurrency.d:449
#7  0x08060555 in 
_D3std11concurrency10MessageBox130__T3getTDFS3std11concurrency3TidZvTDFC3bob6ActionZvTDFC3bob7NewFileZvTDFAyaZvTDFC3bob11UpdatedFileZvTDFC3bob11ScannedFileZvTDFbZvZ3getMFDFS3std11concurrency3TidZvDFC3bob6ActionZvDFC3bob7NewFileZvDFAyaZvDFC3bob11UpdatedFileZvDFC3bob11ScannedFileZvDFbZvZv 
(this=0xf7d26dc0, _param_6=577956023555583664, 
_param_5=577955439440031408, _param_4=577954855324479152, 
    _param_3=577954408647880368, _param_2=577953807352458928, 
_param_1=577952742200569520, _param_0=577952226804494000) at /home/
grahams/local/dmd2/linux/bin/../../src/phobos/std/concurrency.d:463
#8  0x080603f0 in 
_D3std11concurrency134__T7receiveTDFS3std11concurrency3TidZvTDFC3bob6ActionZvTDFC3bob7NewFileZvTDFAyaZvTDFC3bob11UpdatedFileZvTDFC3bob11ScannedFileZvTDFbZvZ7receiveFDFS3std11concurrency3TidZvDFC3bob6ActionZvDFC3bob7NewFileZvDFAyaZvDFC3bob11UpdatedFileZvDFC3bob11ScannedFileZvDFbZvZv 
(_param_6=577956023555583664, _param_5=577955439440031408, 
_param_4=577954855324479152, _param_3=577954408647880368, 
    _param_2=577953807352458928, _param_1=577952742200569520, 
_param_0=577952226804494000) at /home/grahams/local/dmd2/linux/bin/../../
src/phobos/std/concurrency.d:228
#9  0x08054c18 in _D3bob13do_schedulingFbS3std11concurrency3TidZv 
(done_tid=..., print_deps=false) at /home/grahams/source/squid/open/
bedrock/build-tool/util/bob.d:2127
#10 0x08067bfc in 
_D3std11concurrency35__T5spawnTbTS3std11concurrency3TidZ5spawnFPFbS3std11concurrency3TidZvbS3std11concurrency3TidZS3std11concurrency3Tid4execMFZv 
(this=0xf7d27b80)
    at /home/grahams/local/dmd2/linux/bin/../../src/phobos/std/
concurrency.d:154
#11 0x0806c00e in _D4core6thread6Thread3runMFZv ()
#12 0x0807df2a in thread_entryPoint ()
#13 0xf7faa96e in start_thread (arg=0xf7521b70) at pthread_create.c:300
#14 0xf7ef3b5e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130


More information about the Digitalmars-d mailing list