home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Id: MachOFile.h,v 1.10 94/05/04 11:20:18 ediger Exp Locker: ediger $
- * $Log: MachOFile.h,v $
- * Revision 1.10 94/05/04 11:20:18 ediger
- * support for finding which segment a thread's pc is in
- *
- * Revision 1.9 94/05/01 17:32:04 ediger
- * added - (struct section *)sectionNamed:: method
- *
- * Revision 1.8 94/02/07 21:21:01 ediger
- * added methods and instance vars to allow an already-mapped file
- * to be represented by the MachOFile object instance.
- *
- * Revision 1.7 94/01/30 16:28:52 ediger
- * add support for threads
- *
- * Revision 1.6 93/12/18 22:48:44 ediger
- * -initFromFileNamed: method renamed to -fillFromFileNamed:
- *
- * Revision 1.5 93/12/07 23:30:53 ediger
- * added cpuType and cpuSubtype methods
- * split error number return between lastErrno and lastKernReturn inst vars
- *
- * Revision 1.4 93/12/02 00:27:53 ediger
- * added -(char *)fileType method declaration
- *
- * Revision 1.3 93/10/31 21:33:54 ediger
- * removed declarations of -printSegments and +new
- *
- * Revision 1.2 93/10/27 23:43:42 ediger
- * Definition of MachOFile object that uses LoadCommand subclasses
- *
- */
- #import <stdlib.h>
- #import <libc.h>
- #import <sys/types.h>
- #import <sys/stat.h>
- #import <fcntl.h>
- #import <assert.h>
- #import <objc/Object.h>
- #import <mach/mach.h>
- #import <mach/mach_error.h>
- #import <mach-o/loader.h>
- #import <errno.h>
- #import <mach/mach_error.h>
-
- #import <objc/List.h>
- #import <SortedList.h>
- #import <LoadCommand.h>
-
- @interface MachOFile: Object
- {
- SortedList *mappedSegmentList;
- List *unmappedSegmentList;
- List *threadList;
- int *threadSegment;
-
- struct mach_header *fileHeader;
-
- vm_offset_t mappedFileAddress;
- vm_size_t mappedFileSize;
- int fileDescriptor;
-
- BOOL mapsFile;
- BOOL addMappedFiles;
-
- int lastErrno;
- kern_return_t lastKernReturn;
- }
-
- - free;
- - init;
-
- // do the rest of the initialization
- - fillFromFileNamed: (char *)filename;
- - fillFromAddress: (char *)address;
-
- // internal use method
- - (int)mapFile: (char *)filename;
-
- // count of segments or threads
- - (int)mappedSegments;
- - (int)unmappedSegments;
- - (int)threads;
-
- - (int)segmentOfThread:(int)threadNumber;
-
- // actually gives back LoadCommand subclass
- - mappedSegment: (int)segmentNumber;
- - unmappedSegment: (int)segmentNumber;
- - thread: (int)threadNumber;
-
- // give back a pointer to a piece of an LC_SEGMENT
- - (struct section *)sectionNamed:(char *)sectName inSegNamed:(char *)segName;
-
- // printable strings about the file.
- - (char *)fileType;
- - (char *)cpuType;
- - (char *)cpuSubtype;
-
- // change how object views the file
- - considerMappedFiles;
- - unconsiderMappedFiles;
- - removeSegment:aLoadCommand;
-
- @end
-