Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

getcalr.c File Reference

#include "ntrtlp.h"

Go to the source code of this file.

Functions

VOID RtlGetCallersAddress (OUT PVOID *CallersPc, OUT PVOID *CallersCallersPc)
USHORT RtlCaptureStackBackTrace (IN ULONG FramesToSkip, IN ULONG FramesToCapture, OUT PVOID *BackTrace, OUT PULONG BackTraceHash)


Function Documentation

USHORT RtlCaptureStackBackTrace IN ULONG  FramesToSkip,
IN ULONG  FramesToCapture,
OUT PVOID *  BackTrace,
OUT PULONG  BackTraceHash
 

Definition at line 171 of file mips/getcalr.c.

00177 { 00178 return 0; 00179 }

VOID RtlGetCallersAddress OUT PVOID *  CallersPc,
OUT PVOID *  CallersCallersPc
 

Definition at line 35 of file mips/getcalr.c.

References NULL, RtlLookupFunctionEntry(), RtlpGetStackLimits(), and RtlVirtualUnwind().

00042 : 00043 00044 This routine returns the address of the routine that called the routine 00045 that called this routine, and the routine that called the routine that 00046 called this routine. For example, if A called B called C which called 00047 this routine, the return addresses in A and B would be returned. 00048 00049 Arguments: 00050 00051 CallersPc - Supplies a pointer to a variable that receives the address 00052 of the caller of the caller of this routine (B). 00053 00054 CallersCallersPc - Supplies a pointer to a variable that receives the 00055 address of the caller of the caller of the caller of this routine 00056 (A). 00057 00058 Return Value: 00059 00060 None. 00061 00062 Note: 00063 00064 If either of the calling stack frames exceeds the limits of the stack, 00065 they are set to NULL. 00066 00067 --*/ 00068 00069 { 00070 00071 CONTEXT ContextRecord; 00072 ULONG EstablisherFrame; 00073 PRUNTIME_FUNCTION FunctionEntry; 00074 BOOLEAN InFunction; 00075 ULONG NextPc; 00076 ULONG HighLimit, LowLimit; 00077 00078 // 00079 // Assume the function table entries for the various routines cannot be 00080 // found or there are not four procedure activation records on the stack. 00081 // 00082 00083 *CallersPc = NULL; 00084 *CallersCallersPc = NULL; 00085 00086 // 00087 // Capture the current context. 00088 // 00089 00090 RtlCaptureContext(&ContextRecord); 00091 NextPc = (ULONG)ContextRecord.XIntRa; 00092 00093 // 00094 // Get the high and low limits of the current thread's stack. 00095 // 00096 00097 RtlpGetStackLimits(&LowLimit, &HighLimit); 00098 00099 // 00100 // Attempt to unwind to the caller of this routine (C). 00101 // 00102 00103 FunctionEntry = RtlLookupFunctionEntry(NextPc); 00104 if (FunctionEntry != NULL) { 00105 00106 // 00107 // A function entry was found for this routine. Virtually unwind 00108 // to the caller of this routine (C). 00109 // 00110 00111 NextPc = RtlVirtualUnwind(NextPc | 1, 00112 FunctionEntry, 00113 &ContextRecord, 00114 &InFunction, 00115 &EstablisherFrame, 00116 NULL); 00117 00118 // 00119 // Attempt to unwind to the caller of the caller of this routine (B). 00120 // 00121 00122 FunctionEntry = RtlLookupFunctionEntry(NextPc); 00123 if ((FunctionEntry != NULL) && ((ULONG)ContextRecord.XIntSp < HighLimit)) { 00124 00125 // 00126 // A function table entry was found for the caller of the caller 00127 // of this routine (B). Virtually unwind to the caller of the 00128 // caller of this routine (B). 00129 // 00130 00131 NextPc = RtlVirtualUnwind(NextPc | 1, 00132 FunctionEntry, 00133 &ContextRecord, 00134 &InFunction, 00135 &EstablisherFrame, 00136 NULL); 00137 00138 *CallersPc = (PVOID)NextPc; 00139 00140 // 00141 // Attempt to unwind to the caller of the caller of the caller 00142 // of the caller of this routine (A). 00143 // 00144 00145 FunctionEntry = RtlLookupFunctionEntry(NextPc); 00146 if ((FunctionEntry != NULL) && ((ULONG)ContextRecord.XIntSp < HighLimit)) { 00147 00148 // 00149 // A function table entry was found for the caller of the 00150 // caller of the caller of this routine (A). Virtually unwind 00151 // to the caller of the caller of the caller of this routine 00152 // (A). 00153 // 00154 00155 NextPc = RtlVirtualUnwind(NextPc | 1, 00156 FunctionEntry, 00157 &ContextRecord, 00158 &InFunction, 00159 &EstablisherFrame, 00160 NULL); 00161 00162 *CallersCallersPc = (PVOID)NextPc; 00163 } 00164 } 00165 } 00166 00167 return; 00168 }


Generated on Sat May 15 19:43:51 2004 for test by doxygen 1.3.7