Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] debugger questions/feature requests
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] debugger questions/feature requests
> > I normally do 'b' to backstep one step and then 'u' one or several times
> > to go up the stack trace.
> > 
> 
> Hmm.  It doesn't work for me.  When I do this the last location I can see
> before hitting the exception is about two lines before the location of the
> bug.  I'm having a hard time wrapping my mind around the way the debugger
> works.  

Without seeing your code, I can only provide some general intuitions.
Briefly, the Caml debugger works just like popular debuggers for
conventional imperative language (C, Java, etc), with two exceptions:

- You get reverse execution in addition to forward execution,
e.g. while conventional debuggers offer (forward) single-stepping,
ocamldebug also offers back-stepping.

- Single-stepping in conventional debuggers stops at the beginning of
each statement, and at each function call.  Since Caml is an
expression-based language, statements don't play the central role that
they play in C or Java.  So, for Caml, single-stepping (and
back-stepping, and every other debugger command) stops at so-called
"debugging events", which are "interesting" locations in the program
source such as function entry, function application return, beginning
of loops, etc.  (See section 15.4.1 of the manual for a full listing.)  

So, if you bug occurs "between" two events, backstep takes you to the
immediately preceding event, which may be two lines before.

- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners