Generate Objective-C headers from Mach-O files.
Go to file
2003-12-22 00:57:11 +00:00
class-dump.pbproj Replaced contents of datatypes.[hm] with classes: CDType, CDMethodType. 2003-12-20 07:27:12 +00:00
UnitTests Test errors in type strings. 2003-12-21 06:31:58 +00:00
CDClassDump.h Recursive processing nominally works. Need to see if there are 2003-12-15 04:24:38 +00:00
CDClassDump.m Replaced contents of datatypes.[hm] with classes: CDType, CDMethodType. 2003-12-20 07:27:12 +00:00
CDDylibCommand.h A bunch of work starting at the beginning, with classes to process the 2003-12-09 01:50:32 +00:00
CDDylibCommand.m A bunch of work starting at the beginning, with classes to process the 2003-12-09 01:50:32 +00:00
CDLoadCommand.h Recursive processing nominally works. Need to see if there are 2003-12-15 04:24:38 +00:00
CDLoadCommand.m Recursive processing nominally works. Need to see if there are 2003-12-15 04:24:38 +00:00
CDMachOFile.h Recursive processing nominally works. Need to see if there are 2003-12-15 04:24:38 +00:00
CDMachOFile.m Recursive processing nominally works. Need to see if there are 2003-12-15 04:24:38 +00:00
CDMethodType.h Replaced contents of datatypes.[hm] with classes: CDType, CDMethodType. 2003-12-20 07:27:12 +00:00
CDMethodType.m Replaced contents of datatypes.[hm] with classes: CDType, CDMethodType. 2003-12-20 07:27:12 +00:00
CDObjCSegmentProcessor-Private.h Removed some commented lines, unused code. Split 2003-12-15 05:36:34 +00:00
CDObjCSegmentProcessor-Private.m Removed some commented lines, unused code. Split 2003-12-15 05:36:34 +00:00
CDObjCSegmentProcessor.h Removed some commented lines, unused code. Split 2003-12-15 05:36:34 +00:00
CDObjCSegmentProcessor.m Removed some commented lines, unused code. Split 2003-12-15 05:36:34 +00:00
CDOCCategory.h Subclass CDOCClass and CDOCCategory from CDOCProtocol so that we can 2003-12-15 00:12:18 +00:00
CDOCCategory.m Subclass CDOCClass and CDOCCategory from CDOCProtocol so that we can 2003-12-15 00:12:18 +00:00
CDOCClass.h Subclass CDOCClass and CDOCCategory from CDOCProtocol so that we can 2003-12-15 00:12:18 +00:00
CDOCClass.m Subclass CDOCClass and CDOCCategory from CDOCProtocol so that we can 2003-12-15 00:12:18 +00:00
CDOCIvar.h Getting closer. Sorting stuff for easier comparison against previous version. 2003-12-10 06:21:50 +00:00
CDOCIvar.m Added class to format types and method types. 2003-12-19 05:53:43 +00:00
CDOCMethod.h Getting closer. Sorting stuff for easier comparison against previous version. 2003-12-10 06:21:50 +00:00
CDOCMethod.m Don't include trailing ';' when formatting methods so that we can just 2003-12-19 06:22:28 +00:00
CDOCModule.h Getting closer. Sorting stuff for easier comparison against previous version. 2003-12-10 06:21:50 +00:00
CDOCModule.m Getting closer. Sorting stuff for easier comparison against previous version. 2003-12-10 06:21:50 +00:00
CDOCProtocol.h Subclass CDOCClass and CDOCCategory from CDOCProtocol so that we can 2003-12-15 00:12:18 +00:00
CDOCProtocol.m Subclass CDOCClass and CDOCCategory from CDOCProtocol so that we can 2003-12-15 00:12:18 +00:00
CDOCSymtab.h Getting closer. Sorting stuff for easier comparison against previous version. 2003-12-10 06:21:50 +00:00
CDOCSymtab.m Hacked in category support. 2003-12-12 08:42:09 +00:00
CDSection.h A bunch of work starting at the beginning, with classes to process the 2003-12-09 01:50:32 +00:00
CDSection.m A bunch of work starting at the beginning, with classes to process the 2003-12-09 01:50:32 +00:00
CDSectionInfo.h Changed email address from 'nygard@omnigroup.com' to 'class-dump at 2003-09-05 20:30:26 +00:00
CDSectionInfo.m Fixed a bunch of trailing whitespace problems using the newly 2003-12-05 06:49:43 +00:00
CDSegmentCommand.h A bunch of work starting at the beginning, with classes to process the 2003-12-09 01:50:32 +00:00
CDSegmentCommand.m A bunch of work starting at the beginning, with classes to process the 2003-12-09 01:50:32 +00:00
CDType.h Simplified type formatted. Unit tests are cool. Added a few more 2003-12-21 05:48:37 +00:00
CDType.m Simplified type formatted. Unit tests are cool. Added a few more 2003-12-21 05:48:37 +00:00
CDTypeFormatter.h Replaced contents of datatypes.[hm] with classes: CDType, CDMethodType. 2003-12-20 07:27:12 +00:00
CDTypeFormatter.m Don't need to include datatypes.h any more. 2003-12-20 07:36:40 +00:00
CDTypeLexer.h Caching the lexer's character sets yields a 3.5x speed increase for a 2003-12-19 06:39:50 +00:00
CDTypeLexer.m Caching the lexer's character sets yields a 3.5x speed increase for a 2003-12-19 06:39:50 +00:00
CDTypeParser.h Replaced contents of datatypes.[hm] with classes: CDType, CDMethodType. 2003-12-20 07:27:12 +00:00
CDTypeParser.m Don't need to include datatypes.h any more. 2003-12-20 07:36:40 +00:00
class-dump.h All the method types are looking good for both Foundatoin and AppKit, 2003-12-12 04:01:38 +00:00
class-dump.html A bunch of work starting at the beginning, with classes to process the 2003-12-09 01:50:32 +00:00
class-dump.m Providing support for testing types while expanding structs/unions. 2003-12-22 00:57:11 +00:00
datatypes.h Removed unused function reverse_types(). 2003-12-17 05:53:09 +00:00
datatypes.m Removed unused function reverse_types(). 2003-12-17 05:53:09 +00:00
doTests Compare output from old and new versions. 2003-09-07 00:41:33 +00:00
foundation-types.txt Providing support for testing types while expanding structs/unions. 2003-12-22 00:57:11 +00:00
gram.y Fixed whitespace. 2003-12-17 05:57:59 +00:00
keys.txt Added file to map template keys to their values. Not used yet. 2003-12-21 06:22:09 +00:00
lexer.c Removed more references to omnigroup.com. 2003-09-05 20:33:28 +00:00
MappedFile.h Changed email address from 'nygard@omnigroup.com' to 'class-dump at 2003-09-05 20:30:26 +00:00
MappedFile.m Changed email address from 'nygard@omnigroup.com' to 'class-dump at 2003-09-05 20:30:26 +00:00
NSArray-Extensions.h Discovered that protocols may have class methods, which I didn't know before. 2003-12-09 08:44:01 +00:00
NSArray-Extensions.m Discovered that protocols may have class methods, which I didn't know before. 2003-12-09 08:44:01 +00:00
NSScanner-Extensions.h All the method types are looking good for both Foundatoin and AppKit, 2003-12-12 04:01:38 +00:00
NSScanner-Extensions.m All the method types are looking good for both Foundatoin and AppKit, 2003-12-12 04:01:38 +00:00
NSString-Extensions.h Trying to clean up some code. 2003-12-16 07:30:16 +00:00
NSString-Extensions.m Trying to clean up some code. 2003-12-16 07:30:16 +00:00
ObjcCategory.h Applied changes from Jonathan Rentzsch and Stephane Corthesy, although 2003-09-06 21:17:56 +00:00
ObjcCategory.m Fixed a bunch of trailing whitespace problems using the newly 2003-12-05 06:49:43 +00:00
ObjcClass.h Working on replacing yacc grammar with recursive descent parser, and 2003-09-09 22:51:07 +00:00
ObjcClass.m Fixed a bunch of trailing whitespace problems using the newly 2003-12-05 06:49:43 +00:00
ObjcIvar.h Working on replacing yacc grammar with recursive descent parser, and 2003-09-09 22:51:07 +00:00
ObjcIvar.m Disabled yacc grammar for parsing types. Replace with CDTypeParser 2003-12-11 05:54:27 +00:00
ObjcMethod.h Changed email address from 'nygard@omnigroup.com' to 'class-dump at 2003-09-05 20:30:26 +00:00
ObjcMethod.m Disabled yacc grammar for parsing types. Replace with CDTypeParser 2003-12-11 05:54:27 +00:00
ObjcProtocol.h Changed email address from 'nygard@omnigroup.com' to 'class-dump at 2003-09-05 20:30:26 +00:00
ObjcProtocol.m Fixed a bunch of trailing whitespace problems using the newly 2003-12-05 06:49:43 +00:00
ObjcThing.h Applied changes from Jonathan Rentzsch and Stephane Corthesy, although 2003-09-06 21:17:56 +00:00
ObjcThing.m Changed email address from 'nygard@omnigroup.com' to 'class-dump at 2003-09-05 20:30:26 +00:00
README I forgot to add this class. 2003-12-14 22:44:39 +00:00

class-dump is a utility for examining the Objective-C segment of
Mach-O files.  It generates the @interface and @protocol declarations
for classes, categories and protocols.

class-dump generates interface definitions for Objective-C class,
category and protocols from Mach-O files.  It uses the information
stored in the __OBJC segment that the Objective-C runtime system
needs/uses.

Version 2 is a re-implementation of Eric P. Scott's class-dump, and
works with the frameworks in Openstep 4.x.

The class-dump version 2.1.6 package includes source that should
compile on Mac OS X.  This package includes the binary
compiled for Mac OS X:

    class-dump-2.1.6-bs.tar.gz        (Mac OS X)

Most of the changes since version 2.1.2 have been fixes for Mac OS X,
so I haven't updated the Mac OS X Server, Openstep and Nextstep
packages:

    class-dump-2.1.2-PI-bs.tar.gz     (Mac OS X Server)
    class-dump.2.1.2.m.NIS.bs.tar.gz  (Openstep)
    class-dump.2.1.2.NIHS.bs.tar.gz   (Nextstep)

I intend to remove support for these older operating systems in a future
release.

These are all available from my website at:

    http://homepage.mac.com/nygard/Projects/index.html

Differences between 2.1.6 and 2.1.5
    - Anjo Krank added an option, -I, to sort the classes by
      dependancy.
    - Kurt Revis made some changes to support filenames that contain
      some non-ASCII characters.
    - Jonathan Rentzsch added an option, -H, to generate separate header
      files for each class and protocol.
    - Stephane Corthesy made some changes:
      - all error messages are prefixed by // to have a C comment line instead
      - "struct ?" no longer appears
      - protocols no longer display an IMP address
      - compiles with gcc 3.3 on Panther

