From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id C2106BBAF for ; Sat, 23 Jan 2010 18:29:04 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0CAG7AWktV2gB4mWdsb2JhbACDYpg9AQEBAQEICwoHE6otjnCBLII2WQSJRA X-IronPort-AV: E=Sophos;i="4.49,330,1262559600"; d="scan'208";a="42347553" Received: from emailfrontal1.citycable.ch ([85.218.0.120]) by mail3-smtp-sop.national.inria.fr with SMTP; 23 Jan 2010 18:29:04 +0100 Received: from [192.168.0.12] (unknown [85.218.92.99]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal1.citycable.ch (Postfix) with ESMTPA id AFC0B12C491; Sat, 23 Jan 2010 18:29:00 +0100 (CET) Message-ID: <4B5B31E3.5060605@citycable.ch> Date: Sat, 23 Jan 2010 18:29:07 +0100 From: Guillaume Yziquel Reply-To: guillaume.yziquel@citycable.ch User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: OCaml List Subject: Toplevel debugging. References: <4B3A7C34.3060606@yziquel.homelinux.org> <4B4F3402.4010307@citycable.ch> <4B5B2F9F.3050302@citycable.ch> In-Reply-To: <4B5B2F9F.3050302@citycable.ch> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; guillaume:01 guillaume:01 toplevel:01 bytecode:01 toploop:01 ocaml:01 topfind:01 findlib:01 camlp:01 camlp:01 syntax:01 syntax:01 topfind:01 usr:01 lib:01 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 >> >> 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: >> ... >> 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/