Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007830OCamltools (ocaml{lex,yacc,dep,debug,...})public2018-07-24 12:072018-08-12 11:05
Reporterjserot 
Assigned Tonojebar 
PrioritynormalSeveritycrashReproducibilitysometimes
StatusassignedResolutionopen 
PlatformMacOSMac OSOS Version10.9.5
Product Version4.06.0 
Target VersionFixed in Version 
Summary0007830: Ocamldebug quit with "Exception Not_found" when inspecting some variables
DescriptionOcamldebug sometimes quits launching an « Not_found » exception when trying to visualize some program variables. Here's a session example :

8<--------- START of EXAMPLE

$ ocamldebug -version
The OCaml debugger, version 4.06.0
$ ocamldebug rfsmc
    OCaml Debugger version 4.06.0
Executing file .ocamldebug
Directories: _build lib lib/_build . /Users/jserot/.opam/4.06.0/lib/ocaml
(ocd) set arguments -dot -target_dir /tmp ../../examples/single/chrono/chrono.fsm
(ocd) break @ Fsm 308
Loading program... done.
Breakpoint 1 at 758316: file lib/fsm.ml, line 308, characters 5-3585
(ocd) run
Time: 10027 - pc: 758316 - module Fsm
Breakpoint: 1
308 <|b|>let bind_param vs (p,ty) =
(ocd) print tenv
Removed breakpoint 1 at 758316: file lib/fsm.ml, line 308, characters 5-3585
Uncaught exception: Not_found

8<--------- END of EXAMPLE

The problem is not systematic and seems to depend on the variable to be printed (or at least on the module where it is defined). For example, setting a breakpoint in the Main (top-level) module is ok.This makes isolating a minimum triggering program difficult.

I therefore give a pointer to a publicly available program on which it shows and a sequence of step to reproduce it.
Steps To Reproduce1. Dowload the program :
   - cd /tmp
   - git clone https://github.com/jserot/rfsm [^]
2. Build the executable (-g option is set by default)
    - cd rfsm
    - mkdir ../rfsm-install
    - ./configure --prefix ../rfsm-install --no-gui
    - make
3. Go to the src/compiler directory and launch the debugger
    - cd src/compiler/
    - ocamldebug rfsmc
4. Set argument and put a breakpoint somewhere in the code
    (ocd) set arguments -dot -target_dir /tmp ../../examples/single/chrono/chrono.fsm
    (ocd) break @ Fsm 308
5. Run
    (ocd) run
6. Try to print a variable (tenv, an argument of the function build_instance here)
    (ocd) print tenv

This gives :
*** Removed breakpoint 1 at 758316: file lib/fsm.ml, line 308, characters 5-3585
Uncaught exception: Not_found

Additional InformationI did not try with 4.07.0 but since Ocamldebug is not mentioned in the Changelog i doubt this would make a difference (additionally, my program is bound to 4.06.0 because it must build under windows..)
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0019270)
nojebar (developer)
2018-07-24 14:06

TL;DR: seems to be a missing try ... with in ocamldebug's code when a .cmi cannot be found.

I run this on 4.07 and got the following backtrace for ocamldebug.

Raised at file "typing/env.ml", line 762, characters 18-27
Called from file "typing/env.ml", line 858, characters 13-47
Called from file "typing/env.ml", line 2044, characters 23-52
Called from file "typing/envaux.ml", line 66, characters 22-110
Called from file "typing/envaux.ml", line 64, characters 20-44
Called from file "typing/envaux.ml", line 45, characters 12-38
Called from file "typing/envaux.ml", line 43, characters 10-125
<snip ...>
Called from file "typing/envaux.ml", line 41, characters 24-50
Called from file "typing/envaux.ml", line 40, characters 10-114
Called from file "command_line.ml", line 507, characters 7-76


Failure occurs when trying to open cmi of "Utils", which is a (packed) module of a library dependency (lascar).

Problem goes away adding the necessary include directory by hand, as in:

  ocamldebug -I $(ocamlfind query lascar) rfsmc
(0019271)
jserot (reporter)
2018-07-24 15:02

Thanks for the diagnosis and workaround !
(0019301)
nojebar (developer)
2018-08-11 19:35

Smaller reproduction:

empty.ml
(* empty *)

main.ml

open Empty
let f () = ()
let () = f ()

Compile with:

  ocamlc -g empty.ml main.ml
  rm empty.cmi

Debug with:

  ocamldebug a.out
  (ocd) break @ Main 1
  (ocd) r
  (ocd) print foo
  Uncaught exception: Not_found
(0019302)
nojebar (developer)
2018-08-12 11:05

https://github.com/ocaml/ocaml/pull/1987 [^]

- Issue History
Date Modified Username Field Change
2018-07-24 12:07 jserot New Issue
2018-07-24 14:06 nojebar Note Added: 0019270
2018-07-24 14:06 nojebar Status new => acknowledged
2018-07-24 15:02 jserot Note Added: 0019271
2018-08-11 19:35 nojebar Note Added: 0019301
2018-08-12 11:05 nojebar Note Added: 0019302
2018-08-12 11:05 nojebar Assigned To => nojebar
2018-08-12 11:05 nojebar Status acknowledged => assigned


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker