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.

489 lines
15 KiB

  1. /*++
  2. Copyright (c) 1995-1999 Microsoft Corporation
  3. Module Name:
  4. help.cxx
  5. Abstract:
  6. This module contains the help text for all commands supported by this
  7. NTSD debugger extension.
  8. Author:
  9. Keith Moore (keithmo) 12-Nov-1997
  10. Revision History:
  11. --*/
  12. #include "inetdbgp.h"
  13. //
  14. // The following structure defines the text displayed in response
  15. // to the "!help" command. This text may also be displayed if invalid
  16. // arguments are passed to a command.
  17. //
  18. typedef struct _HELP_MAP {
  19. //
  20. // This is the name of the command.
  21. //
  22. PSTR Command;
  23. //
  24. // This is a "one-liner" displayed when the user executes "!help".
  25. //
  26. PSTR OneLiner;
  27. //
  28. // This is the full help text displayed when the user executes
  29. // "!help <cmd>".
  30. //
  31. PSTR FullHelp;
  32. } HELP_MAP, *PHELP_MAP;
  33. HELP_MAP HelpMaps[] =
  34. {
  35. {
  36. "help",
  37. "Dump this list or help for specific command",
  38. "help [<cmd>] - Dump help for command\n"
  39. " If no <cmd> is given, a list of all available commands is displayed\n"
  40. },
  41. {
  42. "atq",
  43. "Dump ATQ structures",
  44. "!atq <addr> - Dump ATQ_CONTEXT at <addr>\n"
  45. "!atq -p <addr> - Dump ATQ_ENDPOINT at <addr>\n"
  46. "!atq -g - Dump atq globals\n"
  47. "!atq -c[0|1|2|3][0|1] - Dump atq client list at verbosity [n]\n"
  48. " Verbosity Levels\n"
  49. " 0x - Traverse list, print number on list, confirm signatures\n"
  50. " 1x - Active Only\n"
  51. " 2x - All Atq contexts\n"
  52. " x0 - Print one line summary of Atq Context\n"
  53. " x1 - Print full Atq context\n"
  54. "!atq -e[0|1|2|3][0|1] <endpoint-addr> - \n"
  55. " Dump atq client list at verbosity for given endpoint\n"
  56. "!atq -l - Dump atq Endpoint list\n"
  57. },
  58. {
  59. "asp",
  60. "Dump ASP structures",
  61. "!asp -g - Dump ASP globals\n"
  62. "!asp -tl - Show items in template cache\n"
  63. "!asp [-v#] -e <addr> - Dump information about script engine\n"
  64. "!asp [-v#] -h <addr> - Dump CHitObj at <addr>\n"
  65. "!asp [-v#] -t <addr> - Dump CTemplate at <addr>\n"
  66. "!asp [-v#] -tf <addr> - Dump CTemplate::CFileMap at <addr>\n"
  67. "!asp [-v#] -s <addr> - Dump CSession at <addr>\n"
  68. "!asp [-v#] -a <addr> - Dump CAppln at <addr>\n"
  69. "!asp [-v#] -o <addr> - Dump CComponentObject at <addr>\n"
  70. "!asp -l <addr> - VERY BRIEF Display of Object Collection at <addr>\n"
  71. "\n"
  72. "Some options can be prefixed with \"-v\" for more verbosity. Example:\n"
  73. " !inetdbg.asp -v -t <addr>\n"
  74. "\n"
  75. "An integer between 0 and 2 may follow the \"-v\" flag.\n"
  76. " \"-v0\" is equivalent to no \"-v\" option specified.\n"
  77. " \"-v1\" is equivalent to plain \"-v\"\n"
  78. " \"-v2\" specifies yet even more verbosity. (provides everything)\n"
  79. "\n"
  80. "Example:\n"
  81. " !inetdbg.asp -v2 -o <addr>\n"
  82. "\n"
  83. "Pointers are displayed in hex. Everything else is decimal unless prefixed with \"0x\".\n"
  84. },
  85. {
  86. "sched",
  87. "Dump scheduler structures",
  88. "!sched <addr> - Dump Scheduler Item at <addr>\n"
  89. "!sched -S <addr> - Dump CSchedData at <addr>\n"
  90. "!sched -T <addr> - Dump CThreadData at <addr>\n"
  91. "!sched -s[0|1|2] - Dump global list of schedulers at verbosity [n]\n"
  92. "!sched -l[0|1] - Dump Scheduler Item list at verbosity [n]\n"
  93. },
  94. {
  95. "acache",
  96. "Dump allocation cache structures",
  97. "!acache <addr> - Dump Allocation Cache Handler at <addr>\n"
  98. "!acache -g - Dump Allocation Cache global information\n"
  99. "!acache -l[0|1] - Dump Allocation Cache list at verbosity [v]\n"
  100. },
  101. {
  102. "ds",
  103. "Dump stack with symbols",
  104. "!ds [-v] <addr> - Dump symbols on stack\n"
  105. " -v == print valid symbols only\n"
  106. " default addr == current stack pointer\n"
  107. },
  108. {
  109. "ref",
  110. "Dump reference trace log",
  111. "!ref <addr> [<context>...] - Dump reference trace log at <addr>\n"
  112. },
  113. {
  114. "rref",
  115. "Dump reference trace log in reverse order",
  116. "!rref <addr> [<context>...] - Same as ref, except dumps backwards\n"
  117. },
  118. {
  119. "resetref",
  120. "Reset reference trace log",
  121. "!resetref <addr> - Reset reference trace log at <addr>\n"
  122. },
  123. {
  124. "st",
  125. "Dump string trace log",
  126. "!st [-l[0|1]] <addr> - Dump string trace log at <addr>\n"
  127. },
  128. {
  129. "rst",
  130. "Dump string trace log in reverse order",
  131. "!rst [-l[0|1]] <addr> - Same as st, except dumps backwards\n"
  132. },
  133. {
  134. "resetst",
  135. "Reset string trace log",
  136. "!resetst <addr> - Reset string trace log at <addr>\n"
  137. },
  138. {
  139. "wstats",
  140. "Dump W3 server statistics",
  141. "!wstats [<addr>] - Dump w3svc:W3_SERVER_STATISTICS at <addr>\n"
  142. },
  143. {
  144. "cc",
  145. "Dump W3 CLIENT_CONN structures",
  146. "!cc <addr> - Dump w3svc:CLIENT_CONN at <addr>\n"
  147. "!cc -l[0|1] - Dump w3svc:CLIENT_CONN list at verbosity [v]\n"
  148. },
  149. {
  150. "hreq",
  151. "Dump W3 HTTP_REQUEST structures",
  152. "!hreq <addr> - Dump w3svc:HTTP_REQUEST object at <addr>\n"
  153. "!hreq -l[0|1] - Dump HTTP_REQUEST list at verbosity [n]\n"
  154. },
  155. {
  156. "wreq",
  157. "Dump W3 WAM_REQUEST structures",
  158. "!wreq <addr> - Dump w3svc:WAM_REQUEST object at <addr>\n"
  159. "!wreq -l[0|1] - Dump WAM_REQUEST list at verbosity [n]\n"
  160. },
  161. {
  162. "wxin",
  163. "Dump WAM_EXEC_INFO structures",
  164. "!wxin <addr> - Dump wam:WAM_EXEC_INFO object at <addr>\n"
  165. "!wxin -l[0|1] <WAM addr> - Dump WAM's list of WAM_EXEC_INFOs at verbosity [n]\n"
  166. },
  167. {
  168. "rpcoop",
  169. "Find process/thread ID buried in RPC parameters",
  170. "!rpcoop <addr> - given RPC param finds the process id for OOP\n"
  171. " Verbosity Levels [v]\n"
  172. " 0 - Print one line summary\n"
  173. " 1 - Print level 1 information\n"
  174. " 2 - Print level 2 information\n"
  175. },
  176. {
  177. "fcache",
  178. "Dump IIS file cache structures",
  179. "!fcache [options] - Dump entire File Cache\n"
  180. " -b == dump bin lists\n"
  181. " -m == dump mru list\n"
  182. " -v == verbose\n"
  183. "!fcache <addr> - Dump File Cache entry at <addr>\n"
  184. },
  185. {
  186. "lkrhash",
  187. "Dump LKRhash table structures",
  188. "!lkrhash [options] <addr> - Dump LKRhash table at <addr>\n"
  189. " -l[0-2] == verbosity level\n"
  190. " -v == very verbose\n"
  191. " -g[0-2] == dump global list of LKRhashes at verbosity level\n"
  192. },
  193. {
  194. "open",
  195. "Dump TS_OPEN_FILE_INFO structures",
  196. "!open <addr> - Dump TS_OPEN_FILE_INFO @ <addr>\n"
  197. },
  198. {
  199. "uri",
  200. "Dump W3_URI_INFO structures",
  201. "!uri <addr> - Dump W3_URI_INFO @ <addr>\n"
  202. },
  203. {
  204. "phys",
  205. "Dump PHYS_OPEN_FILE_INFO structures",
  206. "!phys <addr> - Dump PHYS_OPEN_FILE_INFO @ <addr>\n"
  207. },
  208. {
  209. "oplock",
  210. "Dump OPLOCK_OBJECT structures",
  211. "!oplock <addr> - Dump OPLOCK_OBJECT @ <addr>\n"
  212. },
  213. {
  214. "blob",
  215. "Dump BLOB_HEADER structures",
  216. "!blob <addr> - Dump BLOB_HEADER @ <addr>\n"
  217. },
  218. {
  219. "mod",
  220. "Dump module info",
  221. "!mod [<addr>] - Dump module info\n"
  222. " If <addr> is specified, only module containing <addr> is dumped\n"
  223. },
  224. {
  225. "ver",
  226. "Dump module version resources",
  227. "!ver [<module>] - Dump version resource for specified module\n"
  228. " <module> may be either a module base address or name\n"
  229. " If no <module> is specified, then all modules are dumped\n"
  230. },
  231. {
  232. "heapfind",
  233. "Find heap block by size or address",
  234. "!heapfind -a<addr> - Find heap block containing <addr>\n"
  235. "!heapfind -s<size> - Find all heap blocks of length <size>\n"
  236. },
  237. {
  238. "heapstat",
  239. "Dump heap statistics",
  240. "!heapstat <min> - Dump heap statistics\n"
  241. " If <min> is present, then only those heap blocks with counts >= <min>\n"
  242. " are displayed. Note that *all* heap blocks are included in the totals,\n"
  243. " even if those blocks had counts too small to display.\n"
  244. " If <min> is not present, all heap blocks are displayed\n"
  245. },
  246. {
  247. "waminfo",
  248. "Dump WAM Dictator info",
  249. "!waminfo -g[0|1] - Dump WamDictator info\n"
  250. " 0 - Dump WamDictator info only\n"
  251. " 1 - Dump WamDictator's Dying List\n"
  252. "!waminfo -d <WamInfoAddr> - Dump WamInfo (InProc or OutProc)\n"
  253. "!waminfo -l <OOPListHeadAddr> - Dump WamInfoOutProc WamRequest OOP List\n"
  254. },
  255. {
  256. "spud",
  257. "Dump SPUD counters",
  258. "!spud - Dump SPUD counters\n"
  259. },
  260. {
  261. "gem",
  262. "Get current error mode",
  263. "!gem - Get current error mode\n"
  264. },
  265. {
  266. "exec",
  267. "Execute external command",
  268. "!exec [<cmd>] - Execute external command\n"
  269. " Default <cmd> is CMD.EXE\n"
  270. },
  271. {
  272. "llc",
  273. "Counts items on a standard linked-list",
  274. "!llc <list_head> - Counts the LIST_ENTRYs present on the specified list head\n"
  275. },
  276. {
  277. "dumpoff",
  278. "Dump structure/class information base on debug info in PDB",
  279. "!dumpoff <pdb_file>!<type_name>[.<member_name>] [expression]\n"
  280. "!dumpoff -s [<pdb_search_path>]\n\n"
  281. "pdb_file Un-qualified name of PDB file (eg. KERNEL32, NTDLL)\n"
  282. "type_name Name of type (struct/class) to dump, OR \n"
  283. " ==<cbHexSize> to dump struct/classes of size cbHexSize\n"
  284. "member_name (optional) Name of member in type_name to dump\n"
  285. "expression (optional) Address of memory to dump as type_name\n"
  286. " if not present, offset(s) are dumped\n"
  287. "pdb_search_path Set the search path for PDBs\n\n"
  288. "Examples: !dumpoff ntdll!_RTL_CRITICAL_SECTION 14d4d0\n"
  289. " !dumpoff w3svc!HTTP_REQUEST._dwSignature w3svc!g_GlobalObj\n"
  290. " !dumpoff ntdll!_RTL_CRITICAL_SECTION\n"
  291. " !dumpoff w3svc!==840\n"
  292. " !dumpoff -s \\\\mydrive\\pdbs;c:\\local\\pdbs\n"
  293. },
  294. {
  295. "vmstat",
  296. "Dump virtual memory statistics",
  297. "!vmstat - Dump virtual memory statistics"
  298. },
  299. {
  300. "vmmap",
  301. "Dump virtual memory map",
  302. "!vmmap - Dump virtual memory map"
  303. }
  304. #ifndef _NO_TRACING_
  305. ,{
  306. "trace",
  307. "Configure WMI Tracing",
  308. "!trace -o <LoggerName> <LoggerFileName> Toggle tracing active state\n"
  309. "!trace -d <Module_Name|all> 0|1 Set OutputDebugString generation state\n"
  310. "!trace -s [Module_Name] List module status\n"
  311. "!trace -a <Module_Name|all> <LoggerName> [Level] [Flags] Set active state of specified module\n"
  312. "!trace -f <Module_Name|all> <Flag> Set control flag for a specific module\n\n"
  313. "Notes: -o does not activate any modules, you must use the -a option for that\n"
  314. " -a can not notify WMI, this may cause odd results when using \"tracelog\"\n"
  315. " The level & flag are hexadecimal\n"
  316. }
  317. #endif
  318. };
  319. #define NUM_HELP_MAPS ( sizeof(HelpMaps) / sizeof(HelpMaps[0]) )
  320. PSTR
  321. FindHelpForCommand(
  322. IN PSTR CommandName
  323. )
  324. {
  325. PHELP_MAP helpMap;
  326. ULONG i;
  327. for( i = NUM_HELP_MAPS, helpMap = HelpMaps ; i > 0 ; i--, helpMap++ ) {
  328. if( _stricmp( helpMap->Command, CommandName ) == 0 ) {
  329. return helpMap->FullHelp;
  330. }
  331. }
  332. return NULL;
  333. } // FindHelpForCommand
  334. VOID
  335. PrintUsage(
  336. IN PSTR CommandName
  337. )
  338. {
  339. PSTR cmdHelp;
  340. PHELP_MAP helpMap;
  341. ULONG i;
  342. ULONG maxLength;
  343. ULONG length;
  344. dprintf( "IIS debugging extension for IIS Version 5.0\n" );
  345. if( CommandName == NULL ) {
  346. //
  347. // We'll display the one-liners for each command. Start by
  348. // scanning the commands to find the longest length. This makes the
  349. // output much prettier without having to manually tweak the
  350. // columns.
  351. //
  352. maxLength = 0;
  353. for( i = NUM_HELP_MAPS, helpMap = HelpMaps ; i > 0 ; i--, helpMap++ ) {
  354. length = (ULONG)strlen( helpMap->Command );
  355. if( length > maxLength ) {
  356. maxLength = length;
  357. }
  358. }
  359. //
  360. // Now actually display the one-liners.
  361. //
  362. for( i = NUM_HELP_MAPS, helpMap = HelpMaps ; i > 0 ; i--, helpMap++ ) {
  363. dprintf(
  364. "!%-*s - %s\n",
  365. maxLength,
  366. helpMap->Command,
  367. helpMap->OneLiner
  368. );
  369. }
  370. } else {
  371. //
  372. // Find a specific command and display the full help.
  373. //
  374. cmdHelp = FindHelpForCommand( CommandName );
  375. if( cmdHelp == NULL ) {
  376. dprintf( "unrecognized command %s\n", CommandName );
  377. } else {
  378. dprintf( "%s", cmdHelp );
  379. }
  380. }
  381. } // PrintUsage()
  382. DECLARE_API( help )
  383. {
  384. INIT_API();
  385. //
  386. // Skip leading blanks.
  387. //
  388. while( *lpArgumentString == ' ' ||
  389. *lpArgumentString == '\t' ) {
  390. lpArgumentString++;
  391. }
  392. if( !strcmp( lpArgumentString, "?" ) ) {
  393. lpArgumentString = "help";
  394. }
  395. if( *lpArgumentString == '\0' ) {
  396. lpArgumentString = NULL;
  397. }
  398. PrintUsage( lpArgumentString );
  399. } // DECLARE_API( help )