procedure TForm1.Button1Click(Sender: TObject);
var
CallStack: TEurekaBaseStackList;
Suspended: Boolean;
begin
CallStack := EurekaCallStackClass.Create(nil);
try
CallStack.BuildForThread(YourThreadHandle, YourThreadId,
// Replace with your thread's handle and ID.
// Thread handle must have:
// THREAD_GET_CONTEXT, THREAD_QUERY_INFORMATION, and THREAD_SUSPEND_RESUME access rights
// DO NOT PASS GetCurrentThread and GetCurrentThreadId!!!
// There is also .BuildForThreadByID method, which does not require thread handle argument.
nil, // first addr
[ddUnit, ddProcedure, ddSourceCode], // CurrentEurekaLogOptions.csoDebugInfo
True, // get debug info?
False, // show begin calls?
TracerRawEurekaLogV7Mask, // CurrentEurekaLogOptions.csoAllowedRenderMethods
True, // running thread?
@Suspended); // will return True if thread was suspended before call stack is taken
Memo1.Lines.Assign(CallStack);
finally
FreeAndNil(CallStack);
end;
end;
1条答案
按热度按时间9o685dep1#
根据EurekaLog的文档How to... get background thread call stack?,
TEurekaCallStack
类有一个BuildForThread()
方法,您可以将线程句柄和线程ID传递到该方法,例如:同一页上还写着:
**重要说明:**请注意后台线程将继续运行。例如,其实际调用堆栈可能与您使用的调用堆栈不同。
您可能还对
EFreeze
单元中的RaiseFreezeException
例程感兴趣,该例程将为指定的单个线程创建报告。