<cannot fetch remote object> - WHY ?

From: Sorin Stratulat (Sorin.Stratulat@loria.fr)
Date: Wed Jan 26 2000 - 20:38:03 MET

  • Next message: Patrick Goldbronn - SYSCO: "modification de camlidl"

    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
    



    This archive was generated by hypermail 2b29 : Thu Jan 27 2000 - 15:18:18 MET