StackTrace dependency on map file !!UPDATE!!

delphi package - automated exception handling
Post Reply
MikRod
Posts: 2
Joined: Wed Oct 24, 2018 6:46 pm

StackTrace dependency on map file !!UPDATE!!

Post by MikRod »

UPDATE:
I think I discovered the root cause of this. I have a "copy exe file to other directory" defined in my Post-build event. It seems that this copying that the compiler does occurs before madExcept is done patching the exe with its stuff. The exe file in the compiler output directory is larger than the file that ends up in the other directory. Using this larger exe file, madExcept works as expected.

If I'm right, the important lesson is that if you use madExcept, do NOT let the compiler do a post-build event.
M

Hi,
I have an XE4 32 bit application running on 64 bit OS. It runs several threads. On of the threads is a debugger thread that I can call from another application in order to get the current stacktrace . However, I get much less information out from GetThreadStackTrace if the application is running from a directory which does not contain the map file. I have enabled all the MadExcept linker options so I thought I would not need to distribute the map file in order to get full stack info. Also, if I compile the app with Delphi Compiler -> Linking -> Debug information set to True, then I get full info from GetThreadStackTrace. Below is an example comparing with and without map file/debug info. The map file and the debug info exe are quite large so I wonder if there is something I'm missing? I'm using madExcept 4.0.20.
Regards,
Michael

-----------------------------
No mapfile present and not compiled with debug info:

StackTrace for Main thread
03cafe94 +00 ???
75b9343b +10 kernel32.dll BaseThreadInitThunk

StackTrace for DebugInfoWriter
00988cb6 +00 QSoft401.exe
75b9343b +10 kernel32.dll BaseThreadInitThunk

-----------------------------
with mapfile present OR compiled with debug info:


StackTrace for Main thread
0335fe94 +000 ???
75d839b9 +00e USER32.dll WaitMessage
006b837d +149 QSoft401.exe Vcl.Forms TApplication.Idle
006b759b +017 QSoft401.exe Vcl.Forms TApplication.HandleMessage
006b78c9 +0c9 QSoft401.exe Vcl.Forms TApplication.Run
00c8b022 +05a QSoft401.exe QSoft401 114 +7 initialization
75b9343b +010 kernel32.dll BaseThreadInitThunk

StackTrace for DebugInfoWriter
00988cb6 +be QSoft401.exe UMrThreads 231 +11 GetStackTraceForAllCurrentThreads
004a825a +ba QSoft401.exe madExcept GetThreadStackTrace
00988cb1 +b9 QSoft401.exe UMrThreads 231 +11 GetStackTraceForAllCurrentThreads
009897fd +8d QSoft401.exe UMrThreads 438 +12 EnableRemoteDebugThread
0053fb16 +42 QSoft401.exe System.Classes ThreadProc
0040b034 +28 QSoft401.exe System 248 +0 ThreadWrapper
75b9343b +10 kernel32.dll BaseThreadInitThunk


..
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: StackTrace dependency on map file !!UPDATE!!

Post by madshi »

Sorry for the late reply!

You can still make the post-build event work by manually calling "madExceptPatch.exe" on the copied file. It's a command line tool, see "madExcept\Tools" folder.
MikRod
Posts: 2
Joined: Wed Oct 24, 2018 6:46 pm

Re: StackTrace dependency on map file !!UPDATE!!

Post by MikRod »

Yes! Thanks! I did not think of that.
Regards,
Michael
Post Reply