home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / Apps / DevTools / MachOViewer / Source / LoadCommand.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-29  |  2.5 KB  |  133 lines

  1. /*
  2.  * $Id: LoadCommand.h,v 1.6 94/05/29 14:58:55 ediger Exp Locker: ediger $
  3.  * $Log:    LoadCommand.h,v $
  4.  * Revision 1.6  94/05/29  14:58:55  ediger
  5.  * added - (struct load_command *)loadCommandAddress; to interface
  6.  * 
  7.  * Revision 1.5  94/01/30  16:28:26  ediger
  8.  * add support for getting pc of thread load commands
  9.  * 
  10.  * Revision 1.4  93/10/31  21:34:32  ediger
  11.  * removed declarations of +new and -printSections
  12.  * 
  13.  * Revision 1.3  93/10/28  00:07:34  ediger
  14.  * ditch an unused, unnecessary instance variable
  15.  * 
  16.  * Revision 1.2  93/10/27  23:42:43  ediger
  17.  * changed to one subclass per type of load command
  18.  * 
  19.  */
  20. #import <objc/Object.h>
  21. #import <sys/types.h>
  22. #import <mach-o/loader.h>
  23. #import <mach/m68k/thread_status.h>
  24. #import <mach/i386/thread_status.h>
  25. #import <stdio.h>
  26. #import <libc.h>
  27. #import <assert.h>
  28.  
  29. #import <MachOFile.h>
  30.  
  31. @interface LoadCommand: Object
  32. {
  33.     struct load_command *loadCommand;
  34.     BOOL                 mapped;      // subclasses set as appropriate
  35.     BOOL                 otherFile;   // load command represents another file
  36. }
  37.  
  38.  
  39. + new:(caddr_t)loadCommandAddress;
  40.  
  41. - free;
  42.  
  43. - (unsigned long)commandSize;
  44.  
  45. - (BOOL)isThread;
  46.  
  47. - (BOOL)isMapped;
  48.  
  49. - (BOOL)representsMappedFile;
  50.  
  51. - (struct load_command *)loadCommandAddress;
  52.  
  53. // subclasses need to override some or all of these:
  54. - init;
  55.  
  56. - setLoadCommand: (caddr_t)loadCommandAddress;
  57.  
  58. - (unsigned long)getBaseAddress;
  59.  
  60. - (unsigned long)getUpperAddress;
  61.  
  62. - (char *)commandName;
  63.  
  64. - (int)numberOfSections;
  65.  
  66. @end
  67.  
  68. // LC_SEGMENT load command has to implement a few
  69. // extra methods because of the array of "struct section"
  70. // things it carries around.
  71. @interface SegmentCommand: LoadCommand
  72. {
  73.     struct segment_command *segmentCommand;
  74.     struct section        **sections;
  75. }
  76.  
  77. - fillSections;
  78.  
  79. - (struct section *)getSection:(int)sectionNumber;
  80.  
  81. @end
  82.  
  83. @interface LoadFVMLibCommand: LoadCommand
  84. {
  85.     struct fvmlib_command *fvmlibCommand;
  86.     id                     theOtherFile;
  87. }
  88. - loadOtherFile;
  89. - otherFile;
  90. @end
  91.  
  92. @interface IdFVMLibCommand: LoadFVMLibCommand
  93. {
  94.     char *namebuf;
  95. }
  96. @end
  97.  
  98. @interface IdentCommand: LoadCommand
  99. {
  100. }
  101. @end
  102.  
  103. @interface FVMFileCommand: LoadCommand
  104. {
  105.     struct fvmfile_command *fvmFileCommand;
  106. }
  107. @end
  108.  
  109. @interface SymTabCommand: LoadCommand
  110. {
  111.     struct symtab_command *symTabCommand;
  112. }
  113. @end
  114.  
  115. @interface SymSegCommand: LoadCommand
  116. {
  117.     struct symseg_command *symSegCommand;
  118. }
  119. @end
  120.  
  121. @interface ThreadCommand: LoadCommand
  122. {
  123.     struct thread_command *threadCommand;
  124. }
  125. - (unsigned long)pc;
  126. @end
  127.  
  128. @interface UnixThreadCommand: ThreadCommand
  129. {
  130. }
  131. - (char *)commandName;
  132. @end
  133.