Page 1 of 1

GetCrashStackTrace/GetThreadStacktrace do not work in x64

PostPosted: Sat Apr 14, 2018 6:56 pm
by car_hack89
Hello,

The functions "madExcept.GetCrashStackTrace()" and "madExcept.GetThreadStacktrace()" do not return the callstack, return empty string.

My application is 64 bits, written in Delphi and developed in XE7. I am using the MadExcep 4.0.19 (Single Developer Edition).

If the application generates it in 32 bits, the functions work correctly returning the callstack.

Thanks in advance.

Re: GetCrashStackTrace/GetThreadStacktrace do not work in x6

PostPosted: Tue Apr 17, 2018 2:41 pm
by madshi
Two questions:

1) GetCrashStackTrace() is only supposed to be called from within a try..except block. Is that how you've called it in x64?
2) Do you have madExcept fully enabled (in the "madExcept settings..." dialog) and compiled the EXE within the IDE?

GetThreadStacktrace() is problematic in x64, that's a known problem. I'm calling OS APIs in this case, and they don't seem to work well, for some reason I can't manage to figure out. You can workaround it by raising a dummy exception in a try..except block like this:

Code: Select all
try
  raise Exception.Create('dummy');
except
  currentThreadStackTrace := GetCrashStackTrace();
end;

Re: GetCrashStackTrace/GetThreadStacktrace do not work in x6

PostPosted: Tue Apr 17, 2018 6:27 pm
by car_hack89
Hello,

1) GetCrashStackTrace() is only supposed to be called from within a try..except block. Is that how you've called it in x64?


GetCrashStackTrace/GetThreadStacktrace uses them without try..except, and in both x86 and x64 the code is the same.

2) Do you have madExcept fully enabled (in the "madExcept settings..." dialog) and compiled the EXE within the IDE?


I have full enabled madExcept, and my application compiled it with the IDE.

And yes for the moment I solved it with a fictitious exception:

Code: Select all
try
    raise Exception.Create ('Some error message');
except on E: Exception do
    sCurrentStackTrace: = E.StackTrace;
end;


This solution is not optimal, so I asked if there was any way.

Re: GetCrashStackTrace/GetThreadStacktrace do not work in x6

PostPosted: Tue Apr 17, 2018 6:29 pm
by madshi
Not atm.