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
Segfault with installed custom printer in ocamldebug #9214
Comments
As far I understand :
but inside ocamldebug memory, not in the target program. I got confused because :
let f = function () -> 4
let print_mytype (f : unit -> int) =
let n = f () in (* in ocaml toplevel, this is not problematic *)
Format.printf "installed printer : this is the constant function to %d" n
|
I've been bitten by this one too... |
I don't know what one should do here. Maybe this should be tagged as "feature-wish" : ability to run code from ocamldebug. It would provide best of both worlds : Comments from runtime experts welcome ! |
My wish is more modest. I just want to able to print, in ocamldebug, structures that have at least a field that is a function, event if this function is not used by the loaded and installed printer (which causes the core dump as your example illustrates). I other words, even if the printer does not try to use the function (as you'd like to do if I understand correctly), I have no way to print the structure using the other fields. Hence I don't see it as a "feature-wish", but as a "ocamldebug-bug". |
Hi ! I up this question : |
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. |
In debugger mode, closures sent by the debuggee have their code pointer modified so that it points to the `function_placeholder` code in debugger/main.ml. This modification was performed incorrectly: the whole closure for `function_placeholder` was used as the code pointer for the unmarshalled closure. This commit implements the correct operation: the code pointer from `function_placeholder` is used as code pointer for the unmarshaled closure. Fixes: ocaml#9214
In debugger mode, closures sent by the debuggee have their code pointer modified so that it points to the `function_placeholder` code in debugger/main.ml. This modification was performed incorrectly: the whole closure for `function_placeholder` was used as the code pointer for the unmarshalled closure. This commit implements the correct operation: the code pointer from `function_placeholder` is used as code pointer for the unmarshaled closure. Fixes: ocaml#9214
Plausible fix in #10709. |
Excellent! Thanks Xavier. |
With xavierleroy@ab9588c patch, one gets
without quitting the ocamldebug session. Thanks @xavierleroy |
😄 |
In debugger mode, closures sent by the debuggee have their code pointer modified so that it points to the `function_placeholder` code in debugger/main.ml. This modification was performed incorrectly: the whole closure for `function_placeholder` was used as the code pointer for the unmarshalled closure. This commit implements the correct operation: the code pointer from `function_placeholder` is used as code pointer for the unmarshaled closure. Also: raise a more informative exception when custom printer invokes closure from debuggee. Fixes: #9214
Not impossible but a lot of work to implement, as far as I can see. |
Dear all,
I am currently unable to use a custom installed printer with ocamldebug in my project because of this segfault.
mytype.ml
a.ml
p.ml
Ocamldebug
script
Commands
Wanted behaviour (if you remove
let _ = f ()
for example) :Actual behaviour with trunk c5e875d or 4.09.0
Any idea ?
The text was updated successfully, but these errors were encountered: