[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#415194: libextlib-ocaml-dev: No debugging information



On Mon, Apr 09, 2007 at 02:54:29PM +0200, Julien Cristau wrote:
> OCaml libraries are static, so if there is a way to take a library
> compiled with -g and link a program with it that results in an
> executable without debugging symbols, then I think we should do that,
> because that means you would decide at link time whether you want your
> program to carry debugging symbols, and library packages are only useful
> for developers anyway.

I made some tests, have a look at this:

  zack@aquarium:~/t$ ls -l
  total 104
  -rw-r--r-- 1 zack zack   173 2007-04-09 15:06 a.cmi
  -rw-r--r-- 1 zack zack  1055 2007-04-09 15:06 a.cmo
  -rw-r--r-- 1 zack zack  1055 2007-04-09 15:05 a.cmo_debug
  -rw-r--r-- 1 zack zack   227 2007-04-09 15:04 a.cmo_no_debug
  -rw-r--r-- 1 zack zack    44 2007-04-09 15:04 a.ml
  -rwxr-xr-x 1 zack zack 48575 2007-04-09 15:05 a.out_debug_all
  -rwxr-xr-x 1 zack zack 12025 2007-04-09 15:04 a.out_no_debug_all
  -rwxr-xr-x 1 zack zack 12025 2007-04-09 15:06 a.out_no_debug_main
  -rw-r--r-- 1 zack zack   135 2007-04-09 15:06 main.cmi
  -rw-r--r-- 1 zack zack   176 2007-04-09 15:06 main.cmo
  -rw-r--r-- 1 zack zack    10 2007-04-09 15:04 main.ml

How I generated them (simplified from the actual commands, but hopefully
enough to get the figure):

- ocamlc -c -g a.ml               ->  a.cmo_debug
- ocamlc -g a.cmo_debug main.ml   ->  a.out_debug_all

- ocamlc -c a.ml                  ->  a.cmo_no_debug
- ocamlc a.cmo_no_debug main.ml   -> a.out_no_debug_all

- ocamlc a.cmo_debug main.ml      -> a.out_no_debug_main

So, apparently, Julien's guess is right: it is indeed possible to link
without debugging information OCaml objects which have been previously
linked with debugging information.  To be sure a bit of investigation in
the source code of the compiler will be needed though (volunteers?).  If
this is confirmed I propose to amend our policy to state that OCaml
libraries should be compiled forcibly with -g.

Cheers.

-- 
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
(15:56:48)  Zack: e la demo dema ?    /\    All one has to do is hit the
(15:57:15)  Bac: no, la demo scema    \/    right keys at the right time

Attachment: signature.asc
Description: Digital signature


Reply to: