diff --git a/Changes b/Changes index b3b44655f..ffe152fe2 100644 --- a/Changes +++ b/Changes @@ -206,6 +206,7 @@ Bug fixes: - PR#6812: -short-paths and -no-alias-deps can create inconsistent assumptions - PR#6817: GADT exhaustiveness breakage with modules - PR#6836: Assertion failure using -short-paths +- PR#6841: Changing compilation unit name with -o breaks ocamldebug - GPR#143: fix getsockopt behaviour for boolean socket options (Anil Madhavapeddy and Andrew Ray) - ocamlbuild on cygwin cannot find ocamlfind diff --git a/debugger/command_line.ml b/debugger/command_line.ml index 2c551c3d5..9fa9ff9d8 100644 --- a/debugger/command_line.ml +++ b/debugger/command_line.ml @@ -639,8 +639,12 @@ let instr_break ppf lexbuf = let module_name = convert_module (module_of_longident mdle) in new_breakpoint (try + let ev = event_at_pos module_name 0 in + let ev_pos = + {Lexing.dummy_pos with + pos_fname = (Events.get_pos ev).pos_fname} in let buffer = - try get_buffer Lexing.dummy_pos module_name with + try get_buffer ev_pos module_name with | Not_found -> eprintf "No source file for %s.@." module_name; raise Toplevel diff --git a/debugger/source.ml b/debugger/source.ml index aa9ec7083..fa2b3c7e4 100644 --- a/debugger/source.ml +++ b/debugger/source.ml @@ -21,6 +21,8 @@ let source_extensions = [".ml"] (*** Conversion function. ***) let source_of_module pos mdle = + let pos_fname = pos.Lexing.pos_fname in + if Sys.file_exists pos_fname then pos_fname else let is_submodule m m' = let len' = String.length m' in try