|
-
May 2nd, 2011, 07:07 AM
#1
Compilee only runs under debugger
Hello there I need some clue, got a compiled x64 image but it does crash if run.
Interesting that it finishes successfully if run under debugger (WinDbg).
It indicates similar problem I had in past with 32bit app but can't remember yet what was the solution. The compilee uses no compression.
Any hints?
-
May 2nd, 2011, 07:19 AM
#2
Re: Compilee only runs under debugger
Hmmm maybe you have some sort of problems with the way you are allocating memory. Possibly you are allocating memory and not deleting it. Perhaps you are attempting to access memory outside of the memory area you allocated. The debugger is alot more accepting of errors, bad coding practice and memory exceptions, than usual.
HTH,
ahoodin
To keep the plot moving, that's why.

-
May 2nd, 2011, 07:25 AM
#3
Re: Compilee only runs under debugger
I don't have too much experience with WinDbg thus I don't know how stronly it protects application environment but letting run the same application compiled as x86 target it runs fine even standalone. So I think the problem is due 64bit image.
The problem is that I can't debug anything since as I wrote it runs fine under debugger. Thus I even can't see where it crashes.
-
May 2nd, 2011, 08:04 AM
#4
Re: Compilee only runs under debugger
It's also possible that you are expecting something to be initialized somewhere that doesn't. The debugger might either initialize it for you, or catch and recover from the problem. It's also possible that you are overrunning the bounds of an array. A lot of debuggers pad either side of a chunk of memory for debugging purposes, you might be running into that buffer and not knowing it. This is why unit tests (run outside the debugger) are so important.
-
May 2nd, 2011, 08:17 AM
#5
Re: Compilee only runs under debugger
 Originally Posted by Anakunda
The problem is that I can't debug anything since as I wrote it runs fine under debugger. Thus I even can't see where it crashes.
Could you please clarify that?
Do you run debug or release build under debugger?
Are you saying that the SAME build runs OK under debugger and fails when run by itself?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
May 2nd, 2011, 08:28 AM
#6
Re: Compilee only runs under debugger
 Originally Posted by VladimirF
Could you please clarify that?
Do you run debug or release build under debugger?
Are you saying that the SAME build runs OK under debugger and fails when run by itself?
I have tried to make both release and debug build. In both cases the image crashes outside debugger, in bothh cases it runs fine under it. The only difference is rls build invokes message about crash while debug build makes windows warning sound then stops without crash notify, thus optimizations as well as debug code are not on cause.
-
May 2nd, 2011, 09:28 AM
#7
Re: Compilee only runs under debugger
Two more questions:
1. Is your environment set up OK? I mean - could you build and run 64-bit "Hello World!" app outside of your debugger?
2. Is there any chance that your app specifically checks for debugger and calls its services?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
May 2nd, 2011, 09:55 AM
#8
Re: Compilee only runs under debugger
 Originally Posted by VladimirF
Two more questions:
1. Is your environment set up OK? I mean - could you build and run 64-bit "Hello World!" app outside of your debugger?
Yes, runs fine.
 Originally Posted by VladimirF
2. Is there any chance that your app specifically checks for debugger and calls its services?
I don't think so, it's an open source platform independent audio encoder.
Moreover I was doing an debug build earlier turning off all optimizations and it ran well outside debugger, trying to reproduce this build with same settings today generated an crashing image, so it must be something that happens in random.
-
May 2nd, 2011, 10:44 AM
#9
Re: Compilee only runs under debugger
Does your program create a log file? That's always invaluable when debugging programs like that.
-
May 2nd, 2011, 10:48 AM
#10
Re: Compilee only runs under debugger
Hmm I don't think so, but it atleast prints the startup banner (console), the crash happens exactly when starting conversion.
-
May 2nd, 2011, 04:52 PM
#11
Re: Compilee only runs under debugger
Try putting more logging, you have given us very little to go on.q
Questions I have:
Is your program threaded? POSIX, boost, or MS?
Have you even pinpointed the method that is crashing?
Could you post the code that is problematic?
When you switched to 64-bit, did you remember to switch linking dependancies?
Are you loading any libraries using dlopen (or whatever the win equivalent is)?
Do you ever place a pointer in anything other than a pointer primitive?
Are you mixing 32-bit and 64-bit libraries? Do any of their interfaces use pointers?
-
May 2nd, 2011, 05:11 PM
#12
Re: Compilee only runs under debugger
 Originally Posted by Anakunda
Hmm I don't think so, but it atleast prints the startup banner (console), the crash happens exactly when starting conversion.
If you're using Visual Studio, try creating a dummy project, but have the Debugging option point to the executable you're trying to debug. See if the app now crashes while debugging.
If you are using Windows, better still if you actually created a crash dump for your program. There are ways to programatically create a crash dump by using the functions in DbgHelp.dll. There are articles here and elsewhere that discuss how to do this. Then all you need is to take the created dump file, load it as a project in Visual Studio, and run the dump file to identify where the crash occurs.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; May 2nd, 2011 at 05:15 PM.
-
May 2nd, 2011, 05:33 PM
#13
Re: Compilee only runs under debugger
 Originally Posted by ninja9578
Is your program threaded? POSIX, boost, or MS?
No, it's plain C
 Originally Posted by ninja9578
Have you even pinpointed the method that is crashing?
No I only guess which library might concern.
 Originally Posted by ninja9578
When you switched to 64-bit, did you remember to switch linking dependancies?
What dependencies do you mean? I have switched to 64bit versions of all libraries.
 Originally Posted by ninja9578
Are you loading any libraries using dlopen (or whatever the win equivalent is)?
Do you ever place a pointer in anything other than a pointer primitive?
Could you post the code that is problematic?
That's not my project I leave the source as is.
It doesnot use any 3rd party dlls except MSVC10 runtime and Intel Support DLL.
The source including binaries is uploaded here: http://www.mediafire.com/?b06qxs0uo1zlkn6
 Originally Posted by ninja9578
Are you mixing 32-bit and 64-bit libraries? Do any of their interfaces use pointers?
sure no, every lib I recompiled for x64
Unfortunatelly I don't use Visual Studio IDE, only MSVC libraries. This project is compiled by IntelC++.
-
May 2nd, 2011, 06:18 PM
#14
Re: Compilee only runs under debugger
Are MSVC libraries compatible with IntelC++? VC++ mangles function names in weird ways, it's not regular GCC naming. I've always adhered to the policy of not mixing compilers. If compiling with MSVC, use MSVC compiled libraries, if using MinGW, only use MinGW compiled libraries. What if you use IntelC++ to compile your libraries?
-
May 2nd, 2011, 06:27 PM
#15
Re: Compilee only runs under debugger
Yes Intel and MS libraries are mutually compatible.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|