Leaked source code of windows server 2003
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.

101 lines
4.1 KiB

  1. Platinum CDB Extension Library:
  2. General Usage:
  3. -include ptdbgext.h and link with ptdbgext.lib
  4. -define structure using macros described below
  5. -define globals ExtensionNames, Extensions, and g_pExtensionInitRoutine
  6. -Use DEFINE_EXPORTED_FUNCTIONS do define exported functions
  7. -Export "dump" and "help" from your dll using the def file
  8. -Copy extension dll to a directory in your path
  9. -Start CDB and attach to process
  10. -Type "!<dll name>.help" for help
  11. Demo files:
  12. - extdemex directory contains sample application to debug
  13. - extdemdl directory contains sample CDB extension dll
  14. Demo Usage:
  15. - Attach to process using "cdb /p <pid>"
  16. - Type "!extdemdl.help"... you'll see the following
  17. Demo CDB debugger extensions
  18. help -- This command
  19. dump <Struct Type Name>@<address expr>
  20. - Type "dd extdemex!g_pMyClass l 1"... you'll see something like the following:
  21. 00402190 00313240
  22. - Using the 2nd number, type "!extdemdl.dump CMyClass@0x00313240":
  23. 0:001> !extdemdl.dump CMyClass@0x00313240
  24. ++++++++++++++++ CMyClass@313240 ++++++++++++++++
  25. <... dump deleted>
  26. m_MyStruct @0x00313248
  27. <... dump deleted>
  28. ---------------- CMyClass@313240 ----------------
  29. - Use the m_MyStruct field to dump the embeded structure
  30. by typing "!extdemdl.dump MY_STRUCT@0x00313248"
  31. ++++++++++++++++ MY_STRUCT@313248 ++++++++++++++++
  32. m_cbName 26
  33. m_szName This is a MY_STRUCT struct
  34. ---------------- MY_STRUCT@313248 ----------------
  35. ** Macro usage from _dbgdump.h
  36. // Usage:
  37. // Create a head file that includes this file and defines your field
  38. // descriptors using only the following macros:
  39. //
  40. // BIT MASKS:
  41. // BEGIN_BIT_MASK_DESCRIPTOR(BitMaskName) -
  42. // start bit mask descriptor
  43. // BIT_MASK_VALUE(Value) -
  44. // Give a defined value for a bit mask. Uses #Value
  45. // to describe the value. If your bitmask values are
  46. // defined using #defines... then only the numerical
  47. // values will appear in the dump... use BIT_MASK_VALUE2
  48. // instead.
  49. // BIT_MASK_VALUE2(Value, Description) -
  50. // Give a value and description for a bit mask.
  51. // END_BIT_MASK_DESCRIPTOR
  52. // Mark the end of a bit mask descriptor
  53. //
  54. // ENUMS:
  55. // BEGIN_ENUM_DESCRIPTOR(BitMaskName) -
  56. // start enum descriptor
  57. // ENUM_VALUE(Value) -
  58. // Give a defined value for a enum. Uses #Value
  59. // to describe the value.
  60. // ENUM_VALUE2(Value, Description) -
  61. // Give a value and description for a enum.
  62. // END__DESCRIPTOR -
  63. // Mark the end of a enum descriptor
  64. //
  65. // STRUCTURES & CLASSES:
  66. // BEGIN_FIELD_DESCRIPTOR(FieldDescriptorName) -
  67. // start field decscritor
  68. // FIELD3(FieldType, StructureName, FieldName) -
  69. // define non-enum public field
  70. // FIELD4(FieldType, StructureName, FieldName, AuxInfo) -
  71. // define enum public field
  72. // For FIELD4, you should pass one of the following to
  73. // to define the aux info:
  74. // GET_ENUM_DESCRIPTOR(x)
  75. // GET_BITMASK_DESCRIPTOR(x)
  76. // Where x is one of the values used to define a bit mask
  77. // or enum.
  78. //
  79. // END_FIELD_DESCRIPTOR -
  80. // Define end of field descriptors for class/struct
  81. //
  82. // GLOBALS: - Used to tell ptdbgext what class/structures to dump
  83. // BEGIN_STRUCT_DESCRIPTOR -
  84. // Marks the begining of the global stuct descriptor
  85. // STRUCT(TypeName,FieldDescriptor) -
  86. // Defines a struct to dump. TypeName is the name of the
  87. // type, and FieldDescriptor is a name given in a
  88. // BEGIN_FIELD_DESCRIPTOR.
  89. //
  90. // NOTE: You must define bit masks & enums before classes and structures.
  91. // You must also define the global STRUCT_DESCRIPTOR last.