home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / Apps / DevTools / MachOViewer / Source / MachOFile.h < prev    next >
Encoding:
Text File  |  1994-05-03  |  2.7 KB  |  107 lines

  1. /*
  2.  * $Id: MachOFile.h,v 1.10 94/05/04 11:20:18 ediger Exp Locker: ediger $
  3.  * $Log:    MachOFile.h,v $
  4.  * Revision 1.10  94/05/04  11:20:18  ediger
  5.  * support for finding which segment a thread's pc is in
  6.  * 
  7.  * Revision 1.9  94/05/01  17:32:04  ediger
  8.  * added - (struct section *)sectionNamed:: method
  9.  * 
  10.  * Revision 1.8  94/02/07  21:21:01  ediger
  11.  * added methods and instance vars to allow an already-mapped file
  12.  * to be represented by the MachOFile object instance.
  13.  * 
  14.  * Revision 1.7  94/01/30  16:28:52  ediger
  15.  * add support for threads
  16.  * 
  17.  * Revision 1.6  93/12/18  22:48:44  ediger
  18.  * -initFromFileNamed: method renamed to -fillFromFileNamed:
  19.  * 
  20.  * Revision 1.5  93/12/07  23:30:53  ediger
  21.  * added cpuType and cpuSubtype methods
  22.  * split error number return between lastErrno and lastKernReturn inst vars
  23.  * 
  24.  * Revision 1.4  93/12/02  00:27:53  ediger
  25.  * added -(char *)fileType method declaration
  26.  * 
  27.  * Revision 1.3  93/10/31  21:33:54  ediger
  28.  * removed declarations of -printSegments and +new
  29.  * 
  30.  * Revision 1.2  93/10/27  23:43:42  ediger
  31.  * Definition of MachOFile object that uses LoadCommand subclasses
  32.  * 
  33.  */
  34. #import <stdlib.h>
  35. #import <libc.h>
  36. #import <sys/types.h>
  37. #import <sys/stat.h>
  38. #import <fcntl.h>
  39. #import <assert.h>
  40. #import <objc/Object.h>
  41. #import <mach/mach.h>
  42. #import <mach/mach_error.h>
  43. #import <mach-o/loader.h>
  44. #import <errno.h>
  45. #import <mach/mach_error.h>
  46.  
  47. #import <objc/List.h>
  48. #import <SortedList.h>
  49. #import <LoadCommand.h>
  50.  
  51. @interface MachOFile: Object
  52. {
  53.     SortedList         *mappedSegmentList;
  54.     List               *unmappedSegmentList;
  55.     List               *threadList;
  56.     int                *threadSegment;
  57.  
  58.     struct mach_header *fileHeader;
  59.  
  60.     vm_offset_t         mappedFileAddress;
  61.     vm_size_t           mappedFileSize;
  62.     int                 fileDescriptor;
  63.  
  64.     BOOL                mapsFile;
  65.     BOOL                addMappedFiles;
  66.  
  67.     int                 lastErrno;
  68.     kern_return_t       lastKernReturn;
  69. }
  70.  
  71. - free;
  72. - init;
  73.  
  74. // do the rest of the initialization
  75. - fillFromFileNamed: (char *)filename;
  76. - fillFromAddress: (char *)address;
  77.  
  78. // internal use method
  79. - (int)mapFile: (char *)filename;
  80.  
  81. // count of segments or threads
  82. - (int)mappedSegments;
  83. - (int)unmappedSegments;
  84. - (int)threads;
  85.  
  86. - (int)segmentOfThread:(int)threadNumber;
  87.  
  88. // actually gives back LoadCommand subclass
  89. - mappedSegment: (int)segmentNumber;
  90. - unmappedSegment: (int)segmentNumber;
  91. - thread: (int)threadNumber;
  92.  
  93. // give back a pointer to a piece of an LC_SEGMENT
  94. - (struct section *)sectionNamed:(char *)sectName inSegNamed:(char *)segName;
  95.  
  96. // printable strings about the file.
  97. - (char *)fileType;
  98. - (char *)cpuType;
  99. - (char *)cpuSubtype;
  100.  
  101. // change how object views the file
  102. - considerMappedFiles;
  103. - unconsiderMappedFiles;
  104. - removeSegment:aLoadCommand;
  105.  
  106. @end
  107.