MantisBT - OCaml
View Issue Details
0004888OCaml~DO NOT USE (was: OCaml general)public2009-10-05 13:442013-08-31 12:48
0004888: Improve again x86/ELF for GNU debugging tools
A lot of debugging tools are based on two ELF declarations that ocaml compiler does not handle : .file and .loc.
By enabling these two little things you can :
- set breakpoints on ocaml function with gdb in native code!
- see functions executions counts in gprof,
- generate annoted ocaml source, with, for each function details of sub functions called (with valgrind/callgrind).
I've done a blog post about all these possibilities (in french: [^])

I've already done a patch which modify all compilation chain in order to add a new fun_dbg:Debuginfo.t on all fun_decl types.
This attribute is filled in and then is just copied in each compilation step, with some new functions arguments in order to pass this new information.
-> patch-file-and-loc-v1-cvs-2008-11-11.patch

This is not the cleanest and best solution, but that's working for all function calls.
A better solution is to set the dbg:Debuginfo.t attribute in instruction type, and that for all instructions ... but I was really unable to do that!
Nor was I able to set this attribute just for the first instruction of all function...
But with this approach, we would be able to set breakpoint on any ocaml source code line! (instead of just function call with my current work)

Keep me in touch if you decide to get this solution or if you know any other way for adding these two declarations.
No tags attached.
related to 0005487closed  Improved GDB support 
patch patch-file-and-loc-v1-cvs-2008-11-11.patch (17,317) 2009-10-05 13:44
patch patch-file-and-loc-amd64-0.patch (922) 2009-12-19 06:44
patch file_pos_amd64.patch (39,302) 2011-09-30 16:04
Issue History
2009-10-05 13:44apoirotNew Issue
2009-10-05 13:44apoirotFile Added: patch-file-and-loc-v1-cvs-2008-11-11.patch
2009-12-19 06:44dschauerFile Added: patch-file-and-loc-amd64-0.patch
2009-12-19 06:52dschauerNote Added: 0005202
2010-01-07 16:24doligezNote Added: 0005224
2010-01-07 16:24doligezStatusnew => acknowledged
2011-09-30 16:03tillNote Added: 0006137
2011-09-30 16:04tillFile Added: file_pos_amd64.patch
2011-09-30 18:47tillNote Edited: 0006137
2011-12-16 10:57tgazagnaNote Added: 0006320
2011-12-16 10:57tgazagnaNote Edited: 0006320bug_revision_view_page.php?bugnote_id=6320#r12
2011-12-22 12:16tgazagnaNote Edited: 0006320bug_revision_view_page.php?bugnote_id=6320#r50
2012-03-14 17:55xleroyRelationship addedrelated to 0005487
2012-03-14 17:57xleroyNote Added: 0007075
2012-03-14 17:57xleroyStatusacknowledged => resolved
2012-03-14 17:57xleroyResolutionopen => fixed
2012-03-14 17:57xleroyFixed in Version => 3.13.0+dev
2013-08-31 12:48xleroyStatusresolved => closed
2017-02-23 16:36doligezCategoryOCaml general => -OCaml general
2017-03-03 17:55doligezCategory-OCaml general => -(deprecated) general
2017-03-03 18:01doligezCategory-(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04doligezCategory~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

2009-12-19 06:52   
I had to patch asmcomp/amd64/emit.mlp as well in order for the patch-file-and-loc-v1-cvs-2008-11-11.patch to do me any good. At least I can break on function entry points now.
2010-01-07 16:24   
In order to do this properly, we'll have to propagate location information through the back-end. A good idea, but a lot of work.
2011-09-30 16:03   
(edited on: 2011-09-30 18:47)
I tried to redo the patch propagating the location from the type system, see:


(Patch on the tip of the repo)

2011-12-16 10:57   
(edited on: 2011-12-22 12:16)
Recently, I've worked enhancing the support of GDB. The result is a serie of patches against 3.12.1 (including some patches from ygrek and Till). If there is an interest, I can pass some time to port them to trunk: [^]

Feedback welcome.

2012-03-14 17:57   
I believe (correct me if I'm wrong) that this functionality is part of Thomas Gazagnaire's patch (PR#5487), which is now merged in and will appear in release 4.00.