Get StackTrace of all running threads

delphi package - automated exception handling
Post Reply
bogdan.giusca
Posts: 3
Joined: Fri Nov 20, 2015 2:55 pm

Get StackTrace of all running threads

Post by bogdan.giusca »

Hi. I'm trying to get the stack trace of all running threads. I have a list of TThreads and I'm trying to get the Stack Trace like this:

Code: Select all

madexcept.GetThreadStackTrace(oThread.Handle)
The problem is that I get only the correct Stack Trace of the thread running this code; for the rest of the threads in the application, I get an empty string.
bogdan.giusca
Posts: 3
Joined: Fri Nov 20, 2015 2:55 pm

Re: Get StackTrace of all running threads

Post by bogdan.giusca »

One more thing, I tried running madTraceProcess32.exe, but I get "No 32 bit process found, which uses madExcept".

I run the application in IIS (ISAPI), I suspect it might have something to do with that.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Get StackTrace of all running threads

Post by madshi »

The first parameter to GetThreadStackTrace is the thread ID, not the thread handle!

Have you tried running madTraceProcess with admin rights? It's possible that your OS blocks access to IIS because it's running as a system service. Running madTraceProcess may fix that problem, or not. Maybe you'd have to run madTraceProcess inside of a(n interactive) service, too, to get access, I'm not sure.
bogdan.giusca
Posts: 3
Joined: Fri Nov 20, 2015 2:55 pm

Re: Get StackTrace of all running threads

Post by bogdan.giusca »

Thanks, running as an admin solved it. :)
Post Reply