Index Software

ObjectViewer, an nm Front End

Status

Developed late 2005 and early 2006 on Qt3. Ported to Mac OS X mid 2007. Ported (well, converted) to Qt 4 September 2008. Still awaiting a proper port to Qt 4.

Feedback

I would appreciate any feedback.

Latest Developments

2010-01-11

Noticed strange behaviour when switching between hex, decimal and octal. Octal didn't work at all, and the app would just get slower and slower. Part of this was an error in the .ui file, that I fixed with a text editor. The other issue was that not everything was well with the .pro file and what qmake generated. I can't remember exactly what I did, but it's fixed now.

2008-09-16

Well, the enthusiasm slowly crept up on me, and I've done the port to Qt 4.

2008-05-22

It's come to my attention that Qt 3.3.8b isn't supported and won't compile on Mac OS X 10.5 Leopard. The binary that I compiled on 10.4 Tiger still seems to work though. Perhaps I should take a stab at a Qt 4 port. If I can summon any enthusiasm.

2008-03-15

Compiled and uploaded binary for FreeBSD 7.0.

2007-10-26

Compiled and uploaded binaries and libs for FreeBSD 6.2

2007-10-15

Compiled and uploaded binaries and libs for Fedora Core 6 and FreeBSD 6.1

2007-09-20

In August (2007) I ported the software to Mac OS X. This was a good and a bad thing. Good in that I took the opportunity to refactor the code fairly considerably. Previously, I wrote it on Solaris, then slapped in a few #if defined()s to port it to Linux. There were just too many differences to permit 3 platforms with conditional compilation (at least to my taste). So now I have a set of platform specific ObjectViewer classes that derive from the Designer generated base ObjectViewer class.

Mac OS X did prove to be a bit of a challenge. The problem is that the app uses nm, and on Mac OS X, with the mach-o object format, you don't get much information. Personally, the fields that are most of interest to me are the type (function, object), the binding (static, local), the name, the size and occasionally the section. Well, on Mac OS X, all you get is the index, type and the name. Mac OS X doesn't even have the option of demangling C++ names, so I had to pass the output of nm through c++filt. I did have a go at trying to run two QProcesses, and connecting their stdout/stdin, but it was clearly not easy, so I just changed the one QProcess to launch "sh -c nm -n objfile | c++filt". I did manage to calculate the sizes based on the deltas of the index values. This isn't perfect, as not all of the values are contiguous, and if there is a jump, then the object prior to the discontiuity will have a size that is too large. Also there's no way to get the size of the last entry. A workaround for this is to add a bogus function to the source code, assuming that it gets put last.

Now using Qt 3.3.8. Still haven't done any real Qt 4 programming.

2006-09-25

The NM environment variable controls the version of nm that ObjectViewer will use. This has two uses:

The numeric columns are now sorted keeping any blank (or UNDEF) entries at the end.

License

GPL, using Qt 3.3.8. I'm no fan of the GPL, but using Qt leaves me no choice (well, I could buy a commercial Qt licence). I leave it to your conscience to make a donation. I don't wish to make any profit out of this. You can contact me here

Screenshot

Here's the application loaded with of its own object files.

Screenshot of ObjectViewer

Download

First you'll need the dynamic libraries.

Download a binary compiled for Solaris 10 x86 ov_bin_SunOS_5.10_i86pc.tar.bz2 [Last update 2008-09-16].

Download a binary compiled for Mac OS X x86 ov_bin_Darwin_9.5.0_i386.tar.bz2 [Last update of 2008-09-16].

Download a binary compiled for FreeBSD 7.0 x86 ov_bin_FreeBSD_7.0-RELEASE-p4_i386.tar.bz2 [Last update 2008-09-16].

Download a binary compiled for Linux (RedHat FC6 x86) ov_bin_linux.tar.bz2. [Last update 2007-10-15].

The source code ov_src.tar.bz2 [Last update 2007-09-22].

Instructions

Uncompress and untar the file (bin and lib). I suggest that you create a little script that contains

#!/bin/sh
LD_LIBRARY_PATH=[path to directory containing ov and libraries]
export LD_LIBRARY_PATH
[path to directory containing ov and libraries]/ov

Alternatively, for Mac OS X

#!/bin/sh
DYLD_LIBRARY_PATH=[path to directory containing ov and libraries]
export DYLD_LIBRARY_PATH
[path to directory containing ov and libraries]/ov

Not much chance of me producing a Mac friendly .dmg any time soon.

Future Development

Try it out on a few more platforms, and perhaps also provide binaries. Those other platforms would most likely be FreeBSD and Linux. Done. Anc Mac OS X. Done. And Windows at a push Not done. Perhaps enhance the GUI a bit - add a few filters such as FUNC only, OBJT only, LOCL only, GLOB only, defined only, UNDEF only... It might be a bit prettier to have the same 'Type' on all platforms rather than just showing what nm produces. For gnm, I have thought of adding a "view source" button and trying to use the 'line' field (if present). Also with gnm, when the 'line' field is empty (i.e., non-debug object code), hide that column.
When I get round to working out how to make a Solaris package, I'll use that instead of just tar files.



objectviewer hit counter.

Copyright © Paul John Floyd 2006 - 2008.

Valid HTML 4.01!