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
ocamldebug hangs or crashes on printing lazy values with custom printer #7914
Comments
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
I can reproduce the issue. I think it's fair to say it's a bug given that it causes a segfault using normal features. It looks low-priority to me though, so unless someone volunteer to help, it will probably just remain as a known issue. |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
@hackwaly is it something that you would know how to fix, and would be interested in fixing? |
@gasche I have no clues about this. |
I would like to work on this. But I have a few time @gasche |
I can guess what's happening. The lazy value is marshaled (from debuggee to debugger) before being passed to the custom printer. There's a special case in this marshaling that causes all code pointers to be replaced with an impossible code pointer instead of causing marshaling to fail. When the custom printer forces the lazy value, the impossible code pointer is called, and something wrong happens. (I would expect it to raise an exception "cannot evaluate".) |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
Original bug ID: 7914
Reporter: herbelin
Status: new
Resolution: open
Priority: normal
Severity: crash
Version: 4.06.1
Category: tools (ocaml{lex,yacc,dep,debug,...})
Monitored by: @nojb @gasche @diml
Bug description
#6684 was about printing a lazy value in ocamldebug with the generic printer.
It was fixed and this was very helpful. There is however a similar problem when trying to print lazy values with a custom printer. It either crashes with:
Fatal error: exception End_of_file
Segmentation fault
or hangs (presumably on an input_value trying to fetch the lazy value, though not fully sure on the diagnostic).
The same actually happens when printing functions with a custom printer (though the need is probably less common).
I feel a bit powerless to help more.
Steps to reproduce
printf "let n = lazy (1+1) in n" > a.ml
printf "let f n = print_int (Lazy.force n)" > p.ml
ocamlc -g a.ml
ocamlc -c p.ml
ocamldebug ./a.out <<EOF
load_printer p.cmo
install_printer P.f
break @ "a" # 21
run
print n
EOF
The text was updated successfully, but these errors were encountered: