Skip to content

ocamldebug segmentation fault #9156

@ghost

Description

I have found a situation when a segmentation fault occurs during an ocamldebug session.

If I take a simple main.ml program like this:

module Submodule :
sig

  type t
  val value : t
  val pp : Format.formatter -> t -> unit

end = struct

  type t = unit

  let value = ()

  let pp (fmt : Format.formatter) (_ : t) : unit =
    Format.fprintf fmt "DEBUG: Aux.Submodule.pp"

end

let debug () =
  let _value = Submodule.value in
  ()

;;

debug ();

and compile it:

ocamlc -g -o main main.ml

and start a ocamldebug session:

$ ocamldebug main
	OCaml Debugger version 4.09.0

(ocd) run
Loading program... done.
Time: 447
Program exit.
(ocd) break Main.debug
Breakpoint 1 at 158368: file main.ml, line 20, characters 3-39
(ocd) goto 0
Time: 0
Beginning of program.
(ocd) run
Time: 221 - pc: 158368 - module Main
Breakpoint: 1
20   <|b|>let _value = Submodule.value in
(ocd) install_printer Main.Submodule.pp
The debugger does not contain the code for Main.Submodule.pp.
Please load an implementation of Main first.
(ocd) load "main.cmo"
Error during code loading: The module `Main' is already loaded (either by the main program or a previously-dynlinked library)
(ocd) install_printer Main.Submodule.pp
Fatal error: exception End_of_file
Fatal error: exception End_of_file
Segmentation fault

Am I doing something wrong or is this a bug in ocamldebug?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions