jirentabu / crashrpt

Automatically exported from code.google.com/p/crashrpt
0 stars 0 forks source link

Packed programs that use TLS #68

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have packed my program with PeCmpact and the problem is when program is 
packed and it crashes the crashrpt cant point me where in source that crash 
was. It works fine when program is not packed.
I`ve try to pack the CrashRptTest program and when its packed it works fine. 
CrashRpt even then can point me where the crash in source code was. 

So I try to pack my progrma with UPX and it couldn because my program use TLS. 
Meaby here is problem? Why CrashRpt has problem when program uses TLS? I use 
for threads boost project.

I used the 1.2.3 version on XP.

Original issue reported on code.google.com by tajemnic...@gmail.com on 31 Oct 2010 at 9:57

GoogleCodeExporter commented 9 years ago
1. Try the following and tell if this works for you:

In order to read the minidump, you need to save a local copy of the 
uncompressed EXE (DLL) file and a PDB file generated for that EXE (DLL). You 
also need to have the source code that you used when building the EXE (DLL). 
These should be enough to read the minidump generated by the compressed version 
of your EXE. 

2. Do you use TLS protocol for transferring data over the Internet? Than how 
can it be the reason? I don't know.

Original comment by zexspect...@gmail.com on 31 Oct 2010 at 11:47

GoogleCodeExporter commented 9 years ago
TLS in this case may mean Thread Local Storage.

Original comment by gmacaus...@gmail.com on 4 Nov 2010 at 6:01

GoogleCodeExporter commented 9 years ago
Yes TLS in this case may mean Thread Local Storage.

I used the new 1.2.7 version and when the exe is not packed it works great. 
When I pack it with PeCompact the dump dont show me nothing. I got alle 
sources, and I tried on uncompressed EXE and on compressed EXE but either the 
dump show me nothing.

Whats the problem?

Original comment by tajemnic...@gmail.com on 8 Nov 2010 at 11:59

GoogleCodeExporter commented 9 years ago
It would help if I see if PDB files were loaded for modules of your 
application. Please attach a screenshot of your Modules window, and Call Stack 
window. For more information about these, follow here 
http://crashrpt.sourceforge.net/docs/html/using_minidump.html

Original comment by zexspect...@gmail.com on 8 Nov 2010 at 3:28

GoogleCodeExporter commented 9 years ago
I attach the screenshots.

Original comment by tajemnic...@gmail.com on 9 Nov 2010 at 7:45

Attachments:

GoogleCodeExporter commented 9 years ago
Why are there two call stacks and two Modules windows? 

Original comment by zexspect...@gmail.com on 9 Nov 2010 at 1:48

GoogleCodeExporter commented 9 years ago
Because this is a long list, I couldnt get It all in one screen shot. So the 
numer 1 is part1 of the for example modules and the numer 2 is part2 (rest of 
the list) od modules :)

Original comment by tajemnic...@gmail.com on 9 Nov 2010 at 2:37

GoogleCodeExporter commented 9 years ago
Ok, from modulewindow1.jpg I see that Agent****.exe has 'no matching binary 
found' status. I suppose Agent***.exe is the main module of your app, am I 
right? If yes, it should have 'Symbols loaded' status to be able to recover the 
stack trace.

It seems that your Visual Studio can't find the correct binary for your module. 
To help VS to find the matching binary, I recommend you to do the following:

1. Replace packed EXE file with original file on path 
R:\Projects\***\release\Agent***.exe. 

2. If the first step doesn't help, open Tools->Options->Debugging->Symbols and 
enter the path to the directory where your unpacked EXE and PDB files are 
located.

Then tell me if any of these work for you. If none works, please attach a 
screenshot of Modules window for each of these steps.

Original comment by zexspect...@gmail.com on 9 Nov 2010 at 3:15

GoogleCodeExporter commented 9 years ago
Yes Agent is my main module. 
When I dont pack Agent.exe and make a dump, and run it, I have symbols loaded 
and everything works fine.
When i make dump on packed Agent.exe the dump shows me symbols not loaded, 
exactly that the agent.exe wasnt compile with debug informations.
When in run dump on not packed Agent.exe then I have information No marching 
binary found.
On bouth steps the crashdump cant find maching binary file.

Meaby the crushdump make hash of the Agent.exe on dump and when I run it it 
tries to compare the hash. If the hashes arent equal then id displays that it 
cant find a matching binary file?

Original comment by tajemnic...@gmail.com on 15 Nov 2010 at 1:08

Attachments:

GoogleCodeExporter commented 9 years ago
I make dump on packed exe, that hasnt symbols.
I must run dump on unpacked exe to have the symbols but the binary isnt 
matching.
So meaby its the hash problem?

Original comment by tajemnic...@gmail.com on 15 Nov 2010 at 1:10

GoogleCodeExporter commented 9 years ago
I don't know how to help you then... It would help if I had PECompact, but I 
don't want to buy a license. Maybe you know any free packer that has the same 
behavior? Were you able to pack your program with UPX?

Original comment by zexspect...@gmail.com on 15 Nov 2010 at 3:47

GoogleCodeExporter commented 9 years ago
You can download a PEcompact trial version. You dont have to buy a license if 
you want to check some things :)
There is also a student version and its free.

Visit http://www.bitsum.com/pecompact.shtml

Original comment by tajemnic...@gmail.com on 15 Nov 2010 at 7:45

GoogleCodeExporter commented 9 years ago
Can you help me?

Original comment by tajemnic...@gmail.com on 23 Nov 2010 at 2:04

GoogleCodeExporter commented 9 years ago
I downloaded a trial version of PEcompact and tried the following:

1. Downloaded and compiled CrashRpt_v1.2.7_r997.
2. Packed CrashRptTest.exe with PECompact (note that I turned off debug info 
stripping in PECompact by using command line switch /StripDebug:No)
3. Ran CrashRptTest.exe and generated error report.
4. Opened crashdump.dmp in VS.
5. It worked!

Can you do such steps for your Agent application and tell me if this works for 
you?

Original comment by zexspect...@gmail.com on 25 Nov 2010 at 1:14

GoogleCodeExporter commented 9 years ago
I tried few months ago to do that with CrashRptTest.exe and PECompact and it 
worked, so I wonder why on my Agent application didnt? I didnt try the 
/StripDebug:No option, so I will try it tomorrow and let you know.

Original comment by tajemnic...@gmail.com on 25 Nov 2010 at 5:28

GoogleCodeExporter commented 9 years ago
NO, it doesnt work :( I turned most of the options even use just TRIM, but dont 
know why the dump doesnt show me the source code. All symbols are loaded on 
Agent.exe this time, but still dump doesnt show me the error code. What can I 
do?

Original comment by tajemnic...@gmail.com on 29 Nov 2010 at 8:44

GoogleCodeExporter commented 9 years ago
Can you attach a screenshot of your current Modules and Call Stack windows?

Original comment by zexspect...@gmail.com on 29 Nov 2010 at 2:22

GoogleCodeExporter commented 9 years ago
Yes please. The CallStack window is empty, dont know why.

Original comment by tajemnic...@gmail.com on 29 Nov 2010 at 4:59

Attachments:

GoogleCodeExporter commented 9 years ago
The Modules window looks ok. But the Call Stack window is bad. Maybe this is 
really because of TLS.

Can you provide a sample program that uses TLS? I would compile it myself and 
try to reproduce.

Original comment by zexspect...@gmail.com on 30 Nov 2010 at 12:54

GoogleCodeExporter commented 9 years ago
I use the Threads from boost. Meaby you can download boost and use some 
examples with its thread?

http://www.boost.org/

Original comment by tajemnic...@gmail.com on 30 Nov 2010 at 7:24

GoogleCodeExporter commented 9 years ago
I will try a sample from boost. 

Can you perform another test? Can you open the minidump in a VS 2010. For 
example, in VS 2010 Express. I found out that TLS was introduced since Windows 
Vista, so maybe the latest VS can read such minidumps? Can you try?

Original comment by zexspect...@gmail.com on 6 Dec 2010 at 4:25

GoogleCodeExporter commented 9 years ago
I wrote a test program that uses TLS. See the attached file TlsTest.zip.

What I did:
1. Compiled TlsTest.sln in Release configuration (I used CrashRpt 1.2.7 for 
compilation). This generated release\TlsTest.exe and \release\TlsTest.pdb files.
2. Copied CrashRpt.dll, CrashSender.exe and crashrpt_lang.ini files to \release 
folder.
3. Packed TlsTest.exe with PECompact tool (used /StripDebug:No switch)
4. Ran TlsTest.exe and generated error report.
5. Opened crash dump with VS Express 2010. 
6. It worked!

Can you try to do this yourself? 

Original comment by zexspect...@gmail.com on 7 Dec 2010 at 12:23

Attachments:

GoogleCodeExporter commented 9 years ago
I will try it tomorrow...

Original comment by tajemnic...@gmail.com on 7 Dec 2010 at 5:19

GoogleCodeExporter commented 9 years ago
Did you have a chance to try it? If so, I would close this issue.

Original comment by zexspect...@gmail.com on 5 Jan 2011 at 7:52

GoogleCodeExporter commented 9 years ago

Original comment by zexspect...@gmail.com on 6 Jan 2011 at 5:34

GoogleCodeExporter commented 9 years ago
Hi

Sorry but until now I didn`t had time to check it :(
But I checked it and you are right the problem is that I`m using VS 2005. 
When I used VS 2010 I could see the break line.

I`m very happy :) Thank you very much for your support!

Original comment by tajemnic...@gmail.com on 18 Apr 2011 at 1:28