debdump.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #include "priv.h"
  2. #include "resource.h"   // IDM_AB_* fir this!
  3. #include "hlframe.h"
  4. #include "basesb.h"
  5. #include "nsc.h"
  6. #include "nicotask.h"
  7. #ifdef DEBUG // {
  8. #define DM_FIXME    0       // trace/break when hit unknown guy
  9. struct DBClassInfo {
  10.     int     cbSize;
  11.     TCHAR * pszName;
  12. };
  13. //
  14. // EXTERNALOBJECTS is a macro which simply expands to X(C,0) X(D,1)
  15. // X(E, 2)...
  16. // where C, D, E, ... are classes whose sizes are defined externally.
  17. //
  18. #define EXTERNALOBJECTS 
  19.     X(CSDWindows, 0)  
  20. #define TABENT(c)   { SIZEOF(c), TEXT(#c) }
  21. #define X(c, n)  { 0, TEXT(#c) },
  22. struct DBClassInfo DBClassInfoTab[] =
  23. {
  24.     // BUGBUG tons of table entries missing
  25.     // maybe drive off same file as debug extensions dumpers?
  26.     TABENT(CBASEBROWSER),   // 0
  27.     TABENT(CIEFrameAuto),   // 1
  28.     TABENT(CNscTree),
  29.     TABENT(CNscIconTask),
  30.     #define NUM_INTERNAL_OBJECTS 4
  31.     EXTERNALOBJECTS // 5...
  32.     { 0 },
  33. };
  34. #undef  TABENT
  35. #undef  X
  36. #define X(c, n) extern "C" extern const int SIZEOF_##c;
  37. EXTERNALOBJECTS
  38. #undef X
  39. //***   DBGetClassSymbolic -- map size to class name (guess)
  40. // NOTES
  41. //  we just take the 1st hit, so if there are multiple classes w/ the
  42. //  same size you get the wrong answer.  if that turns out to be a pblm
  43. //  we can add special-case heuristics for the relevant classes.
  44. //
  45. //  BUGBUG TODO: should use a generic DWORD value/data pair lookup
  46. //  helper func.
  47. //
  48. TCHAR *DBGetClassSymbolic(int cbSize)
  49. {
  50.     struct DBClassInfo *p;
  51. #define X(c, n) 
  52.     DBClassInfoTab[NUM_INTERNAL_OBJECTS+n].cbSize = SIZEOF_##c;
  53.     EXTERNALOBJECTS
  54. #undef X
  55.     for (p = DBClassInfoTab; p->cbSize != 0; p++) {
  56.         if (p->cbSize == cbSize)
  57.             return p->pszName;
  58.     }
  59.     if (DM_FIXME) {
  60.         TraceMsg(DM_FIXME, "DBgcs: cbSize=%d  no entry", cbSize);
  61.         ASSERT(0);
  62.     }
  63.     return NULL;
  64. }
  65. #endif // }