Getting the trace of a specific thread

delphi package - automated exception handling
Post Reply
Bassrat
Posts: 6
Joined: Mon Aug 16, 2004 9:21 pm

Getting the trace of a specific thread

Post by Bassrat »

I've got a monitor thread on a server that watchs for and kills hung threads or threads hogging a resource. Before killing the thread I would like to capture just the misbehaved thread's call stack to a log but do not see a way to do that with CreateBugReport or StackTrace. Would also like to use CreateBugReport without having to raise a bogus exception for it. Anyway to do this without deviating from your released code? I try to not touch vendor source as much as much as possible to make upgrades and support easier.

Thanks,
--Greg
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You can use CreateBugReport without raising a bogus exception. Just tell it that your program was frozen (= first parameter -> true). Then it will create a full bug report for you with the callstack of all running threads. Of course this may take longer than just calculating a callstack for that one specific thread, though.
Bassrat
Posts: 6
Joined: Mon Aug 16, 2004 9:21 pm

Post by Bassrat »

Thanks for the tip on not needing to raise an exception. A nice way to get just a specific stack would still be nice. Perhaps in 2.8 ;-)
--Greg
Post Reply