Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cmt file support to ocamlobjinfo #6142

Closed
vicuna opened this issue Aug 28, 2013 · 5 comments
Closed

add cmt file support to ocamlobjinfo #6142

vicuna opened this issue Aug 28, 2013 · 5 comments
Milestone

Comments

@vicuna
Copy link

vicuna commented Aug 28, 2013

Original bug ID: 6142
Reporter: @avsm
Status: closed (set by @damiendoligez on 2014-07-24T18:09:53Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.01.0+beta/+rc
Target version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: tools (ocaml{lex,yacc,dep,debug,...})
Tags: patch
Monitored by: @gasche

Bug description

This adds support for cmt files to ocamlobjinfo.

I do notice that cmti files have the same magic number as cmi files at the moment, so this doesn't work with interfaces. Is this choice intentional?

e.g.

$ ../boot/ocamlrun objinfo ~/.opam/4.01.0beta1+opamdoc/build/lwt.2.4.3/_build/src/unix/lwt_io.cmt
Unit name: Lwt_io
Interfaces imported:
968037506db5f9b56ea16d0880b2363f Bigarray
af3ef6fba94cdb4eba31e98b4e341dab Buffer
9554e5449c177414a27e7d7ff5ed8013 Char
1858860030310b043b5d7fcb362095a3 Complex
292a1cd61d8e068943589882415bdf7d Gc
024edc3512403b725052aec8e41ed971 Hashtbl
ad06f04cfca6d404d1de76c3dc67324a Int32
3945db6e8df0d5a79bcbc949ee550d52 Int64
12a7b23bd30e5e207ddae39c8e41a1d2 Lazy
d757117653d9319fefb7ddc78a998f41 List
c8c929da0555d697a3923e2328181ef3 Lwt
130ae35afff8a13adde620b0393e72d0 Lwt_bytes
b2efe606d564fef36e15812ffcf8e645 Lwt_io
cf00aa40e98d06340c0cf1e24ebf910d Lwt_list
1625a62212b91a65c3bf11e4922c4afe Lwt_main
9d0ce5785ac3e58f4fe7f9697d6d6849 Lwt_sequence
40dd2569f392f1644ce3e62557087416 Lwt_stream
f85585786c389da94e2ac2304b9bb413 Lwt_sys
c211cd726a2d74bcce1ee92a0d6c8d5c Lwt_unix
5f356f9eb0296db508eefe0c75bdc3ee Marshal
b0adfa4175f86e4394859886c1a374bb Obj
36b5bc8227dc9914c6d9fd9bdcfadb45 Pervasives
d012329cc712e91d0f10a5eef2303d18 Printf
db7f34081ef8fcaf499f19523d0736c6 String
5acfec22153eb1403597926ecd15f4f5 Sys
93736a394d3d85d6d127fe238ddc6092 Unix
e86b819661351c07c5122e164ffd29ea Weak
Source file: src/unix/lwt_io.ml
Compilation Flags: ocamlopt.opt -c -g -I src/core -I src/unix -I src/core -o src/unix/lwt_io.cmx -I /Users/avsm/.opam/4.01.0beta1+opamdoc/lib/ocaml/camlp4 -pp camlp4 '-I' '/Users/avsm/.opam/4.01.0beta1+opamdoc/lib/ocaml/camlp4' '-parser' 'o' '-parser' 'op' '-printer' 'p' 'syntax/pa_lwt_options.cmo' 'syntax/pa_lwt.cmo' 'syntax/pa_lwt_log.cmo' 'syntax/pa_optcomp.cmo' src/unix/lwt_io.ml
Load Path: src/core src/unix src/core /Users/avsm/.opam/4.01.0beta1+opamdoc/lib/ocaml/camlp4 /Users/avsm/.opam/4.01.0beta1+opamdoc/lib/ocaml
Interface Digest:

Additional information

https://github.com/avsm/ocaml/commit/5b197b829b276511e03f164ba125e2a538bdec7c.patch

File attachments

@vicuna
Copy link
Author

vicuna commented Aug 28, 2013

Comment author: @damiendoligez

About cmti vs cmi, according to cmt_format.mli, a cmti (and in some cases a cmt) file begins with an optional (or a sequence of?) cmi files, followed by the cmt magic number. So ocamlobjinfo should distinguish the two by first parsing the cmi, then looking for the cmt magic number.

@vicuna
Copy link
Author

vicuna commented Aug 28, 2013

Comment author: @avsm

Got it -- I've refreshed the patch to re-use Cmt_format.read call, and it works on cmi, cmti and cmt as expected now (and displays all the available info, and distinguishes Cmt interfaces from the Cmi output).

The extra dependencies this patch introduces may break the build due to error-enabled warnings, so I've left a clean build running to check it's ok.

@vicuna
Copy link
Author

vicuna commented Aug 30, 2013

Comment author: @alainfrisch

The extra dependencies this patch introduces may break the build due to error-enabled warnings

What do you mean? Why would extra dependencies trigger more warnings (or do you think of warning 31)?

@vicuna
Copy link
Author

vicuna commented Aug 30, 2013

Comment author: @avsm

Right...I was seeing some new unused variable warnings in my new build, but this doesn't happen with a clean make world.opt. The patch works fine for me.

@vicuna
Copy link
Author

vicuna commented Jul 24, 2014

Comment author: @damiendoligez

Patch ported and applied to 4.02 (commit 15027) and trunk (commit 15028).

@vicuna vicuna closed this as completed Jul 24, 2014
@vicuna vicuna added the tools label Mar 14, 2019
@vicuna vicuna added this to the 4.02.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant