Version française
Home     About     Download     Resources     Contact us    
Browse thread
Toplevel debugging.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Guillaume Yziquel <guillaume.yziquel@c...>
Subject: Toplevel debugging.
Hello.

I've been trying to reuse the mlgame codebase, and I've encountered a 
weird issue. When linked into native code or into bytecode, the library 
works fine, and the system exits with a 0 errorlevel.

However, when trying to #require the package from the toploop, I get the 
following error.

>> yziquel@seldon:~/git/mlgame$ ocaml
>>         Objective Caml version 3.11.1
>>
>> # #use "topfind";;
>> - : unit = ()
>> Findlib has been successfully loaded. Additional directives:
>>   #require "package";;      to load a package
>>   #list;;                   to list the available packages
>>   #camlp4o;;                to load camlp4 (standard syntax)
>>   #camlp4r;;                to load camlp4 (revised syntax)
>>   #predicates "p,q,...";;   to set these predicates
>>   Topfind.reset();;         to force that packages will be reloaded
>>   #thread;;                 to enable threads
>>
>> - : unit = ()
>> # #require "mlgame";;
>> /usr/lib/ocaml/unix.cma: loaded
>> /usr/lib/ocaml/bigarray.cma: loaded
>> /usr/lib/ocaml/sdl: added to search path
>> /usr/lib/ocaml/sdl/sdl.cma: loaded
>> /usr/lib/ocaml/sdl/sdlloader.cma: loaded
>> /usr/local/lib/ocaml/3.11.1/mlgame: added to search path
>> /usr/local/lib/ocaml/3.11.1/mlgame/mlgame.cma: loaded
>> [Debug][Video] Driver: x11 Hardware: false HWBlit: false HWBlitCK: 
>> false WHBlitAlpha: false HWFill: false Mem: 0
>> # Fatal error: exception Sys_blocked_io
>> yziquel@seldon:~/git/mlgame$ 

I am wondering how to use a debugger with libraries in the toplevel. As 
/usr/bin/ocaml is bytecode and that the exception is raised from OCaml 
and not from C code, I do not have a backtrace:

>> yziquel@seldon:~$ gdb --args ocamlrun /usr/bin/ocaml
>> GNU gdb (GDB) 7.0-debian
>> Copyright (C) 2009 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later 
>> <http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.  Type "show 
>> copying"
>> and "show warranty" for details.
>> This GDB was configured as "x86_64-linux-gnu".
>> For bug reporting instructions, please see:
>> <http://www.gnu.org/software/gdb/bugs/>...
>> Reading symbols from /usr/bin/ocamlrun...(no debugging symbols 
>> found)...done.
>> (gdb) run
>> Starting program: /usr/bin/ocamlrun /usr/bin/ocaml
>> [Thread debugging using libthread_db enabled]
>>         Objective Caml version 3.11.1
>>
>> # #use "topfind";;
>> - : unit = ()
>> Findlib has been successfully loaded. Additional directives:
>>   #require "package";;      to load a package
>>   #list;;                   to list the available packages
>>   #camlp4o;;                to load camlp4 (standard syntax)
>>   #camlp4r;;                to load camlp4 (revised syntax)
>>   #predicates "p,q,...";;   to set these predicates
>>   Topfind.reset();;         to force that packages will be reloaded
>>   #thread;;                 to enable threads
>>
>> - : unit = ()
>> # #require "mlgame";;
>> /usr/lib/ocaml/unix.cma: loaded
>> /usr/lib/ocaml/bigarray.cma: loaded
>> /usr/lib/ocaml/sdl: added to search path
>> /usr/lib/ocaml/sdl/sdl.cma: loaded
>> /usr/lib/ocaml/sdl/sdlloader.cma: loaded
>> /usr/local/lib/ocaml/3.11.1/mlgame: added to search path
>> /usr/local/lib/ocaml/3.11.1/mlgame/mlgame.cma: loaded
>> [New Thread 0x7ffff34c0910 (LWP 32029)]
>> [Debug][Video] Driver: x11 Hardware: false HWBlit: false HWBlitCK: 
>> false WHBlitAlpha: false HWFill: false Mem: 0
>> # Fatal error: exception Sys_blocked_io
>> [Thread 0x7ffff34c0910 (LWP 32029) exited]
>>
>> Program exited with code 02.
>> (gdb) bt
>> No stack.
>> (gdb) 

My humble guess is that there is a IO conflict with the toplevel's 
interactive write/read on stdin/stdout, but I'd like to know how to 
trace that.

All the best,

-- 
      Guillaume Yziquel
http://yziquel.homelinux.org/