How to interpret GDB backtrace for OCaml program?

I am trying to read the backline of my OCaml program inside GDB. The result looks like this:

(gdb) bt
#0  0x0000000100535ac6 in .L207 ()
#1  0x0000000100535acb in .L207 ()
#2  0x0000000100535acb in .L207 ()
...

      

How can I interpret this kind of output?

EDIT:

  • I have included debug info with ./configure --enable-debug

    (I am using oasis).
  • I am using GDB 7.9.1 on OS X 10.10
  • I am using OCaml 4.02.2

EDIT 2: The result seems to be correct with the Linux version of GDB. Does anyone know why there is such a difference between OS X and Linux versions?

+3


source to share


3 answers


Check that you are using a C compiler and assembler. Mac OS probably uses clang

and may not generate complete debug information for gdb

. In this case, the use lldb

can be more fruitful.



+2


source


Have you compiled with -g? I usually get stuff like #3 0x0000000000401f49 in caml_program ()

. There also export OCAMLRUNPARAM=b

, gives a stack of stacks when your program crashes.

(You might want to post the code snippet and compilation commands.)



You can also find http://www.ocamlpro.com/blog/2012/08/20/ocamlpro-and-4.00.0.html and http://oud.ocaml.org/2012/slides/oud2012-paper5- slides.pdf is handy.

+1


source


Instead, have you used ocamldebug

or do you have to debug at the end of the machine?

If you want to understand what your code is doing in the CPU / Register / Assembly / Bitfiddling-witchcraft stage, then it might be more informative to read the Jane Street blog post high performance code ocaml entry .

0


source







All Articles