Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

341 lines
7.1 KiB

  1. /*++
  2. Copyright (c) 1995-1997 Microsoft Corporation
  3. Module Name:
  4. dbgwxin.cxx
  5. Abstract:
  6. This module contains the default ntsd debugger extensions for
  7. IIS - WAM
  8. Author:
  9. DaveK 3-Oct-1997
  10. Revision History:
  11. --*/
  12. #include "inetdbgp.h"
  13. #include <wamxbase.hxx>
  14. //
  15. // undef these macros, which otherwise would break compile
  16. // UNDONE remove these macros from inetdbgp.h
  17. //
  18. #undef malloc
  19. #undef calloc
  20. #undef realloc
  21. #undef free
  22. #include <isapip.hxx>
  23. #include <wamobj.hxx>
  24. # undef DBG_ASSERT
  25. VOID
  26. PrintWamExecInfo( WAM_EXEC_BASE * pwxinOriginal,
  27. WAM_EXEC_BASE * pwxin,
  28. CHAR Verbosity );
  29. VOID
  30. PrintWamExecInfoThunk( PVOID pwxDebuggee,
  31. PVOID pwxDebugger,
  32. CHAR verbosity,
  33. DWORD iCount)
  34. {
  35. //
  36. // NOTE we must thunk through this function because
  37. // EnumLinkedList expects a PFN_LIST_ENUMERATOR,
  38. // which is what this function is
  39. //
  40. PrintWamExecInfo(
  41. (WAM_EXEC_BASE *) pwxDebuggee
  42. , (WAM_EXEC_BASE *) pwxDebugger
  43. , verbosity
  44. );
  45. return;
  46. } // PrintWamRequestThunk()
  47. VOID
  48. DumpWamExecInfoList(
  49. char * lpArgumentString
  50. , PFN_LIST_ENUMERATOR pfnWX
  51. )
  52. {
  53. CHAR Verbosity;
  54. LIST_ENTRY * pwxListHead;
  55. //
  56. // set verbosity to character immediately after the 'l'
  57. // or to '0' if none
  58. //
  59. lpArgumentString++;
  60. Verbosity = (*lpArgumentString == ' ')
  61. ? '0'
  62. : *lpArgumentString
  63. ;
  64. lpArgumentString++;
  65. //
  66. // move past spaces - bail if we reach end of string
  67. //
  68. while (*lpArgumentString == ' ') {
  69. lpArgumentString++;
  70. }
  71. if ( !*lpArgumentString ) {
  72. PrintUsage( "wxin" );
  73. return;
  74. }
  75. //
  76. // remainder of argument string is wam address
  77. // in debuggee process
  78. //
  79. WAM * pwam = (WAM *) GetExpression( lpArgumentString );
  80. if ( !pwam ) {
  81. dprintf(
  82. "inetdbg.wxin: Unable to evaluate \"%s\"\n"
  83. , lpArgumentString
  84. );
  85. return;
  86. }
  87. //
  88. // address of list head within debuggee process
  89. // = (wam address) + (offset of list head entry within WAM struct)
  90. //
  91. pwxListHead
  92. = (LIST_ENTRY *)
  93. ( ((BYTE *) pwam) + FIELD_OFFSET(WAM, m_WamExecInfoListHead) );
  94. if ( NULL == pwxListHead) {
  95. dprintf( " Unable to get WamExecInfo list \n");
  96. return;
  97. }
  98. EnumLinkedList(
  99. pwxListHead
  100. , pfnWX
  101. , Verbosity
  102. , sizeof( WAM_EXEC_BASE)
  103. , FIELD_OFFSET( WAM_EXEC_BASE, _ListEntry )
  104. );
  105. return;
  106. } // DumpWamExecInfoList()
  107. DECLARE_API( wxin )
  108. /*++
  109. Routine Description:
  110. This function is called as an NTSD extension to format and dump
  111. an object attributes structure.
  112. Arguments:
  113. hCurrentProcess - Supplies a handle to the current process (at the
  114. time the extension was called).
  115. hCurrentThread - Supplies a handle to the current thread (at the
  116. time the extension was called).
  117. CurrentPc - Supplies the current pc at the time the extension is
  118. called.
  119. lpExtensionApis - Supplies the address of the functions callable
  120. by this extension.
  121. lpArgumentString - Supplies the asciiz string that describes the
  122. ansi string to be dumped.
  123. Return Value:
  124. None.
  125. --*/
  126. {
  127. DEFINE_CPP_VAR( WAM_EXEC_BASE, wxin );
  128. WAM_EXEC_BASE * pwxin;
  129. INIT_API();
  130. while (*lpArgumentString == ' ')
  131. lpArgumentString++;
  132. if ( !*lpArgumentString )
  133. {
  134. PrintUsage( "wxin" );
  135. return;
  136. }
  137. if ( *lpArgumentString == '-' )
  138. {
  139. lpArgumentString++;
  140. if ( *lpArgumentString == 'h' )
  141. {
  142. PrintUsage( "wxin" );
  143. return;
  144. }
  145. if ( *lpArgumentString == 'l' ) {
  146. DumpWamExecInfoList(
  147. lpArgumentString
  148. , PrintWamExecInfoThunk
  149. );
  150. return;
  151. }
  152. } // if
  153. //
  154. // Treat the argument as the address of a WAM_EXEC_BASE
  155. //
  156. pwxin = (WAM_EXEC_BASE * ) GetExpression( lpArgumentString );
  157. if ( !pwxin )
  158. {
  159. dprintf( "inetdbg.wxin: Unable to evaluate \"%s\"\n",
  160. lpArgumentString );
  161. return;
  162. }
  163. move( wxin, pwxin );
  164. PrintWamExecInfo( pwxin, GET_CPP_VAR_PTR( WAM_EXEC_BASE, wxin), '2');
  165. return;
  166. } // DECLARE_API( wxin )
  167. VOID
  168. PrintWamExecInfo( WAM_EXEC_BASE * pwxinOriginal,
  169. WAM_EXEC_BASE * pwxin,
  170. CHAR Verbosity )
  171. /*++
  172. Description:
  173. This function takes the WAM_EXEC_BASE object and prints out
  174. the details for the same in the debugger. The granularity of the
  175. deatils are controlled by the verbosity flag
  176. Arguments:
  177. pwxinOriginal - pointer to the location where the original WAM_EXEC_BASE
  178. object is located.
  179. Note: pwxinOriginal points to object inside debuggee process
  180. pwxin - pointer to the WAM_EXEC_BASE object that is a copy
  181. of the contents located at [pwxinOriginal]
  182. Note: pwxin points to object inside the debugger process
  183. Verbostiy - level of details requested.
  184. Returns:
  185. None
  186. --*/
  187. {
  188. if ( Verbosity >= '0') {
  189. //
  190. // Print basic info for the WAM_EXEC_BASE object
  191. //
  192. dprintf(
  193. "WAM_EXEC_BASE: %08p m_pWam = %08p m_fInProcess = %08x\n"
  194. "\tRef count = %d \n"
  195. "\t m_pIWamReqIIS = %08p m_pIWamReqInproc = %08p \n"
  196. "\t m_pIWamReqSmartISA = %08p m_gipIWamRequest = %08x \n"
  197. "\t m_dwThreadIdIIS = %08x m_dwThreadIdISA = %08x \n"
  198. , pwxinOriginal
  199. , pwxin->m_pWam
  200. , pwxin->m_fInProcess
  201. , pwxin->_cRefs
  202. , pwxin->m_pIWamReqIIS
  203. , pwxin->m_pIWamReqInproc
  204. , pwxin->m_pIWamReqSmartISA
  205. , pwxin->m_gipIWamRequest
  206. , pwxin->m_dwThreadIdIIS
  207. , pwxin->m_dwThreadIdISA
  208. );
  209. }
  210. if ( Verbosity >= '1') {
  211. //
  212. // Print more details for the WAM_EXEC_BASE object
  213. //
  214. dprintf(
  215. "\t _FirstThread = %08x _psExtension = %08p \n"
  216. "\t _dwFlags = %08x _dwChildExecFlags = %08x \n"
  217. "\t _ListEntry.Flink = %08p _ListEntry.Blink = %08p \n"
  218. "\tASYNC_IO_INFO embedded structure: \n"
  219. "\t _dwOutstandingIO = %d _cbLastAsyncIO = %d \n"
  220. "\t _pfnHseIO = %08p _pvHseIOContext = %08p \n"
  221. , 0
  222. , pwxin->_psExtension
  223. , pwxin->_dwFlags
  224. , pwxin->_dwChildExecFlags
  225. , pwxin->_ListEntry.Flink
  226. , pwxin->_ListEntry.Blink
  227. , pwxin->_AsyncIoInfo._dwOutstandingIO
  228. , pwxin->_AsyncIoInfo._cbLastAsyncIO
  229. , pwxin->_AsyncIoInfo._pfnHseIO
  230. , pwxin->_AsyncIoInfo._pvHseIOContext
  231. );
  232. }
  233. if ( Verbosity >= '2') {
  234. //
  235. // UNDONE print strings?
  236. // Print all details for the WAM_EXEC_INFO object
  237. //
  238. }
  239. return;
  240. } // PrintWamExecInfo()
  241.