Version française
Home     About     Download     Resources     Contact us    
Browse thread
Debugging problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Debugging problem
From: vinh le sy <vinhioi@yahoo.com>

> I am debugging using camldebugger. I got the same
> problem as Robin posted few years ago. 
> Here comes the problem:
> 
> 
> Let's take a simple example (took from the manual):
> 
> (***** File essai.ml *******)
> 
> class point =
>     object
>       val mutable x = 0
>       method get_x = x
>       method move d = x <- x + d
>     end;;
> 
> let my_p = new point;;
> 
> (****************************)
> 
> In order to print the value x of my_p, I separately
> defined a printer
> function as
[...]
> 4. load the printer (I show also the answer of the
> debugger)
>  (ocd) load_printer "essai_printer.cmo"
>  File ./essai_printer.cmo loaded
>  5. install the printer function my_print_point
>  (ocd) install_printer Essai_printer.my_print_point
>  6. ....put a breakpoint immediately after the
> definition of my_p
> 
> 7. print my_p
>  (ocd) p my_p
>  my_p : point = <cannot fetch remote object>
> 
> Do anyone know the solution for the problem?

No simple solution: objects include the closures of their methods,
so you cannot marshall them (or only between identical programs, which
is not the case of the debugger). As printers run on the debugger
side, there is pretty little one can do. What would be needed is a way
for the debugger to inject code into the running program, which is a
rather extensive change...

What you can do is add a break point inside a method of the object,
and then you (should) be able to inspect its variables. But for it to
work, your program must call this method close enough to the point you
want to inspect.

Jacques