Changeset 7326 for trunk/src/kernel32/thread.cpp
- Timestamp:
- Nov 13, 2001, 12:06:03 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/thread.cpp
r7318 r7326 1 /* $Id: thread.cpp,v 1.3 3 2001-11-10 12:47:48 sandervlExp $ */1 /* $Id: thread.cpp,v 1.34 2001-11-12 23:04:56 phaller Exp $ */ 2 2 3 3 /* … … 90 90 91 91 92 #define MAX_CALLSTACK_SIZE 128 93 void WIN32API dbg_ThreadPushCall(char *pszCaller) 94 { 95 #ifdef DEBUG 96 TEB *teb; 97 98 // embedded dbg_IncThreadCallDepth 99 teb = GetThreadTEB(); 100 if(teb == NULL) 101 return; 102 103 teb->o.odin.dbgCallDepth++; 104 105 // add caller name to call stack trace 106 int iIndex = teb->o.odin.dbgCallDepth; 107 108 // allocate callstack on demand 109 if (teb->o.odin.arrstrCallStack == NULL) 110 teb->o.odin.arrstrCallStack = (PVOID*)malloc( sizeof(LPSTR) * MAX_CALLSTACK_SIZE); 111 112 // insert entry 113 if (iIndex < MAX_CALLSTACK_SIZE) 114 teb->o.odin.arrstrCallStack[iIndex] = (PVOID)pszCaller; 115 #endif 116 } 117 118 92 119 void WIN32API dbg_DecThreadCallDepth() 93 120 { … … 99 126 --(teb->o.odin.dbgCallDepth); 100 127 #endif 128 } 129 130 131 void WIN32API dbg_ThreadPopCall() 132 { 133 #ifdef DEBUG 134 TEB *teb; 135 136 // embedded dbg_DecThreadCallDepth 137 teb = GetThreadTEB(); 138 if(teb == NULL) 139 return; 140 141 --(teb->o.odin.dbgCallDepth); 142 143 // add caller name to call stack trace 144 int iIndex = teb->o.odin.dbgCallDepth; 145 146 // insert entry 147 if (teb->o.odin.arrstrCallStack) 148 if (iIndex < MAX_CALLSTACK_SIZE) 149 teb->o.odin.arrstrCallStack[iIndex] = NULL; 150 #endif 151 } 152 153 char* WIN32API dbg_GetLastCallerName() 154 { 155 // retrieve last caller name from stack 156 TEB *teb; 157 158 // embedded dbg_DecThreadCallDepth 159 teb = GetThreadTEB(); 160 if(teb != NULL) 161 { 162 int iIndex = teb->o.odin.dbgCallDepth - 1; 163 if ( (iIndex > 0) && 164 (iIndex < MAX_CALLSTACK_SIZE) ) 165 { 166 return (char*)teb->o.odin.arrstrCallStack[iIndex]; 167 } 168 } 169 170 return NULL; 101 171 } 102 172
Note:
See TracChangeset
for help on using the changeset viewer.