Version française
Home     About     Download     Resources     Contact us    
Browse thread
Causes for segfaults
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jamie Brandon <jamie@s...>
Subject: Re: [Caml-list] Causes for segfaults
> It might be intersting for you to run your app in gdb and sent the
> backtrace of the segfault. Valgrind could also be very useful here but
> it is not for the faint of heart.
>
> very quick guide to gdb (although I am sure you know):

Not at all - spent my whole life in HLL land. Learning to use gdb is
probably long overdue.

> _ 1) Make sure your program is compiled with -g

Ocaml 3.9 can't compile native code with -g :(

Installing newer versions of ocaml on old installations of centOS is
... entertaining. Despite the delay, I did eventually get this to
work.

[root@senldogo0183 texsearch-development2]# gdb ./index
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...(no debugging
symbols found)
Using host libthread_db library "/lib64/libthread_db.so.1".

(gdb) run
Starting program: /data/texsearch-development2/index
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 46912496271328 (LWP 30551)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912496271328 (LWP 30551)]
0x00000000004466e5 in camlIndex__run_query_1442 ()
(gdb) bt
#0  0x00000000004466e5 in camlIndex__run_query_1442 ()
#1  0x0000000000004e21 in ?? ()
#2  0x000000000056050c in caml_ml_close_channel ()
#3  0x000000000078d0a0 in camlIndex ()
#4  0x0000000000000001 in ?? ()
#5  0x7fffffffffffffff in ?? ()
#6  0x00002aaaaab04900 in ?? ()
#7  0x0000000000447e98 in camlIndex__entry ()
#8  0x00002aaaaab04900 in ?? ()
#9  0x000000000078d890 in camlIndex__142 ()
#10 0x000000000078d808 in camlIndex__140 ()
#11 0x000000000078d928 in camlIndex__144 ()
#12 0x000000000078d8c0 in camlIndex__143 ()
#13 0x00002aaaaab03a58 in ?? ()
#14 0x000000000078d7c0 in camlIndex__123 ()
#15 0x000000000078d828 in camlIndex__141 ()
#16 0x000000000078dab0 in camlIndex__146 ()
#17 0x00002aaaaab03918 in ?? ()
#18 0x000000000078d7e8 in camlIndex__139 ()
#19 0x00002aaaaab038e8 in ?? ()
#20 0x000000000078da78 in camlIndex__145 ()
#21 0x00002aaaaab038c0 in ?? ()
#22 0x00002aaaaab03a40 in ?? ()
#23 0x00002aaaaab03a28 in ?? ()
#24 0x00002aaaaab03a10 in ?? ()
#25 0x00002aaaaab039f8 in ?? ()
#26 0x00002aaaaab039b0 in ?? ()
#27 0x00002aaaaab03960 in ?? ()
#28 0x0000000000000201 in ?? ()
#29 0x000000000043fdc9 in caml_startup__code_begin ()
#30 0x00000000002c5123 in ?? ()
#31 0x000000000056996e in caml_start_program ()

I'm not sure how to interpret this. run_query doesnt *directly* do
anything but it calls into other modules (suffix_array etc) that are
in the same directory. It looks to me like I screwed up the build
process and there are no debugging symbols for suffix_array and co.
This is what I did:

ocamlfind ocamlopt -linkpkg -g \
    -package extlib \
    -package netclient \
    -package json-wheel \
    -package json-static \
    -package xml-light \
    -package str \
    -syntax camlp4o \
    -package json-static \
    util.mli util.ml \
    pid.mli pid.ml \
    latex.mli latex.ml \
    edit.ml \
    suffix_array.mli suffix_array.ml \
    query.ml \
    index.ml \
-o index

Any ideas?