home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / som / include / somdebug.h < prev    next >
C/C++ Source or Header  |  1999-02-22  |  5KB  |  141 lines

  1. /*
  2.  *   COMPONENT_NAME: somk
  3.  *
  4.  *   ORIGINS: 27
  5.  *
  6.  *
  7.  *    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1996,1996  
  8.  *   All Rights Reserved
  9.  *   Licensed Materials - Property of IBM
  10.  *   US Government Users Restricted Rights - Use, duplication or
  11.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12.  */
  13. /* @(#) /16 1.6.1.2 12/26/95 15:57:49 [7/30/96 14:50:38] */
  14.  
  15. /*
  16.  *
  17.  */
  18.  
  19. /*
  20.  *    SOMDEBUG.H
  21.  *      SOM Kernel Debugging Hooks
  22.  *
  23.  *      We assume a debugger that operates in its own process and
  24.  *      has access to the memory in another process that is being
  25.  *      debugged.  
  26.  *
  27.  *      The SOM Kernel Debugging Hook functions described here use
  28.  *      a debugger-supplied function (prototyped below as SOMTD_SOMPeek)
  29.  *      to reach into the process being debugged and compute various
  30.  *      results useful to debuggers.  No side-effect are experienced
  31.  *      in the debugged process as a result of invoking these functions.
  32.  *
  33.  *      To install the debugger-supplied SOMTD_SOMPeek function,
  34.  *      simply place its address in the SOMPeek external variable.
  35.  *
  36.  *      All addresses returned from the SOM Kernel Debugging Hook
  37.  *      functions refer to memory in the debugged process, with
  38.  *      ONE exception.  The sequence returned from 
  39.  *      somDbgGetInstanceDataOffsets has its buffer allocated in
  40.  *      the debugger's process (to avoid side-effect in the debugged
  41.  *      process).  The space for this buffer is obtained via "malloc".
  42.  *      The debugger must free the buffer when finished with it, using
  43.  *      code similar to the following:
  44.  *
  45.  *          SOMClass_somOffsets result;
  46.  *          result = somDbgGetInstanceDataOffsets (cls);
  47.  *          ...
  48.  *          if (result._length)
  49.  *              free (result._buffer);
  50.  */
  51.  
  52. #ifndef somdebug_h
  53. #define somdebug_h
  54.  
  55. #include <som.h>
  56.  
  57. /*
  58.  * somDbgIdSequence type -- used as a return type for some Dbg functions.
  59.  */
  60. typedef struct {
  61.     long   _maximum;
  62.     long   _length;
  63.     char **_buffer;
  64. } somDbgIdSequence;
  65.  
  66. #if defined(__IBMC__) && defined(__OS2__)
  67.   #pragma linkage(SOMTD_SOMPeek, system)
  68.   #pragma linkage(somDbgDataResolve, system)
  69.   #pragma linkage(somDbgGetAllMethodDescriptors, system)
  70.   #pragma linkage(somDbgGetClass, system)
  71.   #pragma linkage(somDbgGetClassName, system)
  72.   #pragma linkage(somDbgGetInstanceDataOffsets, system)
  73.   #pragma linkage(somDbgGetInstanceSize, system)
  74.   #pragma linkage(somDbgGetIntroducedMethodDescriptors, system)
  75.   #pragma linkage(somDbgGetName, system)
  76.   #pragma linkage(somDbgGetParents, system)
  77.   #pragma linkage(somDbgGetVersionNumbers, system)
  78.   #pragma linkage(somDbgIsObj, system)
  79.   #pragma linkage(somDbgProtectedDataOffset, system)
  80.   #pragma linkage(somDbgResolveMethod, system)
  81. #endif
  82.  
  83. /*
  84.  *    The following debugger-supplied function extracts memory
  85.  *      from the debugged process begining at the address specified
  86.  *      by "startAddr" in the debugged process and copies it into the 
  87.  *      address specified by "targetAddr" in the current process until
  88.  *      the number of bytes specified by length have been transferred.
  89.  *      If everything completes successfully the function must return
  90.  *      the value TRUE, otherwise FALSE must be returned.
  91.  */
  92. typedef long SOMLINK SOMTD_SOMPeek (void *startAddr, long length, 
  93.                     void *targetAddr);
  94. SOMEXTERN SOMTD_SOMPeek *SOMPeek;
  95.  
  96. /*
  97.  * somDbg functions
  98.  */
  99.  
  100. SOMEXTERN void * SOMLINK
  101.     somDbgDataResolve(SOMObject *obj, somDToken dtoken);
  102.  
  103. SOMEXTERN somDbgIdSequence SOMLINK
  104.     somDbgGetAllMethodDescriptors(SOMClass *cls);
  105.  
  106. SOMEXTERN SOMClass * SOMLINK
  107.     somDbgGetClass (SOMObject *obj);
  108.  
  109. SOMEXTERN string SOMLINK
  110.     somDbgGetClassName (SOMObject *obj);
  111.  
  112. SOMEXTERN SOMClass_somOffsets SOMLINK
  113.     somDbgGetInstanceDataOffsets(SOMClass *somSelf);
  114.  
  115. SOMEXTERN long SOMLINK
  116.     somDbgGetInstanceSize(SOMClass *cls);
  117.  
  118. SOMEXTERN somDbgIdSequence SOMLINK
  119.     somDbgGetIntroducedMethodDescriptors(SOMClass *cls);
  120.  
  121. SOMEXTERN string SOMLINK
  122.     somDbgGetName (SOMClass *cls);
  123.  
  124. SOMEXTERN SOMClassSequence SOMLINK
  125.     somDbgGetParents(SOMClass *cls);
  126.  
  127. SOMEXTERN void SOMLINK
  128.     somDbgGetVersionNumbers(SOMClass *cls, long *major, long *minor);
  129.  
  130. SOMEXTERN boolean SOMLINK
  131.     somDbgIsObj(SOMObject *obj);
  132.  
  133. SOMEXTERN unsigned long SOMLINK
  134.     somDbgProtectedDataOffset(SOMClass *cls);
  135.  
  136. SOMEXTERN somMethodProc * SOMLINK
  137.     somDbgResolveMethod (SOMObject *obj, somMToken mtoken);
  138.  
  139.  
  140. #endif /* somdebug_h */
  141.