#1 How run application with built in unit-test code?

open
nobody
None
5
2008-12-11
2008-12-11
Kuling
No

Hello...

I'm trying to use cfix for following scenario.
I have large project (Visual Studio 2005, c++). There are 1 executable file "xxx.exe" and near 100 dlls.

Every project contains some cfix unit test code. I wanted to build this code into debug and release versions of executables and dlls during night-build.

OK... code is built into dlls and executable. I can run cfix32.exe recursivelly on all dlls from program directory. I'm happy about that. :) So far everything works correctly. So far so good.

But... when I try run "xxx.exe" executable from Visual Studio (regardless of release or debug version) I got message box "The procedure entry point SymInitializeW could not be located in the dynamic link library dbghelp.dll".

In the "Output window" I can see:
...
'xxx.exe': Loaded 'D:\Program Files\cfix\bin\i386\cfix.dll', Symbols loaded.
'xxx.exe': Loaded 'C:\WINDOWS\system32\dbghelp.dll', Symbols loaded (source information stripped).
Debugger:: An unhandled non-continuable exception was thrown during process load

I've read this article http://www.codeproject.com/KB/cpp/BackPatch.aspx and then I tried to check what version od dbghelp.dll do I have.
dbghelp.dll in cfix directory is 6.8.4.0
dbghelp.dll in c:\windows\system32 directory is 5.1.2600.5512

I've also installed on my machine dbg_x86_6.10.3.233.msi (dbghelp.dll 6.10.3.233) in "C:\Program Files\Debugging Tools for Windows (x86)" but it did not interfere (in my opinion) with process of starting executable under debugger.

During my tries with forcing "xxx.exe" to start I tried to copy whole content of cfix\bin\i386 directory to directory of my program. But this just led to crash a bit later. Now cfix.dll and dbghelp could be loaded:

'xxx.exe': Loaded 'E:\xxx\Release\cfix.dll', Symbols loaded.
'xxx.exe': Loaded 'E:\xxx\Release\dbghelp.dll', No symbols loaded.
...
...
...
'xxx.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', Symbols loaded (source information stripped).
'xxx.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.MFCLOC_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_91481303\mfc80ENU.dll', Binary was not built with debug information.
'xxx.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll', Symbols loaded (source information stripped).
'xxx.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll', Symbols loaded (source information stripped).
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c812aeb (kernel32.dll) in xxx.exe: 0x00000003: The system cannot find the path specified.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
... // ~30 times
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x77e3cb75 (advapi32.dll) in xxx.exe: 0xC00000FD: Stack overflow.
First-chance exception at 0x7c9100c8 (ntdll.dll) in xxx.exe: 0xC0000005: Access violation reading location 0x00000010.
First-chance exception at 0x77e3cb6b (advapi32.dll) in xxx.exe: 0xC0000005: Access violation writing location 0x00030ef4.
Unhandled exception at 0x77e3cb6b (advapi32.dll) in xxx.exe: 0xC0000005: Access violation writing location 0x00030ef4.

Do you have idea what requirement application must fulfill to have unit-test code attached and be able to run as normal application?

Discussion

  • Kuling,

    I am sorry -- for some reason, I completely missed this post. Does the problem still persist or did you already find a solution for it? It seems that copying dbghelp.dll from the cfix bin directory to xxx.exe's directory should be sufficient to have xxx.exe load the correct version of dbghelp.dll. Did you try that? Also, have you been able to capture the stack trace at the point the stack overflow occured?

    Either way, I will consider making dbghelp.dll a delayload or loading it dynamically -- that should avoid such problems in the future.

    Thanks,
    JP

     
  • Hi...

    At first thank you for fixing following bug. :)
    [ 2414193 ] Crash during scanning unsupported dll

    And in the matter of this ticket...
    I don't have any good news for you.
    I didn't find any solution for this problem. Due to limited amount of time which I could spent on this problem I've just gave up. And to be frank I've waited also for fix 2414193.

    If have additional time then I'll try investigate problem again. But I can not give promise.