Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: vinhioi@yahoo.com
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Debugging problem
Date: Thu, 26 Jan 2006 09:54:13 +0900 (JST)	[thread overview]
Message-ID: <20060126.095413.25913547.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <20060125212943.92348.qmail@web30505.mail.mud.yahoo.com>

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


      reply	other threads:[~2006-01-26  0:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-25 21:29 vinh le sy
2006-01-26  0:54 ` Jacques Garrigue [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060126.095413.25913547.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@yquem.inria.fr \
    --cc=vinhioi@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox