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

ocamldebug fails to use installed printer on types defined in the module being stepped #6777

Closed
vicuna opened this issue Feb 11, 2015 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Feb 11, 2015

Original bug ID: 6777
Reporter: @gasche
Status: acknowledged (set by @damiendoligez on 2015-02-23T22:02:26Z)
Resolution: open
Priority: low
Severity: minor
Version: 4.02.1
Category: tools (ocaml{lex,yacc,dep,debug,...})

Bug description

ocamldebug installed printers behave differently depending on whether the type of the variable being printed is defined inside the module being stepped through, or in another compilation unit. If the type is defined in the current module, installed custom printers are not used.

Steps to reproduce

test1.ml:
type t = T_with_default_printer
let f (x : t) = x
let () = ignore (f T_with_default_printer)

test2a.ml:
type u = U_with_default_printer

test2b.ml:
open Test2a
let f (x : u) = x
let () = ignore (f U_with_default_printer)

test3.ml:
let print_t buf (_ : Test1.t) = Format.fprintf buf "T-custom@."
let print_u buf (_ : Test2a.u) = Format.fprintf buf "U-custom@."

comp.sh:
ocamlc -g test1.ml -o test1.byte
ocamlc -g test2a.ml test2b.ml -o test2.byte
ocamlc -g test3.ml

test1.debug:
load_printer "test3.cmo"
install_printer Test3.print_t
run
break Test1.f
goto 0
run
print x

test2.debug:
load_printer "test3.cmo"
install_printer Test3.print_u
run
break Test2b.f
goto 0
run
print x

$ ocamldebug test1.byte
OCaml Debugger version 4.02.1

(ocd) source test1.debug
[...]
x: t = T_with_default_printer

$ ocamldebug test2.byte
OCaml Debugger version 4.02.1

(ocd) source test2.debug
[...]
x: Test2a.u = U-custom

@vicuna
Copy link
Author

vicuna commented Feb 11, 2015

Comment author: @gasche

If this was considered normal or at least "will not attempt to fix" by the people that know how the debugger should behave, then we could at least clearly document the behavior. It took me some time to understand why my install_printer didn't work.

I can write the corresponding documentation if someone confirms that is the proper course of actions.

@vicuna
Copy link
Author

vicuna commented Feb 23, 2015

Comment author: @damiendoligez

I think this is a "would be nice to fix", so let's keep it open.

If you want to write some documentation to describe this as a limitation of the current system, go ahead.

@vicuna vicuna added the tools label Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale label May 11, 2020
yanxx297 added a commit to yanxx297/fuzzball that referenced this issue Oct 8, 2021
This printer currently not work because odb doesn't call printer if the type is defined in the same module of the breakpoint.
Details: ocaml/ocaml#6777
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