caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Smart caml editor and smart debugger
@ 2010-10-15  9:38 Dumitru Potop-Butucaru
  2010-10-15 10:21 ` [Caml-list] " Gabriel Kerneis
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dumitru Potop-Butucaru @ 2010-10-15  9:38 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1043 bytes --]


Hello,

I wrote several thousands of lines of CAML and
I am now debugging it. I would **really** need the
following 2 items (if they exist somewhere):

1. An editor where I can collapse entire
     definitions (by reducing a huge "let x = .... in"
     step into a single line). I'd prefer doing it
     using a mouse, but emacs shortcuts would
     be OK, too.

2. A better debugger than ocamldebug, or a
     good trace generation tool

     My problem with ocamldebug is that if a certain
     value is not used inside a "let" scope, then
     I cannot inspect it, even if it is visible in that
     scope (of course, maybe I am wrong,
     in which case please tell it to me).

     So, I am now debugging by inserting print
     functions and inspecting the traces. However,
     writing such functions by hand is taking a huge
     time. Is there some tool allowing me, for instance,
     to choose the functions whose calls I want to trace?
     (so that the call and its parameters are
     automatically logged).

Yours,
Jacky Potop

[-- Attachment #2: dumitru_potop_butucaru.vcf --]
[-- Type: text/x-vcard, Size: 301 bytes --]

begin:vcard
fn:Dumitru Potop-Butucaru
n:Potop-Butucaru;Dumitru
org:INRIA Rocquencourt;Project AOSTE
adr:;;Domaine de Voluceau, BP 105;Le Chesnay;;F-78153;France
email;internet:dumitru.potop@inria.fr
tel;work:+33-139.63.55.80
x-mozilla-html:FALSE
url:http://www.DumitruPotop.net
version:2.1
end:vcard


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

* Re: [Caml-list] Smart caml editor and smart debugger
  2010-10-15  9:38 Smart caml editor and smart debugger Dumitru Potop-Butucaru
@ 2010-10-15 10:21 ` Gabriel Kerneis
  2010-10-15 10:59 ` Lukasz Stafiniak
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gabriel Kerneis @ 2010-10-15 10:21 UTC (permalink / raw)
  To: dumitru.potop; +Cc: caml-list

On Fri, Oct 15, 2010 at 11:38:21AM +0200, Dumitru Potop-Butucaru wrote:
>     Is there some tool allowing me, for instance,
>     to choose the functions whose calls I want to trace?
>     (so that the call and its parameters are
>     automatically logged).

In a toplevel, use the #trace directive:

# let rec f x = if x = 0 then 42 else f (x-1);;
value f : int -> int = <fun>
# #trace f;;
f is now traced.
# f 3 ;;
f <-- 3
f <-- 2
f <-- 1
f <-- 0
f --> 42
f --> 42
f --> 42
f --> 42
- : int = 42

Best,
-- 
Gabriel


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

* Re: [Caml-list] Smart caml editor and smart debugger
  2010-10-15  9:38 Smart caml editor and smart debugger Dumitru Potop-Butucaru
  2010-10-15 10:21 ` [Caml-list] " Gabriel Kerneis
@ 2010-10-15 10:59 ` Lukasz Stafiniak
  2010-10-15 12:00 ` Vincent Aravantinos
  2010-10-16 10:23 ` Gaius Hammond
  3 siblings, 0 replies; 6+ messages in thread
From: Lukasz Stafiniak @ 2010-10-15 10:59 UTC (permalink / raw)
  To: dumitru.potop; +Cc: caml-list

On Fri, Oct 15, 2010 at 11:38 AM, Dumitru Potop-Butucaru
<dumitru.potop_butucaru@inria.fr> wrote:
>
> 1. An editor where I can collapse entire
>    definitions (by reducing a huge "let x = .... in"
>    step into a single line). I'd prefer doing it
>    using a mouse, but emacs shortcuts would
>    be OK, too.
>

There are several outline modes for emacs. I use folding-mode:

(folding-mode-add-find-file-hook)
(folding-add-to-marks-list 'tuareg-mode "(* {{{" "(* }}}" nil t)

and at the beginning of soruce file:

(* -*- folded-file: t; -*- *)

You can see the available commands and their shortcuts in the "Fld" submenu.
I experience two annoyances (probably Tuareg is the culprit): Tuareg
indentation does not work too well around a folded section, and "goto
error" doesn't work at all (it overshots). I solve the second problem
by unfolding everything before picking an error location and then
folding back.

As for tracing, I use printfs. If something seems like a good
information to understand how the algorithm works, I leave it there
using:

(defun camldev-insert-log-entry ()
  (interactive)
    (insert "(* {{{ log entry *)
if !debug_level >  then (
);
(* }}} *)")
(goto-char (- (point) 20)))


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

* Re: [Caml-list] Smart caml editor and smart debugger
  2010-10-15  9:38 Smart caml editor and smart debugger Dumitru Potop-Butucaru
  2010-10-15 10:21 ` [Caml-list] " Gabriel Kerneis
  2010-10-15 10:59 ` Lukasz Stafiniak
@ 2010-10-15 12:00 ` Vincent Aravantinos
  2010-10-16 17:14   ` Yoann Padioleau
  2010-10-16 10:23 ` Gaius Hammond
  3 siblings, 1 reply; 6+ messages in thread
From: Vincent Aravantinos @ 2010-10-15 12:00 UTC (permalink / raw)
  To: dumitru.potop; +Cc: caml-list

Hi Dumitru,

Le 15 oct. 10 à 05:38, Dumitru Potop-Butucaru a écrit :

> 1. An editor where I can collapse entire
>    definitions (by reducing a huge "let x = .... in"
>    step into a single line). I'd prefer doing it
>    using a mouse, but emacs shortcuts would
>    be OK, too.

With Vim you can do this by activating what they call "folding". You  
can do by just typing 'zi'. Though it probably relies on indentation  
rather than on the  syntactic constructions.

I guess chamo (http://home.gna.org/cameleon/chamo.en.html) can  
probably do this sort of thing.

Cheers,
Vincent

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

* Re: [Caml-list] Smart caml editor and smart debugger
  2010-10-15  9:38 Smart caml editor and smart debugger Dumitru Potop-Butucaru
                   ` (2 preceding siblings ...)
  2010-10-15 12:00 ` Vincent Aravantinos
@ 2010-10-16 10:23 ` Gaius Hammond
  3 siblings, 0 replies; 6+ messages in thread
From: Gaius Hammond @ 2010-10-16 10:23 UTC (permalink / raw)
  To: dumitru.potop; +Cc: caml-list


On 15 Oct 2010, at 10:38, Dumitru Potop-Butucaru wrote:

>
> Hello,
>
>
> 1. An editor where I can collapse entire
>    definitions (by reducing a huge "let x = .... in"
>    step into a single line). I'd prefer doing it
>    using a mouse, but emacs shortcuts would
>    be OK, too.
>
>



This feature is called "code folding", I wrote a blog entry about it  
recently: http://gaiustech.wordpress.com/2010/09/20/code-folding-in-emacs/




Cheers,




G







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

* Re: [Caml-list] Smart caml editor and smart debugger
  2010-10-15 12:00 ` Vincent Aravantinos
@ 2010-10-16 17:14   ` Yoann Padioleau
  0 siblings, 0 replies; 6+ messages in thread
From: Yoann Padioleau @ 2010-10-16 17:14 UTC (permalink / raw)
  To: Vincent Aravantinos; +Cc: dumitru.potop, caml-list


On Oct 15, 2010, at 5:00 AM, Vincent Aravantinos wrote:

> Hi Dumitru,
> 
> Le 15 oct. 10 à 05:38, Dumitru Potop-Butucaru a écrit :
> 
>> 1. An editor where I can collapse entire
>>   definitions (by reducing a huge "let x = .... in"
>>   step into a single line). I'd prefer doing it
>>   using a mouse, but emacs shortcuts would
>>   be OK, too.
> 
> With Vim you can do this by activating what they call "folding". You can do by just typing 'zi'. Though it probably relies on indentation rather than on the  syntactic constructions.
> 
> I guess chamo (http://home.gna.org/cameleon/chamo.en.html) can probably do this sort of thing.

pfff_visual takes the opposite approach which is too show all the code but augmenting the size
of the important stuff so that you don't need the folding at all.
See one of the screenshot at http://github.com/facebook/pfff/wiki/Main
I am also working on a tracer that let you visualize what the code is doing (like a tomography).

> 
> Cheers,
> Vincent
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs




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

end of thread, other threads:[~2010-10-16 17:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-15  9:38 Smart caml editor and smart debugger Dumitru Potop-Butucaru
2010-10-15 10:21 ` [Caml-list] " Gabriel Kerneis
2010-10-15 10:59 ` Lukasz Stafiniak
2010-10-15 12:00 ` Vincent Aravantinos
2010-10-16 17:14   ` Yoann Padioleau
2010-10-16 10:23 ` Gaius Hammond

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