StackTrace() doesn't work in Win64?
-
- Posts: 3
- Joined: Wed Apr 16, 2014 2:48 pm
StackTrace() doesn't work in Win64?
Hi,
When i call StackTrace() in my Win64 application, i get:
00000000 ???
When i recompile the application in Win32 mode i get a normal strack trace (as a string).
What am i doing wrong? Should madExcept work under Win64?
- Gerben Abbink
When i call StackTrace() in my Win64 application, i get:
00000000 ???
When i recompile the application in Win32 mode i get a normal strack trace (as a string).
What am i doing wrong? Should madExcept work under Win64?
- Gerben Abbink
Re: StackTrace() doesn't work in Win64?
It seems that the APIs madExcept is using only properly work for crashes. You could work around the issue by doing this:
Not very nice, but it should work.
Code: Select all
try
raise Exception.Create("dummy");
except
strVar := GetCrashStackTrace();
end;
-
- Posts: 3
- Joined: Wed Apr 16, 2014 2:48 pm
Re: StackTrace() doesn't work in Win64?
Hi,
No, that doesn't work either.
Still only question marks.
No, that doesn't work either.
Still only question marks.
Re: StackTrace() doesn't work in Win64?
Just tried this with XE5 in Windows 8.1 x64:
Works just fine here. Also tried this:
Surprisingly this works just fine, too. Some time ago this didn't work, which is why I suggested to raise a dummy exception. Not sure why it didn't work when I last tested it. Maybe it depends on the OS.
Is madExcept fully enabled for your project? Which Delphi version and which madExcept version are you using?
Code: Select all
uses madExcept;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
raise Exception.Create('dummy');
except
MessageBox(0, PWideChar(GetCrashStackTrace()), 'stack trace', 0);
end;
end;
Code: Select all
uses madExcept;
procedure TForm1.Button1Click(Sender: TObject);
begin
MessageBox(0, PWideChar(GetThreadStackTrace()), 'stack trace', 0);
end;
Is madExcept fully enabled for your project? Which Delphi version and which madExcept version are you using?
-
- Posts: 3
- Joined: Wed Apr 16, 2014 2:48 pm
Re: StackTrace() doesn't work in Win64?
I have made a very small demo (see attachment) with just a button and this code:
MessageBox(0, PWideChar(GetThreadStackTrace()), 'stack trace', 0);
I see no stack trace in Win64. I also tried:
try
raise Exception.Create('');
except
MessageBox(0, PWideChar(GetThreadStackTrace()), 'stack trace', 0);
end;
also, no stack trace. I does work in Win32.
Is use version MadExcept 4.0.9, Delphi XE5 on Windows 7 64-bit. I compile against MadExcept's source code that i bought.
MessageBox(0, PWideChar(GetThreadStackTrace()), 'stack trace', 0);
I see no stack trace in Win64. I also tried:
try
raise Exception.Create('');
except
MessageBox(0, PWideChar(GetThreadStackTrace()), 'stack trace', 0);
end;
also, no stack trace. I does work in Win32.
Is use version MadExcept 4.0.9, Delphi XE5 on Windows 7 64-bit. I compile against MadExcept's source code that i bought.
- Attachments
-
- MadExcept64.rar
- (57.92 KiB) Downloaded 250 times
Re: StackTrace() doesn't work in Win64?
Sorry for the delay in replying.
That's strange, today GetThreadStackTrace() doesn't seem to work for me, either. When writing my last reply, it did work. But anyway, the reason why your sample project doesn't work is that you used GetThreadStackTrace() in that try..except block. My suggestion was to use GetCrashStackTrace() in the try..except block, and that does work for you in your sample project, too. It makes no sense to raise a dummy exception if you're not going to use GetCrashStackTrace() instead of GetThreadStackTrace().
That's strange, today GetThreadStackTrace() doesn't seem to work for me, either. When writing my last reply, it did work. But anyway, the reason why your sample project doesn't work is that you used GetThreadStackTrace() in that try..except block. My suggestion was to use GetCrashStackTrace() in the try..except block, and that does work for you in your sample project, too. It makes no sense to raise a dummy exception if you're not going to use GetCrashStackTrace() instead of GetThreadStackTrace().