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.

103 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. stktrace.cxx
  6. Abstract:
  7. KM Stack trace index.
  8. Author:
  9. Albert Ting (AlbertT) 26-Mar-99
  10. Revision History:
  11. --*/
  12. #include "precomp.hxx"
  13. #pragma hdrstop
  14. #ifdef STKTRACE_HACK
  15. DEBUG_EXT_HEAD( dbti )
  16. {
  17. DEBUG_EXT_SETUP_VARS();
  18. UINT i;
  19. UINT Index = TDebugExt::dwEval( lpArgumentString, FALSE );
  20. UINT_PTR p = EvalExpression("&ntoskrnl!RtlpStackTraceDataBase");
  21. UINT_PTR stdAddr;
  22. move(stdAddr, p);
  23. Print("RtlpStackTraceDataBase: %x\n", stdAddr);
  24. STACK_TRACE_DATABASE std;
  25. move(std, stdAddr);
  26. UINT_PTR cBuckets = std.NumberOfBuckets;
  27. PSTACK_TRACE_DATABASE pstdLarge;
  28. pstdLarge = (PSTACK_TRACE_DATABASE)LocalAlloc(LPTR,
  29. sizeof(STACK_TRACE_DATABASE) +
  30. sizeof(PVOID) * cBuckets);
  31. Print("Checking %x buckets\n", cBuckets);
  32. if (!pstdLarge)
  33. {
  34. Print("Failed to alloc %x buckets\n", cBuckets);
  35. }
  36. else
  37. {
  38. move2(pstdLarge, stdAddr, sizeof(STACK_TRACE_DATABASE) + sizeof(PVOID) * cBuckets);
  39. for (i=0; i < cBuckets; ++i)
  40. {
  41. //
  42. // Walk each hash chain.
  43. //
  44. RTL_STACK_TRACE_ENTRY ste;
  45. for (p = (UINT_PTR)pstdLarge->Buckets[i]; p; p = (UINT_PTR)ste.HashChain)
  46. {
  47. if (CheckControlCRtn())
  48. return;
  49. move(ste, p);
  50. if (ste.Index == Index)
  51. {
  52. break;
  53. }
  54. }
  55. if (p)
  56. {
  57. Print("Index %x found: ste = %x, BT = %x\n",
  58. Index,
  59. p,
  60. p + OFFSETOF(RTL_STACK_TRACE_ENTRY, BackTrace));
  61. break;
  62. }
  63. }
  64. }
  65. }
  66. #else
  67. DEBUG_EXT_HEAD( dbti )
  68. {
  69. DEBUG_EXT_SETUP_VARS();
  70. Print("Not enabled.\n");
  71. }
  72. #endif