summaryrefslogtreecommitdiff
path: root/debugger/eval.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-11-29 16:55:09 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-11-29 16:55:09 +0000
commitdb037c79de1e5ba6d5c0d6c117ecc9dcd5fe35eb (patch)
treefea4b40c941bfabb578b5848eae6bcfca0f0d04c /debugger/eval.ml
parent30caadf9e719e79980189a71375921ad03e790e7 (diff)
downloadocaml-db037c79de1e5ba6d5c0d6c117ecc9dcd5fe35eb.tar.gz
Premier jet du portage OCaml
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1209 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'debugger/eval.ml')
-rw-r--r--debugger/eval.ml48
1 files changed, 48 insertions, 0 deletions
diff --git a/debugger/eval.ml b/debugger/eval.ml
new file mode 100644
index 0000000000..514202ce17
--- /dev/null
+++ b/debugger/eval.ml
@@ -0,0 +1,48 @@
+(***********************************************************************)
+(* *)
+(* Objective Caml *)
+(* *)
+(* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *)
+(* Objective Caml port by John Malecki and Xavier Leroy *)
+(* *)
+(* Copyright 1996 Institut National de Recherche en Informatique et *)
+(* Automatique. Distributed only by permission. *)
+(* *)
+(***********************************************************************)
+
+(* $Id$ *)
+
+open Debugger_config
+open Misc
+open Path
+open Instruct
+
+let rec path env sz = function
+ Pident id ->
+ if Ident.global id then
+ Debugcom.get_global (Symtable.get_global_position id)
+ else begin
+ try
+ let pos = Ident.find_same id env.ce_stack in
+ Debugcom.get_local (sz - pos)
+ with Not_found ->
+ try
+ let pos = Ident.find_same id env.ce_heap in
+ Debugcom.get_environment pos
+ with Not_found ->
+ Format.print_string "Cannot evaluate ";
+ Printtyp.ident id;
+ Format.print_newline();
+ raise Toplevel
+ end
+ | Pdot(root, fieldname, pos) ->
+ let v = path env sz root in
+ if Debugcom.remote_value_is_int v then begin
+ Printtyp.path root;
+ Format.print_string " has not yet been initialized";
+ Format.print_newline();
+ raise Toplevel
+ end;
+ Debugcom.get_field v pos
+ | Papply(p1, p2) ->
+ fatal_error "Eval.path: Papply"