caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Re: Debuggers (was Jihad)
@ 2001-11-07 19:19 Krishnaswami, Neel
  2001-11-07 19:51 ` [Caml-list] Re: Debuggers Eric Newhuis
  2001-11-07 20:12 ` [Caml-list] debugger backtracking/checkpoints Chris Hecker
  0 siblings, 2 replies; 10+ messages in thread
From: Krishnaswami, Neel @ 2001-11-07 19:19 UTC (permalink / raw)
  To: 'caml-list@inria.fr'

Bauer, Robert [mailto:rbauer@rational.com] wrote:
>
> Case in point - debugging; one advantage of the imperative paradigm 
> is that being based on turing machines, it provides (indeed requires)
> explicit notions of state - this makes debugging easier - the ocaml 
> debugger is not very modern with respect debuggers for imperative
> languages  - even though it is leaps and bounds better than anything
> available for say, haskell.

I agree with some of the specific details in support of this claim, 
but disagree with the claim itself. Ocaml's debugger is in one respect
extremely advanced: it is a reversible debugger, which puts it way ahead
of most languages' debuggers, imperative or not. It is in one other 
respect inferior to common debuggers: you can't set conditional 
breakpoints (aka watchpoints) in it.

I don't think that this is due to any intrinsic problem caused by 
Caml's functional nature, though. After all, Smalltalk and Lisp are 
famous for providing the ultimate in debugging environments, and 
both of them have higher-order functions and offer the debugger 
vastly less in the way of reliable type constraints than Caml does.

I think (as confidently as I can without reading the source :) that it 
would be relatively straightforward to add that to camldebug. However, 
I won't add it mostly because I don't use debuggers when I have an
interactive prompt available (such as the ocaml program provides), 
because with a toplevel it's easier to write small functions, test 
them right there, and compose them incrementally.


--
Neel Krishnaswami
neelk@cswcasa.com
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] Re: Debuggers
  2001-11-07 19:19 [Caml-list] Re: Debuggers (was Jihad) Krishnaswami, Neel
@ 2001-11-07 19:51 ` Eric Newhuis
  2001-11-07 20:12 ` [Caml-list] debugger backtracking/checkpoints Chris Hecker
  1 sibling, 0 replies; 10+ messages in thread
From: Eric Newhuis @ 2001-11-07 19:51 UTC (permalink / raw)
  To: Caml

> I think (as confidently as I can without reading the source :) that it
> would be relatively straightforward to add that to camldebug. However,
> I won't add it mostly because I don't use debuggers when I have an
> interactive prompt available (such as the ocaml program provides),
> because with a toplevel it's easier to write small functions, test
> them right there, and compose them incrementally.

Yes!

Have others had the same experience as me here?

I've found myself becoming more and more intentional in my habits.  I don't
use debuggers unless there is an emergency.  Instead I write unit tests and
use assertions to halt the system with useful exception information.

And I have found that writing unit tests in functional languages is pleasant
whereas in imperative langaues it is a chore.

"Traditional" debuggers are just not that useful when one has a good suite
of unit tests.

I would have had no idea what I just said a few years ago when all I did was
code in C++ and single-step through code in the debugger.  I've been there.
I thought I was code king then.  Boy was I stupid!

Moreover single-stepping and breakpoints are often times not possible in my
environment that consists of many threads and parallel asynchronously
communicating tasks.

The proof of my ways is in the result:  I can develop complete error-free
systems much faster than before.

Having said all this I still think "traditional" debuggers are absolutely
critical for one's success.  I use them like parachutes, but never on a
daily basis.  If you find yourself using a debugger on a daily basis then I
urge you to consider the wisdom of your ways.  Yes by all means learn how to
be effective at it, but once you learn those important skills move on to a
more proactive habit.

Sincerely,
Eric Newhuis


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* [Caml-list] debugger backtracking/checkpoints
  2001-11-07 19:19 [Caml-list] Re: Debuggers (was Jihad) Krishnaswami, Neel
  2001-11-07 19:51 ` [Caml-list] Re: Debuggers Eric Newhuis
@ 2001-11-07 20:12 ` Chris Hecker
  2001-11-07 20:29   ` Pixel
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Chris Hecker @ 2001-11-07 20:12 UTC (permalink / raw)
  To: caml-list


> but disagree with the claim itself. Ocaml's debugger is in one respect
> extremely advanced: it is a reversible debugger, which puts it way ahead
> of most languages' debuggers, imperative or not. It is in one other

Since the debugger doesn't work on msvc builds, I haven't used it
much, but do people find the backtracking thing useful in everyday
debugging?

Chris

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] debugger backtracking/checkpoints
  2001-11-07 20:12 ` [Caml-list] debugger backtracking/checkpoints Chris Hecker
@ 2001-11-07 20:29   ` Pixel
  2001-11-08 15:14   ` Thorsten Ohl
  2001-11-10 13:39   ` Mattias Waldau
  2 siblings, 0 replies; 10+ messages in thread
From: Pixel @ 2001-11-07 20:29 UTC (permalink / raw)
  To: Chris Hecker; +Cc: caml-list

Chris Hecker <checker@d6.com> writes:

> > but disagree with the claim itself. Ocaml's debugger is in one respect
> > extremely advanced: it is a reversible debugger, which puts it way ahead
> > of most languages' debuggers, imperative or not. It is in one other
> 
> Since the debugger doesn't work on msvc builds, I haven't used it
> much, but do people find the backtracking thing useful in everyday
> debugging?

i'm using it extensively:
- trying to understand where a bug comes from using logs
- when the bug is more localised i debug at the location and find out what's
wrong going back and forth inspecting variables until the precise pb is
localised.

--
Pixel
 
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* [Caml-list] debugger backtracking/checkpoints
  2001-11-07 20:12 ` [Caml-list] debugger backtracking/checkpoints Chris Hecker
  2001-11-07 20:29   ` Pixel
@ 2001-11-08 15:14   ` Thorsten Ohl
  2001-11-08 18:04     ` Christophe Raffalli
  2001-11-10 13:39   ` Mattias Waldau
  2 siblings, 1 reply; 10+ messages in thread
From: Thorsten Ohl @ 2001-11-08 15:14 UTC (permalink / raw)
  To: caml-list

Chris Hecker writes:

> do people find the backtracking thing useful in everyday debugging?

I prefer the toplevel to the debugger in everyday work.  However, the
backtracking debugger is extremely useful for finding the cause for
exceptional conditions that occur in long running programs for
specific inputs.

Not having to figure out a conditional break point that will stop the
program a the right time ist very convienent.  Just run the program to
the `failwith "panic: how in the world did I get here?"'  and step
back from there ...
-- 
Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] debugger backtracking/checkpoints
  2001-11-08 15:14   ` Thorsten Ohl
@ 2001-11-08 18:04     ` Christophe Raffalli
  2001-11-09  9:51       ` Jerome Vouillon
  0 siblings, 1 reply; 10+ messages in thread
From: Christophe Raffalli @ 2001-11-08 18:04 UTC (permalink / raw)
  To: ohl, caml-list


Backtracking is a must but ...

There is a real problem with the backtracking:

If you for instance use the "format" pretty printing library, your program
generaly stops while it was doing some printing which happends to be the wrong
answer. And when you step back you have to do it sometimes a thousand times,
because just before the program stopped you were inside the format library
code.

In fact you should be able to have a next-back insteed of a step-back and see
in which funtion you will enter if you step back to be able to choose between
the two.

Without such a feature, for my particular program I find stepping back almost
unusable.

Is it too difficult to add such a feature ?

-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] debugger backtracking/checkpoints
  2001-11-08 18:04     ` Christophe Raffalli
@ 2001-11-09  9:51       ` Jerome Vouillon
  0 siblings, 0 replies; 10+ messages in thread
From: Jerome Vouillon @ 2001-11-09  9:51 UTC (permalink / raw)
  To: Christophe Raffalli; +Cc: ohl, caml-list

On Thu, Nov 08, 2001 at 07:04:32PM +0100, Christophe Raffalli wrote:
> In fact you should be able to have a next-back insteed of a step-back and see
> in which funtion you will enter if you step back to be able to choose between
> the two.
[...]
> Is it too difficult to add such a feature ?

It's already there:
- "previous" will step-back skipping over function calls
- "start" will execute the program backwards until the current
  function is exited

-- Jerome
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* RE: [Caml-list] debugger backtracking/checkpoints
  2001-11-07 20:12 ` [Caml-list] debugger backtracking/checkpoints Chris Hecker
  2001-11-07 20:29   ` Pixel
  2001-11-08 15:14   ` Thorsten Ohl
@ 2001-11-10 13:39   ` Mattias Waldau
  2001-11-10 14:41     ` Dmitry Bely
  2001-11-12 18:37     ` Chris Hecker
  2 siblings, 2 replies; 10+ messages in thread
From: Mattias Waldau @ 2001-11-10 13:39 UTC (permalink / raw)
  To: Chris Hecker, caml-list

I use a debugger at least once a day. I cannot understand people who put
print-statements into their programs to find bugs (JSP-people still do it
this way).

The problem I normally have with a debugger is go find the location
where the problem is. Setting a breakpoint isn't a good option, since
normally it is difficult to find the location. (If this is the only option,
very often you have to set breakpoints earlier and earlier until you are
ahead of the bug, so that you can step and see whats happening.)

The reversible debugger solves all these problems. Normally, my bugs results
in an assert-exception, so I just run under ocamldebug, and step backwards
over the buggy code until I found the error.

Essentially this means that even in bigger programs I find the bug and
fix it within a couple of minutes.

Debugging using the toplevel doesn't work for me. My programs are too big,
and it is hard to run internal parts standalone. It works for finding
bugs in libraries and similar.

So my guidelines for a developer using Ocaml is to
- use assert a lot so that you detect errors
- find the bugs by running until you get the assert-exception and
  step backwards.

The debugging feature I am missing in Ocaml is
- easy way of showing all the variables in the stack frame


/mattias

P.s. I still cannot use ocamldebug under emacs (M-x camldebug)
on Windows 2000/XP. I get 'Unknown option -emacs.'.
I have to run it in the shell.
Does it work for everyone else?

> -----Original Message-----
> From: owner-caml-list@pauillac.inria.fr
> [mailto:owner-caml-list@pauillac.inria.fr]On Behalf Of Chris Hecker
> Sent: Wednesday, November 07, 2001 9:12 PM
> To: caml-list@inria.fr
> Subject: [Caml-list] debugger backtracking/checkpoints
>
>
>
> > but disagree with the claim itself. Ocaml's debugger is in one respect
> > extremely advanced: it is a reversible debugger, which puts it way ahead
> > of most languages' debuggers, imperative or not. It is in one other
>
> Since the debugger doesn't work on msvc builds, I haven't used it
> much, but do people find the backtracking thing useful in everyday
> debugging?
>
> Chris
>
> -------------------
> Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ:
> http://caml.inria.fr/FAQ/
> 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/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] debugger backtracking/checkpoints
  2001-11-10 13:39   ` Mattias Waldau
@ 2001-11-10 14:41     ` Dmitry Bely
  2001-11-12 18:37     ` Chris Hecker
  1 sibling, 0 replies; 10+ messages in thread
From: Dmitry Bely @ 2001-11-10 14:41 UTC (permalink / raw)
  To: caml-list

"Mattias Waldau" <mattias.waldau@abc.se> writes:

> P.s. I still cannot use ocamldebug under emacs (M-x camldebug)
> on Windows 2000/XP. I get 'Unknown option -emacs.'.
> I have to run it in the shell.
> Does it work for everyone else?

What Emacs are you using?

Hope to hear from you soon,
Dmitry


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* RE: [Caml-list] debugger backtracking/checkpoints
  2001-11-10 13:39   ` Mattias Waldau
  2001-11-10 14:41     ` Dmitry Bely
@ 2001-11-12 18:37     ` Chris Hecker
  1 sibling, 0 replies; 10+ messages in thread
From: Chris Hecker @ 2001-11-12 18:37 UTC (permalink / raw)
  To: Mattias Waldau, caml-list


>P.s. I still cannot use ocamldebug under emacs (M-x camldebug)
>on Windows 2000/XP. I get 'Unknown option -emacs.'.
>I have to run it in the shell.
>Does it work for everyone else?

I was having this same problem when I was playing with the cygwin version.  I think it had to do with having the wrong ocamlrun in my path or something, I'm not sure.  I don't think I ever fixed it completely, but I'll give it another shot at some point.

Chris

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

end of thread, other threads:[~2001-11-12 18:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-07 19:19 [Caml-list] Re: Debuggers (was Jihad) Krishnaswami, Neel
2001-11-07 19:51 ` [Caml-list] Re: Debuggers Eric Newhuis
2001-11-07 20:12 ` [Caml-list] debugger backtracking/checkpoints Chris Hecker
2001-11-07 20:29   ` Pixel
2001-11-08 15:14   ` Thorsten Ohl
2001-11-08 18:04     ` Christophe Raffalli
2001-11-09  9:51       ` Jerome Vouillon
2001-11-10 13:39   ` Mattias Waldau
2001-11-10 14:41     ` Dmitry Bely
2001-11-12 18:37     ` Chris Hecker

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).