Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005033OCaml~DO NOT USE (was: OCaml general)public2010-04-23 18:232013-08-31 12:48
Assigned Toxleroy 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.12.0+dev 
Summary0005033: Make objinfo read all kind of objects
DescriptionFor now, objinfo reads cmi, cmo and cma files ; dumpapprox reads cmx and cmxa files. Having only one tool to read all kind of OCaml objects would be nice. Furthermore, being able to read cmxs files and bytecode binaries is a useful feature to have.

The attached patch implements the features described above and makes objinfo use only one format to show objects informations. It also deletes dumpapprox, which won't be needed any longer.

Best regards,
TagsNo tags attached.
Attached Filespatch file icon 0001-Make-objinfo-read-all-kind-of-objects.patch [^] (18,749 bytes) 2010-04-23 18:23 [Show Content]
patch file icon 0001-Enhanced-objinfo-updated.patch [^] (19,007 bytes) 2010-04-28 19:25 [Show Content]
patch file icon 0001-Enhanced-objinfo-updated-2.patch [^] (19,035 bytes) 2010-04-28 21:25 [Show Content]

- Relationships
has duplicate 0004276closed Written a more comprehensive and user-friendly objinfo. 

-  Notes
mehdi (reporter)
2010-04-23 18:26
edited on: 2010-04-23 18:39

Forgot some notes:
- the patch was made using svn revision 10300
- modifications asked in 0004701 are part of my patch
- binutils-dev will be needed in order to build objinfo (it uses the bfd library to read cmxs files).

xleroy (administrator)
2010-04-28 17:20

Hello Mehdi,

This sounds great! Thanks. I'll study the new objinfo pretty soon.

One thing worries me, though: the dependency on the BFD library, which is far from standard on non-Linux systems. On MacOS X I'm not sure I can get it through MacPorts; I'm pretty sure it's not in Solaris; and don't get me started on Windows. At the very least, the presence of libbfd should be tested during configuration, and the parts of objinfo that use it should be stubbed out if it's missing.
mehdi (reporter)
2010-04-28 17:58

You're right on the libfd issue. Actually, I forgot to study the portability problem, shame on me! The first verison that was able to read cmxs used a different technique: objdump was used to compute the necessary bits as you can see in [1]. I prefer using 'bfd' rather than relying on an external program. I think that 'objdump' (part of binutils) is available on MacOSX…

[1];a=blob;f=debian/ocamlbyteinfo/;h=e28800f317650a7f467a4cf224cff589b92da6fa;hb=HEAD [^]

According to its configure file, bfd builds for 'mingw32', 'cygwin' and 'solaris'. So, those systems seem to be supported by bfd's upstream.

I'll do further investigations and try to come back with an enhanced patch wrt. portability. But, I need to find some voluteers to test on Windows, Solaris and MacOSX.
xleroy (administrator)
2010-04-28 18:12

Calling objdump isn't that much more portable than using libbfd. As to upstream support: yes, GNU binutils support an awful lot of platforms, but if they are not installed by default (as in the case under Windows, Solaris and to some extent MacOS) it is still a costly dependency to add.

What I suggest is the following: assume that config/s.h has a #define for HAS_LIBBFD. Can you sprinkle some #ifdefs and try...with on your code so that it compiles and fails cleanly ("cannot display info on .cmxs files") if HAS_LIBBFD is undefined? Then, we'd be in very good shape.
mehdi (reporter)
2010-04-28 19:24
edited on: 2010-05-05 12:06

I didn't claim that using objdump is more portable. But, it's available on (at least) MacOSX and it uses libbfd. So, there is a way to get libfd working there… I didn't invetigated further.

Anyway, I attached an updated version of the patch. It takes into account HAS_LIBBFD and uses LIBBFD_CFLAGS in the Makefile for the link flags.

mehdi (reporter)
2010-04-28 21:25

I forgot to #include config/s.h. That's fixed in the attached " 0001-Enhanced-objinfo-updated-2.patch".
xleroy (administrator)
2010-05-19 14:23

Patch merged in trunk, will go in 3.12.0.

- Issue History
Date Modified Username Field Change
2010-04-23 18:23 mehdi New Issue
2010-04-23 18:23 mehdi File Added: 0001-Make-objinfo-read-all-kind-of-objects.patch
2010-04-23 18:26 mehdi Note Added: 0005369
2010-04-23 18:30 mehdi Note Edited: 0005369
2010-04-23 18:39 mehdi Note Edited: 0005369
2010-04-28 17:20 xleroy Note Added: 0005405
2010-04-28 17:20 xleroy Status new => feedback
2010-04-28 17:20 xleroy Description Updated
2010-04-28 17:58 mehdi Note Added: 0005406
2010-04-28 18:12 xleroy Note Added: 0005407
2010-04-28 19:24 mehdi Note Added: 0005408
2010-04-28 19:25 mehdi File Added: 0001-Enhanced-objinfo-updated.patch
2010-04-28 21:25 mehdi File Added: 0001-Enhanced-objinfo-updated-2.patch
2010-04-28 21:25 mehdi Note Added: 0005409
2010-05-05 12:06 mehdi Note Edited: 0005408
2010-05-19 14:23 xleroy Note Added: 0005459
2010-05-19 14:23 xleroy Status feedback => resolved
2010-05-19 14:23 xleroy Resolution open => fixed
2010-05-19 14:23 xleroy Fixed in Version => 3.12.0+dev
2010-05-19 14:29 xleroy Assigned To => xleroy
2012-03-15 09:33 xleroy Relationship added has duplicate 0004276
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