caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Toplevel debugging.
       [not found]     ` <4B5B2F9F.3050302@citycable.ch>
@ 2010-01-23 17:29       ` Guillaume Yziquel
  2010-01-24  5:00         ` [Caml-list] " Jake Donham
  2010-01-25  8:56         ` Jérémie Dimino
  0 siblings, 2 replies; 3+ messages in thread
From: Guillaume Yziquel @ 2010-01-23 17:29 UTC (permalink / raw)
  To: OCaml List

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/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Toplevel debugging.
  2010-01-23 17:29       ` Toplevel debugging Guillaume Yziquel
@ 2010-01-24  5:00         ` Jake Donham
  2010-01-25  8:56         ` Jérémie Dimino
  1 sibling, 0 replies; 3+ messages in thread
From: Jake Donham @ 2010-01-24  5:00 UTC (permalink / raw)
  To: guillaume.yziquel; +Cc: OCaml List

On Sat, Jan 23, 2010 at 9:29 AM, Guillaume Yziquel
<guillaume.yziquel@citycable.ch> wrote:
> 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:

You may find this patch helpful; it adds backtraces to the toplevel:

  http://skydeck.com/blog/programming/more-stack-traces-in-ocaml

I have been meaning to update it for 3.11.x, but you might get some
insight into your problem by running on 3.10.2.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Toplevel debugging.
  2010-01-23 17:29       ` Toplevel debugging Guillaume Yziquel
  2010-01-24  5:00         ` [Caml-list] " Jake Donham
@ 2010-01-25  8:56         ` Jérémie Dimino
  1 sibling, 0 replies; 3+ messages in thread
From: Jérémie Dimino @ 2010-01-25  8:56 UTC (permalink / raw)
  To: guillaume.yziquel; +Cc: OCaml List

Le samedi 23 janvier 2010 à 18:29 +0100, Guillaume Yziquel a écrit :
> >> # Fatal error: exception Sys_blocked_io
> >> yziquel@seldon:~/git/mlgame$ 

It is because mlgame set stdin into non-blocking mode (file input.ml,
line 81) and the toplevel does not support that.

If you want to be able to put stdin into non-blocking mode in the
toplevel, you should install lwt and load the package lwt.unix before
mlgame.

Cheers,
Jérémie


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-25  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4B3A7C34.3060606@yziquel.homelinux.org>
     [not found] ` <4B4F3402.4010307@citycable.ch>
     [not found]   ` <c55009e71001160745y5b9a03b9r326a98d1e42f1cd5@mail.gmail.com>
     [not found]     ` <4B5B2F9F.3050302@citycable.ch>
2010-01-23 17:29       ` Toplevel debugging Guillaume Yziquel
2010-01-24  5:00         ` [Caml-list] " Jake Donham
2010-01-25  8:56         ` Jérémie Dimino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).