Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Ocaml debugger under Windows
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-05 (09:46)
From: Dmitry Bely <dmitry.bely@g...>
Subject: Ocaml debugger under Windows
The topic has a long history [1], but since then nothing has actually
changed. It's easy to understand: INRIA people are busy and there are
probably quite few Ocaml users in the Windows land to worry about. So I
decided to do something myself :) (as it was with mingw port several years

Let's go into detail. Ocam debugger consists of the the two parts: the
client (byterun/debugger.c linked into debuggee) and the server
(ocamldebug). The following issues should be addressed to make a Windows

1. Checkpointing is done via Unix fork() (client)

The most problematic one. I have spend a fair amount of time trying to find
an acceptable solution.
a) direct port of fork() to Windows. There is a BSD-licenced Windows fork()
in tcsh sources [2] that could be used. It's based on Cygwin ideas. But how
to handle dynamically loaded DLLs (loaded via LoadLibrary())? I asked the
author (Amol Deshpande) and he replied:

"DLLs that are dynamically loaded are a can of worms. I would not support
those if I were you."

BTW, does Cygwin do this right? I doubt at least.

b) some checkpoint library. Although Web search gives many references, e.g.
[3], I have not found yet anything ready-to-use, even commercial!

2. Unix select (server)

It is a problem because server waits for network and console events
simultaneously. To work on Windows the main loop should probably be

3. Unix sockets (client & server)

Probably can be ignored. Internet sockets are quite enough.

So what is done now.

- Client

It's ported without (1) and (3). To me it's quite usable even without

- Server

I don't bother to do (2) right now (until the whole idea is accepted).
Currently I use cygwin-compiled ocamldebug with checkpoints and Unix sockets
disabled by default. It works well with the native Win32 clients.

- OcaIDE

Yes, with minor changes in OcaIDE the debugged works there.

If it's interesting for anyone I can publish a patch against Ocaml 3.10.1

- Dmitry Bely