Home |
RTKernel-32 Programming Manual Function RTKStackDump |
Function RTKStackDumpRTKStackDump can write a list of all currently active function calls of a thread to a string: void RTKStackDump(char * Buffer, unsigned BufferLen, RTKTaskHandle Handle); ParametersBufferPoints to the string to receive the list. BufferSizeSpecifies the size of the buffer. RTKStackDump will write no more than BufferSize characters to *Buffer. HandleHandle of the thread whose call stack is desired. The output buffer will contain a line for each return address found on the stack of the given thread. The return address is displayed as a hex string followed by a colon, the source file name, and the line number. If the function is unable to determine the source file associated with a return address (possibly because RTKLoadSymbols has not been called), '-' appears instead. Example (Code):RTKLoadSymbols("R:\\Myapp.tds"); RTKTaskHandle HandleA = RTKRTLCreateThread(ThreadA, 0, 0, 0, NULL, "Thread A"); ... char ListBuffer[1024]; RTKStackDump(ListBuffer, sizeof(ListBuffer), HandleA); puts(ListBuffer); ... Example (Output):4000F253: Csa.asm.82 4001E5A8: Valloc.c.127 4001E788: Valloc.c.231 4001E8BF: Valloc.c.328 4001897B: Heap.c.166 40018B53: Heap.c.272 4001EF79: Mapfile.c.90 4001FA22: Mapfile.c.573 400011E9: Fmapdemo.c.118 400149B2: Rtlthread.c.45 4002646F: - 40013AA5: Rtwin32.c.104 40010BAD: Rttm.imp.194 RTKStackDump determines the list of active function calls from the EBP stack frames of each function call. This requires that the compiler has actually generated such stack frames. With code optimization enabled, such stack frames are frequently not generated.
|