Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing forced lazy value in ocamldebug #5836

Closed
vicuna opened this Issue Nov 21, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Nov 21, 2012

Original bug ID: 5836
Reporter: pboutill
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2016-12-07T10:37:08Z)
Resolution: fixed
Priority: low
Severity: minor
Platform: x86_64
OS: MacOS
OS Version: 10.8
Version: 4.00.1
Target version: 4.02.2+dev / +rc1
Fixed in version: 4.03.0+dev / +beta1
Category: tools (ocaml{lex,yacc,dep,debug,...})
Duplicate of: #6684

Bug description

Ocamldebug segfault when you try to print a forced lazy value. It is because of a marshall error.
I do not exept it to print the value but I would enjoy if i could say "" instead of segfault.
This way I won't loose my debugging session because I forgot that there are lazy stuff in the record I want to print ...

Steps to reproduce

$ echo "let k = Lazy.from_fun (fun () -> 1) in" > ex.ml
$ echo "print_int (Lazy.force k)" >> ex.ml
$ ocamlc -g -o ex ex.ml
$ ocamldebug ./ex
OCaml Debugger version 4.00.1

(ocd) break @ Ex 2
Loading program... done.
Breakpoint 1 at 8572 : file ex.ml, line 1, characters 9-36
(ocd) r
Time : 15 - pc : 8576 - module Ex
Breakpoint : 1
2 <|b|>print_int (Lazy.force k)
(ocd) p k
k : int Lazy.t =
(ocd) s
Time : 16 - pc : 7804 - module CamlinternalLazy
24 <|b|>let closure = (Obj.obj (Obj.field (Obj.repr blk) 0) : unit -> 'arg) in
(ocd)
Time : 17 - pc : 7824 - module CamlinternalLazy
25 <|b|>Obj.set_field (Obj.repr blk) 0 raise_undefined;
(ocd)
Time : 18 - pc : 7840 - module CamlinternalLazy
26 <|b|>try
(ocd)
Time : 19 - pc : 8532 - module Ex
1 let k = Lazy.from_fun (fun () -> <|b|>1) in
(ocd)
Time : 20 - pc : 7864 - module CamlinternalLazy
28 <|b|>Obj.set_field (Obj.repr blk) 0 (Obj.repr result); (* do set_field BEFORE set_tag *)
(ocd)
Time : 21 - pc : 7884 - module CamlinternalLazy
29 <|b|>Obj.set_tag (Obj.repr blk) Obj.forward_tag;
(ocd)
Time : 22 - pc : 7908 - module CamlinternalLazy
29 Obj.set_tag (Obj.repr blk) Obj.forward_tag<|a|>;
(ocd)
Time : 23 - pc : 8676 - module Ex
2 print_int (Lazy.force k)<|a|>
(ocd) p k
Fatal error: exception End_of_file
Segmentation fault: 11

Additional information

Same behavior under debian amd64 3.12(.1)

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Dec 13, 2014

Comment author: @gasche

Fixed in trunk.

@vicuna vicuna closed this Dec 7, 2016

@vicuna vicuna added this to the 4.02.2 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.