Call Stack Snaphots for Windows, AIX and IBM i.
SnapStack.cpp
SnapStack.h
Methods:
const char* GetContext()
const char* GetProgram()
const char* GetModule()
const char* GetFunction()
unsigned GetLineNumber()
Methods:
bool Snapshot()
bool Snapshot(EXCEPTION_POINTERS *SEHInfo)
on Windows only
int GetNumEntries()
void FreeEntry(InvocationEntry *Current)
InvocationEntry* GetFirstEntry()
InvocationEntry* GetLastEntry()
InvocationEntry* GetNextEntry(InvocationEntry *Current)
InvocationEntry* GetPrevEntry(InvocationEntry *Current)
Example:
#include <stdio.h>
#include <stdlib.h>
#include <SnapStack.h>
#include <LevelTrace.h>
void PrintStack(InvocationCallStack &Stack)
{
InvocationEntry *Current = Stack.GetFirstEntry();
while (Current)
{
if (*Current->GetFunction())
{
TPRINT(("%s (%s:%u)",
Current->GetFunction(),
Current->GetModule(),
Current->GetLineNumber()));
}
else {
TPRINT(("%s (%u)",Current->GetProgram(),
Current->GetLineNumber()));
}
Current = Stack.GetNextEntry(Current);
}
return;
}
void Test(InvocationCallStack &Stack)
{
Stack.Snapshot();
return;
}
main()
{
InvocationCallStack Stack;
Test(Stack);
PrintStack(Stack);
#ifdef __BORLANDC__
printf("Press <enter> to continue\n");
getc(stdin);
#endif
return 0;
}