caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Problem with ocamldebug 4.06.0
@ 2018-07-19 14:05 Jocelyn Sérot
  2018-07-19 15:57 ` Gabriel Scherer
  0 siblings, 1 reply; 3+ messages in thread
From: Jocelyn Sérot @ 2018-07-19 14:05 UTC (permalink / raw)
  To: OCaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 1587 bytes --]

Hello,

I’m experiencing problems when using ocamldebug on a large program.
Namely, the debugger quits launching an « Not_found » exception as soon as i try to visualize some program variables (print) or dump thef frame

(ocd) …
(ocd) print t
Removed breakpoint 1 at 958036: file vhdl.ml, line 113, characters 19-30
Uncaught exception: Not_found

OCaml-Debugger exited abnormally with code 2

I’ve started to encounter this problem when i recrafted the program in order to use ocamlbuild and distribute the source code in several directories. 
What is annoying is that the problem is not systematic it seems to dependi on the variable to be printed (or at least on the module where it is defined) - which makes isolating a minimum triggering program difficult :(

So my questions are 

i) is there something special to do when using ocamldebug in a multi-directory source file context ? I of course tried to add « _build » and « subdir/_build » to the debug « path » using the directory command, w/o success

ii) has someone already encountered this problem

iii) is there a way to track down where / why the exception was launched (i.e. to debug the debugger)

iv) is there a chance that the pb is fixed in 4.07.0 (apparently no since nothing is told about ocamldebug in the release doc).

Any help appreciated

Cheers

Jocelyn


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 2004 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Problem with ocamldebug 4.06.0
  2018-07-19 14:05 [Caml-list] Problem with ocamldebug 4.06.0 Jocelyn Sérot
@ 2018-07-19 15:57 ` Gabriel Scherer
  2018-07-19 16:24   ` Jocelyn Sérot
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Scherer @ 2018-07-19 15:57 UTC (permalink / raw)
  To: jocelyn.serot; +Cc: caml users

Hi Jocelyn,


> i) is there something special to do when using ocamldebug in a multi-directory source file context ?

I don't think so. On the other hand, dynamic linking (with Dynlink) is
not currently supported, in the sense
that no debug information will be available for the dynlinked code.
(It looks like this is not the concern in your case.)

> ii) has someone already encountered this problem

We recently discussed a bug in ocamldebug related to the interplay
between debug information and inlining ( MPR#7554 ), for which there
is a fix by Thomas Refis in the current development version
(4.08+dev), but not in any released version of OCaml -- not 4.07. The
bug is general, but in particular it affects the variables foo, bar,
baz in the following code pattern:

  let (foo, bar, baz) = (e1, e2, e3) in ...

If the source program where you observe your problem is publicly
available, would you mind giving a pointer to the problematic
variables occurrences?

I would encourage you to file a problem report on the OCaml bugtracker
( https://caml.inria.fr/mantis ) to move forward, especially if you
have a repro-case or can at least point us on a publicly-available
version of the source code.

> iii) is there a way to track down where / why the exception was launched (i.e. to debug the debugger)

In theory you can use OCAMLRUNPARAM=b when running the compiler or
debugger, and you get a backtrace. That said, the compiler codebase
was not written with backtraces in mind, and it has a tendency to
catch and re-raise exceptions in a way that does not preserve
backtraces -- so the trace you observe may be inaccurate. This is
something that we could and should improve -- François Bobot proposed
a change that notably improves the statu quo (GPR#374) but it has not
been merged upstream yet.

> iv) is there a chance that the pb is fixed in 4.07.0

Probably not (if you say it's not in the Changes), but with your help
it could very well be fixed in 4.08 :-)
On Thu, Jul 19, 2018 at 4:06 PM Jocelyn Sérot <jocelyn.serot@uca.fr> wrote:
>
> Hello,
>
> I’m experiencing problems when using ocamldebug on a large program.
> Namely, the debugger quits launching an « Not_found » exception as soon as i try to visualize some program variables (print) or dump thef frame
>
> (ocd) …
> (ocd) print t
> Removed breakpoint 1 at 958036: file vhdl.ml, line 113, characters 19-30
> Uncaught exception: Not_found
>
> OCaml-Debugger exited abnormally with code 2
>
> I’ve started to encounter this problem when i recrafted the program in order to use ocamlbuild and distribute the source code in several directories.
> What is annoying is that the problem is not systematic it seems to dependi on the variable to be printed (or at least on the module where it is defined) - which makes isolating a minimum triggering program difficult :(
>
> So my questions are
>
> i) is there something special to do when using ocamldebug in a multi-directory source file context ? I of course tried to add « _build » and « subdir/_build » to the debug « path » using the directory command, w/o success
>
> ii) has someone already encountered this problem
>
> iii) is there a way to track down where / why the exception was launched (i.e. to debug the debugger)
>
> iv) is there a chance that the pb is fixed in 4.07.0 (apparently no since nothing is told about ocamldebug in the release doc).
>
> Any help appreciated
>
> Cheers
>
> Jocelyn
>

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Problem with ocamldebug 4.06.0
  2018-07-19 15:57 ` Gabriel Scherer
@ 2018-07-19 16:24   ` Jocelyn Sérot
  0 siblings, 0 replies; 3+ messages in thread
From: Jocelyn Sérot @ 2018-07-19 16:24 UTC (permalink / raw)
  To: Gabriel Scherer; +Cc: caml users

Hi Gabriel, and thanks for your answers.

Le 19 juil. 2018 à 17:57, Gabriel Scherer <gabriel.scherer@gmail.com> a écrit :

> Hi Jocelyn,
> 
> 
>> i) is there something special to do when using ocamldebug in a multi-directory source file context ?
> 
> I don't think so. On the other hand, dynamic linking (with Dynlink) is
> not currently supported, in the sense
> that no debug information will be available for the dynlinked code.
> (It looks like this is not the concern in your case.)
> 
No, no dynamic linking in this case.

>> ii) has someone already encountered this problem
> 
> We recently discussed a bug in ocamldebug related to the interplay
> between debug information and inlining ( MPR#7554 ), for which there
> is a fix by Thomas Refis in the current development version
> (4.08+dev), but not in any released version of OCaml -- not 4.07. The
> bug is general, but in particular it affects the variables foo, bar,
> baz in the following code pattern:
> 
>  let (foo, bar, baz) = (e1, e2, e3) in ...
> 
> If the source program where you observe your problem is publicly
> available, would you mind giving a pointer to the problematic
> variables occurrences?
> 
I’ll check but i’m pretty sure the problem showed for other kinds of pattern bindings.

> I would encourage you to file a problem report on the OCaml bugtracker
> ( https://caml.inria.fr/mantis ) to move forward, especially if you
> have a repro-case or can at least point us on a publicly-available
> version of the source code.

The code is indeed publicly available : https://github.com/jserot/rfsm.
But i only noticed the ocamldebug bug with a development version which i have not pushed yet. 
It may be present with the currently available version though.
I’ll prepare a file problem report with a detailed sequence of instructions to repeat the problem.

> 
>> iii) is there a way to track down where / why the exception was launched (i.e. to debug the debugger)
> 
> In theory you can use OCAMLRUNPARAM=b when running the compiler or
> debugger, and you get a backtrace. That said, the compiler codebase
> was not written with backtraces in mind, and it has a tendency to
> catch and re-raise exceptions in a way that does not preserve
> backtraces -- so the trace you observe may be inaccurate. This is
> something that we could and should improve -- François Bobot proposed
> a change that notably improves the statu quo (GPR#374) but it has not
> been merged upstream yet.

Ah, i haven’t thought of running ocamldebug with OCAMLRUNPARAM set (thought it only applied to programs compiled by the user). Will try.

> 
>> iv) is there a chance that the pb is fixed in 4.07.0
> 
> Probably not (if you say it's not in the Changes), but with your help
> it could very well be fixed in 4.08 :-)

Anyway, switching to 4.08 will do no harm ;)

Thanks again

Jocelyn

> On Thu, Jul 19, 2018 at 4:06 PM Jocelyn Sérot <jocelyn.serot@uca.fr> wrote:
>> 
>> Hello,
>> 
>> I’m experiencing problems when using ocamldebug on a large program.
>> Namely, the debugger quits launching an « Not_found » exception as soon as i try to visualize some program variables (print) or dump thef frame
>> 
>> (ocd) …
>> (ocd) print t
>> Removed breakpoint 1 at 958036: file vhdl.ml, line 113, characters 19-30
>> Uncaught exception: Not_found
>> 
>> OCaml-Debugger exited abnormally with code 2
>> 
>> I’ve started to encounter this problem when i recrafted the program in order to use ocamlbuild and distribute the source code in several directories.
>> What is annoying is that the problem is not systematic it seems to dependi on the variable to be printed (or at least on the module where it is defined) - which makes isolating a minimum triggering program difficult :(
>> 
>> So my questions are
>> 
>> i) is there something special to do when using ocamldebug in a multi-directory source file context ? I of course tried to add « _build » and « subdir/_build » to the debug « path » using the directory command, w/o success
>> 
>> ii) has someone already encountered this problem
>> 
>> iii) is there a way to track down where / why the exception was launched (i.e. to debug the debugger)
>> 
>> iv) is there a chance that the pb is fixed in 4.07.0 (apparently no since nothing is told about ocamldebug in the release doc).
>> 
>> Any help appreciated
>> 
>> Cheers
>> 
>> Jocelyn
>> 


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-19 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 14:05 [Caml-list] Problem with ocamldebug 4.06.0 Jocelyn Sérot
2018-07-19 15:57 ` Gabriel Scherer
2018-07-19 16:24   ` Jocelyn Sérot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).