Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004888OCaml~DO NOT USE (was: OCaml general)public2009-10-05 13:442013-08-31 12:48
Assigned To 
PlatformOSOS Version
Product Version3.11.1 
Target VersionFixed in Version3.13.0+dev 
Summary0004888: Improve again x86/ELF for GNU debugging tools
DescriptionA 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.
TagsNo tags attached.
Attached Filespatch file icon patch-file-and-loc-v1-cvs-2008-11-11.patch [^] (17,317 bytes) 2009-10-05 13:44 [Show Content]
patch file icon patch-file-and-loc-amd64-0.patch [^] (922 bytes) 2009-12-19 06:44 [Show Content]
patch file icon file_pos_amd64.patch [^] (39,302 bytes) 2011-09-30 16:04 [Show Content]

- Relationships
related to 0005487closed Improved GDB support 

-  Notes
dschauer (reporter)
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.
doligez (administrator)
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.
till (reporter)
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)

tgazagna (reporter)
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.

xleroy (administrator)
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.

- Issue History
Date Modified Username Field Change
2009-10-05 13:44 apoirot New Issue
2009-10-05 13:44 apoirot File Added: patch-file-and-loc-v1-cvs-2008-11-11.patch
2009-12-19 06:44 dschauer File Added: patch-file-and-loc-amd64-0.patch
2009-12-19 06:52 dschauer Note Added: 0005202
2010-01-07 16:24 doligez Note Added: 0005224
2010-01-07 16:24 doligez Status new => acknowledged
2011-09-30 16:03 till Note Added: 0006137
2011-09-30 16:04 till File Added: file_pos_amd64.patch
2011-09-30 18:47 till Note Edited: 0006137
2011-12-16 10:57 tgazagna Note Added: 0006320
2011-12-16 10:57 tgazagna Note Edited: 0006320 View Revisions
2011-12-22 12:16 tgazagna Note Edited: 0006320 View Revisions
2012-03-14 17:55 xleroy Relationship added related to 0005487
2012-03-14 17:57 xleroy Note Added: 0007075
2012-03-14 17:57 xleroy Status acknowledged => resolved
2012-03-14 17:57 xleroy Resolution open => fixed
2012-03-14 17:57 xleroy Fixed in Version => 3.13.0+dev
2013-08-31 12:48 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker