From: Michal Moskal <malekith@pld-linux.org>
To: Richard Jones <rich@annexia.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Print dependencies of a module, and other useful functions
Date: Thu, 7 Aug 2003 15:23:14 +0200 [thread overview]
Message-ID: <20030807132314.GA32161@roke.freak> (raw)
In-Reply-To: <20030807130419.GA5044@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]
On Thu, Aug 07, 2003 at 02:04:19PM +0100, Richard Jones wrote:
> 'gcc -MM' / 'gcc -MMD'
> Print dependencies of a module. Useful for me for building
> robust Makefiles.
ocamldep
> 'nm' / 'nm -D'
> List symbols exported by an OCaml bytecode "binary". Would
> help me solve my ongoing Dynlink problems.
>
> 'objdump'
> List other useful information from an OCaml bytecode "binary".
Try looking at tools/objinfo.ml. I have a patch for it to support also
*.cmx* files. You'll find it attached.
--
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h
[-- Attachment #2: ocaml-objinfo.patch --]
[-- Type: text/plain, Size: 1826 bytes --]
diff -ur ocaml-3.04/tools/objinfo.ml ocaml-3.04-/tools/objinfo.ml
--- ocaml-3.04/tools/objinfo.ml Mon Mar 27 14:18:09 2000
+++ ocaml-3.04-/tools/objinfo.ml Wed May 8 11:30:02 2002
@@ -62,6 +62,29 @@
print_string name; print_newline())
crcs
+let print_opt_info ui =
+ print_string " Unit name: "; print_string ui.Compilenv.ui_name;
+ print_newline();
+ print_string " Interfaces imported:"; print_newline();
+ List.iter
+ (fun (name, digest) ->
+ print_string "\t"; print_digest digest; print_string "\t";
+ print_string name; print_newline())
+ ui.Compilenv.ui_imports_cmi;
+ print_string " Infos imported:"; print_newline();
+ List.iter
+ (fun (name, digest) ->
+ print_string "\t"; print_digest digest; print_string "\t";
+ print_string name; print_newline())
+ ui.Compilenv.ui_imports_cmx
+
+let print_opt_library_info lib =
+ print_string " Extra C object files:";
+ List.iter print_spaced_string lib.Compilenv.lib_ccobjs; print_newline();
+ print_string " Extra C options:";
+ List.iter print_spaced_string lib.Compilenv.lib_ccopts; print_newline();
+ List.iter print_opt_info (List.map fst lib.Compilenv.lib_units)
+
let dump_obj filename =
print_string "File "; print_string filename; print_newline();
let ic = open_in_bin filename in
@@ -86,6 +109,16 @@
let crcs = input_value ic in
close_in ic;
print_intf_info name sign comps crcs
+ end else
+ if buffer = cmx_magic_number then begin
+ let ui = (input_value ic : Compilenv.unit_infos) in
+ close_in ic;
+ print_opt_info ui
+ end else
+ if buffer = cmxa_magic_number then begin
+ let li = (input_value ic : Compilenv.library_infos) in
+ close_in ic;
+ print_opt_library_info li
end else begin
prerr_endline "Not an object file"; exit 2
end
next prev parent reply other threads:[~2003-08-07 13:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-07 13:04 Richard Jones
2003-08-07 13:23 ` Michal Moskal [this message]
2003-08-15 13:21 ` Stefano Zacchiroli
2003-08-15 13:36 ` Michal Moskal
2003-08-18 11:06 ` Sven Luther
2003-08-15 13:42 ` Richard Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030807132314.GA32161@roke.freak \
--to=malekith@pld-linux.org \
--cc=caml-list@inria.fr \
--cc=rich@annexia.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox