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

polymorphic install_printer in ocamdebug #7255

Closed
vicuna opened this issue May 13, 2016 · 2 comments
Closed

polymorphic install_printer in ocamdebug #7255

vicuna opened this issue May 13, 2016 · 2 comments

Comments

@vicuna
Copy link

vicuna commented May 13, 2016

Original bug ID: 7255
Reporter: pboutill
Status: acknowledged (set by @shindere on 2017-02-24T15:44:30Z)
Resolution: open
Priority: normal
Severity: feature
Version: 4.03.0
Target version: later
Category: tools (ocaml{lex,yacc,dep,debug,...})

Bug description

As end of #5958 states
Being able to install printers of shape (Formatter.t -> 'a -> unit) -> (Formatter.t -> 'a t -> unit) is super useful for debugging.

#5958 makes it work in ocaml(top). Could we imagine to make it work in ocamldebug too?

@vicuna
Copy link
Author

vicuna commented Jun 14, 2017

Comment author: pboutill

I had a look at that during June 6th 2017 Cambridge MA compiler hacking session.

this summary may be cryptic but as it is probably a note for self... TL;DR we may need to register printers twice. Once for when value have to cross the debugger barrier, once for recursive calls of generic printers when the value is already on the right side of the world.

First quick&dirt easy part is to copy/paste the changes from the patch of #5958 in toplevel/topdirs.ml into debugger/loadprinter.ml. That make the debugger enable to recognise generic printers types. (a clean patch should probably find a relevant place to share code instead of copy/pasting...)

Trickier part:

  • debugger/printval.ml contains a wrapper of install_printer that makes values "cross the debugger barrier".

You would need to do a similar wrapper for install_generic_printer' BUT it is not as simple as that ... Register printers in the debugger takes Debugcom.Remote_value.t whereas we would need plain Obj.t printers for recursive cases.

Maybe by registering printers on plain Obj.t a second time to be used in recursive calls of generic_printers we would be able to do something....

@github-actions
Copy link

github-actions bot commented May 9, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants