[英]How to interpret GDB backtrace of an OCaml program?
I'm trying to read the backtrace of my OCaml program inside GDB. 我正在尝试在GDB中阅读我的OCaml程序的回溯。 The output looks like the following:
输出如下所示:
(gdb) bt
#0 0x0000000100535ac6 in .L207 ()
#1 0x0000000100535acb in .L207 ()
#2 0x0000000100535acb in .L207 ()
...
How can I interpret this kind of output? 我怎样才能解释这种输出?
EDIT: 编辑:
./configure --enable-debug
(I'm using oasis). ./configure --enable-debug
启用了调试信息(我正在使用oasis)。 EDIT 2: the output seems to be correct with the Linux version of GDB. 编辑2:Linux版本的GDB输出似乎是正确的。 Does anyone know why there is such a difference between the OS X and Linux versions?
有谁知道为什么OS X和Linux版本之间存在这样的差异?
Did you compile with -g? 你用-g编译了吗? I typically get stuff like
#3 0x0000000000401f49 in caml_program ()
. 我通常会
#3 0x0000000000401f49 in caml_program ()
获得类似#3 0x0000000000401f49 in caml_program ()
。 There's also export OCAMLRUNPARAM=b
, gives stacktraces when your program crashes. 还有
export OCAMLRUNPARAM=b
,在程序崩溃时给出export OCAMLRUNPARAM=b
。
(You might want to post a code snippet and the compile commands.) (您可能希望发布代码片段和编译命令。)
You may 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 handy. 您也可以找到http://www.ocamlpro.com/blog/2012/08/20/ocamlpro-and-4.00.0.html和http://oud.ocaml.org/2012/slides/oud2012-paper5- slide.pdf很方便。
Check what C compiler and assembler is used. 检查使用的C编译器和汇编器。 Mac OS probably uses
clang
and it may not generate full debug info for gdb
. Mac OS可能使用
clang
,它可能无法为gdb
生成完整的调试信息。 In that case using lldb
may be more fruitful. 在那种情况下,使用
lldb
可能会更有成效。
Have you looked into using ocamldebug
instead, or do you have to debug on the machine end? 您是否考虑过使用
ocamldebug
,或者您是否必须在机器端进行调试?
If you want to understand what your code is doing on the CPU/Register/Assembly/Bitfiddling-witchcraft end then it might be more informative to read Jane Street's blog post writing performance sensitive ocaml code . 如果你想了解你的代码在CPU / Register / Assembly / Bitfiddling-witchcraft上做了什么,那么阅读Jane Street的博客文章写下性能敏感的ocaml代码可能会提供更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.