From: Sorin Stratulat <Sorin.Stratulat@loria.fr>
To: caml-list@inria.fr
Subject: <cannot fetch remote object> - WHY ?
Date: Wed, 26 Jan 2000 20:38:03 +0100 (CET) [thread overview]
Message-ID: <14479.17696.496132.380433@micutzu.loria.fr> (raw)
Hello !
I started to debug large OCaml code and apparently the only acceptable
solution to do this is to use the debugger. Unfortunately, I found
difficulties to convince the debugger to print objects.
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
(***** File essai_printer.ml *******)
open Format
let my_print_point s =
open_box 0;
print_string ("The point is situated at" ^ string_of_int (s#get_x));
print_space ();
close_box ();
print_newline ()
;;
(****************************)
let my_print_point s =
open_box 0;
print_string ("The point is situated at" ^ string_of_int (s#get_x));
print_space ();
close_box ();
print_newline ()
;;
Here are the steps I followed:
1. Compile essai.ml and essai_printer.ml
ocamlc -c -g essai.ml
ocamlc -c -g essai_printer.ml
2. Create the executable file "essai"
ocamlc -custom -g -o essai essai.cmo
3. Launch the debugger on the file "essai"
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>
------------------------------------------------------------------
Can somebody tell me the "solution" to print the value "x" of my_p ?
Thank you,
Sorin
French version:
Bonjour !
Je suis en train de deboguer de gros fichiers en OCaml et je suis
contraint d'utiliser le debogueur. Malheureusement, je n'arrive pas a
afficher des objets.
Voici un tres simple exemple (pris du manuel):
(***** 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;;
(****************************)
Pour afficher la valeur x de my_p, j'ai defini separement une fonction
d'impression
(***** File essai_printer.ml *******)
open Format
let my_print_point s =
open_box 0;
print_string ("The point is situated at" ^ string_of_int (s#get_x));
print_space ();
close_box ();
print_newline ()
;;
(****************************)
Les etapes que j'ai suivi sont les suivantes:
1. Compiler essai.ml et essai_printer.ml
ocamlc -c -g essai.ml
ocamlc -c -g essai_printer.ml
2. Creer le fichier executable "essai":
ocamlc -custom -g -o essai essai.cmo
3. Lancer le debogueur sur le fichier "essai":
4. Charger le "printer"
(ocd) load_printer "essai_printer.cmo"
File ./essai_printer.cmo loaded
5. Installer la fonction d'impression my_print_point
(ocd) install_printer Essai_printer.my_print_point
6. ... fixer un breakpoint juste apres la definition de my_p
7. imprimer my_p
(ocd) p my_p
my_p : point = <cannot fetch remote object>
------------------------------------------------------------------
Et la question:
Quelle est la solution pour imprimer la valeur x de my_p ?
Merci d'avance,
Sorin
--
e-mail : Sorin.Stratulat@loria.fr
www : http://www.loria.fr/~stratula
Project: PROTHEO
Office : A201 | Home:
------ | ------
tel: 03.83.59.30.02 | 1, rue Charles Sadoul
LORIA - BP 239 | 54000 Nancy
F-54506 VANDOEUVRE-les-NANCY Cedex FRANCE | tel. 06.10.46.49.99
next reply other threads:[~2000-01-27 14:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-26 19:38 Sorin Stratulat [this message]
2000-02-03 18:28 ` Xavier Leroy
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=14479.17696.496132.380433@micutzu.loria.fr \
--to=sorin.stratulat@loria.fr \
--cc=caml-list@inria.fr \
--cc=stratula@loria.fr \
/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