This is basically version 2.1.3 that James McIlree released for OSX

DP4.  There's no need to put the pbproj file in an OSX directory,
since it doesn't conflict with anything like the makefiles for
multiple releases did.
This commit is contained in:
Steve Nygard 2000-06-23 23:45:11 +00:00
parent d173ac8446
commit 77bc3ebc00
2 changed files with 61 additions and 25 deletions

30
README
View File

@ -6,9 +6,9 @@ Version 2 is a re-implementation of Eric P. Scott's class-dump, and
works with the frameworks in Openstep 4.x.
The source compiles on Nextstep 3.3 with Foundation, Openstep, and
OS X dp4.
Rhapsody DR2, and OS X dp4.
class-dump-2.1.3-bs.tar.gz (OS X dp4)
class-dump-2.1.2-PI-bs.tar.gz (Rhapsody DR2)
class-dump.2.1.2.m.NIS.bs.tar.gz (Openstep)
class-dump.2.1.2.NIHS.bs.tar.gz (Nextstep)
@ -17,22 +17,8 @@ Compiling
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. For OSX, just use
the new project builder file.
Differences between 2.1.4 and 2.1.3
- 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.
- 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
of the Nextstep, Openstep, Rhapsody or OSX directories into the
main source directory and then build it.
Differences between 2.1.3 and 2.1.2
@ -42,7 +28,7 @@ Differences between 2.1.3 and 2.1.2
- 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
Differences between 2.1.1 and 2.1.2
- Tom Hageman has provided the changes to make it work with object
files and bundles. In the previous version, the output was empty.
@ -50,7 +36,7 @@ Differences between 2.1.2 and 2.1.1
formatting a method. This is most likely triggered by incompatible
current versions of frameworks.
Differences between 2.1.1 and 2.1.0
Differences between 2.1.0 and 2.1.1
- Compiles under Rhapsody, Openstep and Foundation based Nextstep
3.3. Tom Hageman provided the changes to get it working with
@ -60,7 +46,7 @@ Differences between 2.1.1 and 2.1.0
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
Differences between 2.0 and 2.1.0
- The -a option has been split into -a, which just shows instance
variable offsets, and -A, which shows method addresses.
@ -120,4 +106,4 @@ Known problems
Comments and suggestions are welcomed.
Steve Nygard <nygard@omnigroup.com>
Steve Nygard <nygard@telusplanet.net>

View File

@ -1,5 +1,5 @@
//
// $Id: class-dump.m,v 1.1 1999/07/31 03:32:26 nygard Exp $
// $Id: class-dump.m,v 1.1.1.1.2.1 2000/06/23 23:45:07 nygard Exp $
//
//
@ -84,7 +84,7 @@ struct dylib_command {
//----------------------------------------------------------------------
#define CLASS_DUMP_VERSION "2.1.2"
#define CLASS_DUMP_VERSION "2.1.3"
int expand_structures_flag = 0;
int char_star_flag = 0;
@ -126,13 +126,19 @@ int section_count = 0;
#define SEC_CLS_METH "__cls_meth"
#define SEC_INST_METH "__inst_meth"
#define SEC_META_CLASS "__meta_class"
#define SEC_CLASS_NAMES "__class_names"
#define SEC_MODULE_INFO "__module_info"
#define SEC_CAT_CLS_METH "__cat_cls_meth"
#define SEC_INSTANCE_VARS "__instance_vars"
#define SEC_CAT_INST_METH "__cat_inst_meth"
#if NS_TARGET_MAJOR >= 5
#define SEC_CLASS_NAMES "__cstring"
#define SEC_METH_VAR_TYPES "__cstring"
#define SEC_METH_VAR_NAMES "__cstring"
#else
#define SEC_CLASS_NAMES "__class_names"
#define SEC_METH_VAR_TYPES "__meth_var_types"
#define SEC_METH_VAR_NAMES "__meth_var_names"
#endif
//======================================================================
@ -182,6 +188,7 @@ void process_dylib_command (void *start, void *ptr);
void process_fvmlib_command (void *start, void *ptr);
void process_segment_command (void *start, void *ptr, char *filename);
void process_objc_segment (void *start, void *ptr, char *filename);
void process_text_segment (void *start, void *ptr, char *filename);
struct section_info *find_objc_section (char *name, char *filename);
void *translate_address_to_pointer (long addr, char *section);
@ -361,6 +368,11 @@ void process_segment_command (void *start, void *ptr, char *filename)
{
process_objc_segment (start, ptr, filename);
}
if (!strcmp (name, SEG_TEXT))
{
process_text_segment (start, ptr, filename);
}
}
//----------------------------------------------------------------------
@ -387,10 +399,48 @@ void process_objc_segment (void *start, void *ptr, char *filename)
objc_sections[section_count].vmaddr = section->addr;
objc_sections[section_count].size = section->size;
if (!strcmp(section->segname, SEG_OBJC)) section_count++;
#if NS_TARGET_MAJOR >= 5
if (!strcmp(section->segname, SEG_TEXT) && !strcmp(section->sectname,SEC_CLASS_NAMES))
section_count++;
#endif
section++;
}
}
void process_text_segment (void *start, void *ptr, char *filename)
{
struct segment_command *sc = (struct segment_command *)ptr;
struct section *section = (struct section *)(sc + 1);
int l;
// In the text segment, we only want to extract the __cstring
// section.
#if NS_TARGET_MAJOR >= 5
for (l = 0; l < sc->nsects; l++)
{
if (section_count >= MAX_SECTIONS)
{
printf ("Error: Maximum number of sections reached.\n");
return;
}
if (!strcmp(SEC_CLASS_NAMES,section->sectname))
{
objc_sections[section_count].filename = filename;
strncpy (objc_sections[section_count].name, section->sectname, 16);
objc_sections[section_count].name[16] = 0;
objc_sections[section_count].section = section;
objc_sections[section_count].start = start + section->offset;
objc_sections[section_count].vmaddr = section->addr;
objc_sections[section_count].size = section->size;
if (!strcmp(section->segname, SEG_TEXT)) section_count++;
}
section++;
}
#endif
}
//----------------------------------------------------------------------
// Find the Objective-C segment for the given filename noted in our