Differences between 2.1.5 and 2.1.4

    - Compiled on Mac OS X.  The release notes say "Do Not Use Pre-GM
      Compilers to Build Software for Mac OS X", so I've recompiled this.
    - No changes other than the version number and README.

Differences between 2.1.4 and 2.1.3

    - Carl Lindberg made some changes that make class-dump work
      better on Mac OS X Public Beta:
      - It's a little better about backward compatibility with old
        frameworks that still work on Public Beta.
      - It fixes most of the syntax errors we were getting when
        parsing types.  (We were having trouble with union types.)
    - It now understands framework install names and the framework
      search path, so you should be able to run it on apps or
      frameworks where the install name of the frameworks is not where
      the framework exists in the filesystem.  The Omni frameworks,
      for example, change the install name.
    - It will search for an app executable in the Contents/MacOS
      directory of the app wrapper that Mac OS X uses if you just
      use the path to the main app wrapper.
    - You can set the ClassDumpDebugFrameworkPaths environment variable
      to see the steps it's going through to find the frameworks.  It
      spits out a lot of stuff, but it may be useful for someone.  With
      zsh, you can do this:
          ClassDumpDebugFrameworkPaths=YES class-dump /System/Applications/MailViewer.app

Differences between 2.1.3 and 2.1.2

    - James McIlree made these changes to get class-dump running on
      Mac OS X DP4:
      - The OS X mach-o files keep some information in the __TEXT
        __cstring section. I've made a small set of tweeks to cause
        class-dump to look in the correct segment and section.
      - The build on OS X defines NS_TARGET_MAJOR as 5, this needs
        to be set in order to get the new code.

Differences between 2.1.2 and 2.1.1

    - Tom Hageman has provided the changes to make it work with object
      files and bundles.  In the previous version, the output was empty.
    - It shouldn't crash if there are fewer types than it expects while
      formatting a method.  This is most likely triggered by incompatible
      current versions of frameworks.

Differences between 2.1.1 and 2.1.0

    - Compiles under Rhapsody, Openstep and Foundation based Nextstep
      3.3.  Tom Hageman provided the changes to get it working with
      Nextstep 3.3 and compiled it quad-fat.
    - Under Rhapsody, the -C option now takes egrep style regular
      expressions to match categories and protocols.  It will still
      work as before with text strings, but you can, for example,
      specify -C 'View|Window' to match classes with both strings.

Differences between 2.1.0 and 2.0

    - The -a option has been split into -a, which just shows instance
      variable offsets, and -A, which shows method addresses.
      (Suggested by Charles Lloyd.)
    - Protocol definitions are all printed at the beginning of the
      output for each file.  Duplicate protocol definitions are no
      longer shown.
    - New option, -S, to sort the output.  Protocols are sorted by
      name.  Classes and categories are sorted by name.  Class and
      instance methods are each sorted by name.  (Suggested by
      Charles Lloyd.)
    - When the -S option is not used, the method definitions are
      printed out reversed from the order they are found in the
      Mach-O file.  This should reflect the order they are declared
      in the original source file.
    - The effect of the -C option has changed.  It now matches
      category and protocol names instead of just class names.
      (Carl Lindberg pointed out that categories should also be matched.)
    - Corrected output when the target file doesn't have an
      Objective-C segment.
    - An 'id *' type  should now be printed correctly.
    - Fixed printing of pointers to arrays.
    - Fixed printing of multi-dimensional arrays.
    - Made #ifdefs of LC_PREBOUND_DYLIB and LC_LOAD_DYLIB independant
      for compiling under 3.3 (Suggested by Carl Lindberg.)
    - This now uses the Foundation framework, so it may not work with
      Nextstep 3.x.
    - flex is no longer required.
    - The version number of class-dump is now included in the output.

Visible differences between version 2 and version 1

    - class-dump works with framework based files (the whole point of this
      exercise!)
    - The class declaration shows the adopted protocols.
    - Protocol definitions are shown before (rather than after) the class
      declaration.
    - New option, -r, to recursively expand frameworks and fixed VM
      shared libraries.
    - A comment is generated to show the file where the classes are
      defined.  This is helpful when using the -r option.
    - New option, -s, to use "char *" instead of "STR".

Known problems

    - The Nexttime bundles under 4.1 seem to have invalid pointers for some of
      the method names (they point into the __meth_var_types section instead of
      the __meth_var_names section) and therefore generate errors.  This may be
      caused from being compiled against a different "current version" of a
      framework than what is available on the current system.  For example:

        4.1 Nexttime bundles: compatibility version 129.0.0, current version 153.0.0
        4.1 Foundation framework: compatibility version 129.0.0, current version 154.0.0

      This also shows up in the AppleMenuOptions.app under Rhapsody DR2.
    - A couple old applications have type strings that the parser can't handle.

Compiling

    Mac OS X

        This should build directly from Project Builder.  There are
        a couple of harmless warnings.

    Openstep, Nextstep

        Bison is required to compile this.  There should be no warnings.

        To compile first copy the PB.project and Makefiles from one
        of the Nextstep or Openstep directories into the
        main source directory and then build it.

Comments and suggestions are welcomed.

Steve Nygard <class-dump at codethecode.com>