Discussion:
Debugging C++ (Atl) code with Visual Studio 2005
(too old to reply)
w***@gmail.com
2006-01-18 23:10:21 UTC
Permalink
Hi,

I have a strange issue with debugging a C++ (atl) .dll using VS 2005.
The .dll was built in debug mode (using VS6) and I have the .pdb file.
I am able to get the VS 2005 debugger to break at the breakpoint and I
can step through the code. The issue is that I cannot view any of the
variables in the watch - It comes up with "Error symbol not found".
From this file if I step into code that is a straight c .dll I see all
the variables just fine.

I thought it was an issue with symbols so I did set up the symbol
location to be "http://msdl.microsoft.com/download/symbols" but this
did not help.

Any one else got any ideas? Any help would be appreciated.


Wade.
Oleg Starodumov
2006-01-19 06:59:25 UTC
Permalink
Post by w***@gmail.com
I have a strange issue with debugging a C++ (atl) .dll using VS 2005.
The .dll was built in debug mode (using VS6) and I have the .pdb file.
I am able to get the VS 2005 debugger to break at the breakpoint and I
can step through the code. The issue is that I cannot view any of the
variables in the watch - It comes up with "Error symbol not found".
Please tell which of the following options were used when building the DLL in VC6
(including the flags passed to some of the linker options listed here):
Compiler: /Zd or /Z7 or /Zi or /ZI
Linker: /debug, /debugtype, /pdb, /pdbtype

In addition, if /pdbtype:sept option was passed to the linker, try to change
it to /pdbtype:con, rebuild the DLL and test debugging in VS2005 to see
if symbols become visible.

Regards,
Oleg
[VC++ MVP http://www.debuginfo.com/]
w***@gmail.com
2006-01-19 19:55:15 UTC
Permalink
Oleg,

For a little more background...

The problem machine is Windows 2003 test Server. I got into this mess
originally because I thought the easiest way to debug the problem would
be to install the VS2005 Remote Debugging on the server and debug the
problem remotely from my development machine - which has both VS 6 & VS
2005.

Here are my VC6 build settings

Linker Options: /nologo /subsystem:windows /dll /incremental:yes
/pdb:"Debug/a4wcomsv.pdb" /map:"Debug/a4wcomsv.map" /debug
/machine:I386 /def:".\a4wcomsv.def" /out:"Debug/a4wcomsv.dll"
/implib:"Debug/a4wcomsv.lib" /pdbtype:sept

Compiler Options: /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_ATL_DEBUG_QI"
/D "_DEBUG" /D "_MERGE_PROXYSTUB" /D "WIN32" /D "_WINDOWS" /D "_USRDLL"
/D ACCPAC_EDITION=$(ACCPAC_EDITION) /FR"Debug/" /Fp"Debug/a4wcomsv.pch"
/Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /c

I tried building with your suggested setting of /pdbtype:con - but my
project failed to build with the error:

zlibd.lib(inffast.obj) : fatal error LNK1202:
"C:\dev54\A4WCOMSV\Debug\vc60.pdb" is missing debugging information for
referencing module

zlibd is one of our own modules - and I should look into resolving this
issue - but I am running out of time so I decided to install VC6 on the
Windows 2003 Server. Then I started experiencing the same issue. When
debugging VC 6 was asking for the vc60.pdb file. I had seen this before
and usually I just hit cancel. Once I finally copied the vc60.pdb file
to the problem machine debugging worked perfectly in VC6. Tried once
again with VS2005 with remote debugging and still got the same results.


Do I have to force VC2005 to use this same vc60.pdb file? How does one
do this?

Thanks,

Wade.
WadeC
2006-01-19 22:13:46 UTC
Permalink
Further update.

Tested debugging locally. VS 2005 still has the same problem. Tried it
with 2003 and everything seems fine.

So the problem seems to be with VS 2005. I am running the full release
version and not the beta.

Microsoft Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework Version 2.0.50727
Installed Edition: Professional

Wade.
Oleg Starodumov
2006-01-20 08:20:35 UTC
Permalink
Post by w***@gmail.com
Compiler Options: /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_ATL_DEBUG_QI"
/D "_DEBUG" /D "_MERGE_PROXYSTUB" /D "WIN32" /D "_WINDOWS" /D "_USRDLL"
/D ACCPAC_EDITION=$(ACCPAC_EDITION) /FR"Debug/" /Fp"Debug/a4wcomsv.pch"
/Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /c
I would also recommend to change /ZI to /Zi.
Post by w***@gmail.com
I tried building with your suggested setting of /pdbtype:con - but my
"C:\dev54\A4WCOMSV\Debug\vc60.pdb" is missing debugging information for
referencing module
The problem is that zlibd.lib is probably compiled with /Zi or ZI and therefore
produces and references its own vc60.pdb, which cannot be found by the linker.
If you want to fix the error reported by the linker, compile zlibd.lib with /Z7 option
(it will put debug information into the library itself, not into a separate .PDB file).
Post by w***@gmail.com
zlibd is one of our own modules - and I should look into resolving this
issue - but I am running out of time so I decided to install VC6 on the
Windows 2003 Server. Then I started experiencing the same issue. When
debugging VC 6 was asking for the vc60.pdb file. I had seen this before
and usually I just hit cancel. Once I finally copied the vc60.pdb file
to the problem machine debugging worked perfectly in VC6.
This is because if you link with /pdbtype:sept, vc60.pdb accumulates the type
information for the application's symbols. If vc60.pdb is not available,
the debugger cannot determine the types of variables.
Post by w***@gmail.com
Do I have to force VC2005 to use this same vc60.pdb file? How does one
do this?
I am not sure that VS2005 can use this file at all (I haven't tested it yet,
but will do later today).
Post by w***@gmail.com
Tested debugging locally. VS 2005 still has the same problem. Tried it
with 2003 and everything seems fine.
So the problem seems to be with VS 2005. I am running the full release
version and not the beta.
My suggestion is to change the compiler options of zlibd.lib (from /Zi/I
to /Z7), recompile it, and then rebuild the main DLL with /pdbtype:con
linker option.

Oleg
WadeC
2006-01-20 18:50:58 UTC
Permalink
Oleg,

Thanks so much... Changing the compiler settings of zlibd.lib and
relinking with /pdbtype:con seems to fixed the issue ...

Wade.

Loading...