Discussion:
Debugging unmanaged dll in .net
(too old to reply)
atlasgp
2007-03-27 23:02:16 UTC
Permalink
In VS2005, I have enabled debugging of native code in a project which
includes a COM dll written in VC6. I see the symbols load for that dll in
the output window and I'm able to step through the unmanaged coded. My
problem is that most of the variables cannot be seen in the watch window ( it
says that symbol "variable" is not found ). In my scenario I'm passing a
SAFEARRAY as a paramater in a method in COM dll. I can't see the value of
this parameter. Locally in the method I set a CString variable with the
items in the safe array. I cannot access that variable in the watch window.
The only variables that show in the watch window are variables of type int.
Has anyone seen this and point me in the right direction?
Oleg Starodumov
2007-03-28 07:10:23 UTC
Permalink
Post by atlasgp
In VS2005, I have enabled debugging of native code in a project which
includes a COM dll written in VC6. I see the symbols load for that dll in
the output window and I'm able to step through the unmanaged coded. My
problem is that most of the variables cannot be seen in the watch window ( it
says that symbol "variable" is not found ). In my scenario I'm passing a
SAFEARRAY as a paramater in a method in COM dll. I can't see the value of
this parameter. Locally in the method I set a CString variable with the
items in the safe array. I cannot access that variable in the watch window.
The only variables that show in the watch window are variables of type int.
Has anyone seen this and point me in the right direction?
Try to use the following compiler and linker options when building the VC6 dll:

Compiler: /Zi (and optionally /Od to disable optimizations if you are working with release buld)
Linker: /debug /debugtype:cv /pdb:yourdll.pdb /pdbtype:con (and /opt:ref if this is a release build)

All these options can be found in Project Settings, lookup an option in VC6 help
to find the corresponding setting, if necessary.

If you are debugging this dll on a machine other than the one where the dll was built,
copy the pdb file together with the dll.
--
Oleg
[VC++ MVP http://www.debuginfo.com/]
atlasgp
2007-03-29 15:44:05 UTC
Permalink
Thxs for the heads up. In the linker, the /debug flag was already set. The
/debugtype:cv was not set, but this is the default flag when there is no
/debugtype set. The /pdbtype was set to sept. I removed this since default
is /pdbtype:con. In the compiler all the settings where set as specified
with a diference in the /Zi option. It was set to /ZI ( program database and
edit ). I switched it to /Zi but I have a feeling this could have stayed the
same.

Recompiled and it worked like a charm. Thanks alot.
Post by Oleg Starodumov
Post by atlasgp
In VS2005, I have enabled debugging of native code in a project which
includes a COM dll written in VC6. I see the symbols load for that dll in
the output window and I'm able to step through the unmanaged coded. My
problem is that most of the variables cannot be seen in the watch window ( it
says that symbol "variable" is not found ). In my scenario I'm passing a
SAFEARRAY as a paramater in a method in COM dll. I can't see the value of
this parameter. Locally in the method I set a CString variable with the
items in the safe array. I cannot access that variable in the watch window.
The only variables that show in the watch window are variables of type int.
Has anyone seen this and point me in the right direction?
Compiler: /Zi (and optionally /Od to disable optimizations if you are working with release buld)
Linker: /debug /debugtype:cv /pdb:yourdll.pdb /pdbtype:con (and /opt:ref if this is a release build)
All these options can be found in Project Settings, lookup an option in VC6 help
to find the corresponding setting, if necessary.
If you are debugging this dll on a machine other than the one where the dll was built,
copy the pdb file together with the dll.
--
Oleg
[VC++ MVP http://www.debuginfo.com/]
unknown
2007-07-01 16:07:16 UTC
Permalink
Does it mean it does not make a difference with the compiler ser to /ZI or
/Zi option. Also what really eliminated the problem. Was it the change from
/pdbtype:sept to /pdbtype:con. What is the real explanation for these changes.
Kindly let me know.

Hello atlasgp,
Post by atlasgp
Thxs for the heads up. In the linker, the /debug flag was already
set. The /debugtype:cv was not set, but this is the default flag when
there is no /debugtype set. The /pdbtype was set to sept. I removed
this since default is /pdbtype:con. In the compiler all the settings
where set as specified with a diference in the /Zi option. It was set
to /ZI ( program database and edit ). I switched it to /Zi but I have
a feeling this could have stayed the same.
Recompiled and it worked like a charm. Thanks alot.
Post by Oleg Starodumov
Post by atlasgp
In VS2005, I have enabled debugging of native code in a project
which includes a COM dll written in VC6. I see the symbols load for
that dll in the output window and I'm able to step through the
unmanaged coded. My problem is that most of the variables cannot be
seen in the watch window ( it says that symbol "variable" is not
found ). In my scenario I'm passing a SAFEARRAY as a paramater in a
method in COM dll. I can't see the value of this parameter.
Locally in the method I set a CString variable with the items in the
safe array. I cannot access that variable in the watch window. The
only variables that show in the watch window are variables of type
int. Has anyone seen this and point me in the right direction?
Compiler: /Zi (and optionally /Od to disable optimizations if you are
working with release buld) Linker: /debug /debugtype:cv
/pdb:yourdll.pdb /pdbtype:con (and /opt:ref if this is a release
build)
All these options can be found in Project Settings, lookup an option
in VC6 help to find the corresponding setting, if necessary.
If you are debugging this dll on a machine other than the one where
the dll was built, copy the pdb file together with the dll.
--
Oleg
[VC++ MVP http://www.debuginfo.com/]
Oleg Starodumov
2007-07-02 18:28:04 UTC
Permalink
The explanation is that /pdbtype:sept (that is, the possibility for a .pdb file
to refer to other .pdb files) has been removed in subsequent versions
of the linker (after VC6). Recent debuggers try to keep backward compatibility,
but not too hard.

Oleg
Does it mean it does not make a difference with the compiler ser to /ZI or /Zi option. Also what really eliminated the
problem. Was it the change from /pdbtype:sept to /pdbtype:con. What is the real explanation for these changes. Kindly
let me know.
Hello atlasgp,
Post by atlasgp
Thxs for the heads up. In the linker, the /debug flag was already
set. The /debugtype:cv was not set, but this is the default flag when
there is no /debugtype set. The /pdbtype was set to sept. I removed
this since default is /pdbtype:con. In the compiler all the settings
where set as specified with a diference in the /Zi option. It was set
to /ZI ( program database and edit ). I switched it to /Zi but I have
a feeling this could have stayed the same.
Recompiled and it worked like a charm. Thanks alot.
Post by Oleg Starodumov
Post by atlasgp
In VS2005, I have enabled debugging of native code in a project
which includes a COM dll written in VC6. I see the symbols load for
that dll in the output window and I'm able to step through the
unmanaged coded. My problem is that most of the variables cannot be
seen in the watch window ( it says that symbol "variable" is not
found ). In my scenario I'm passing a SAFEARRAY as a paramater in a
method in COM dll. I can't see the value of this parameter.
Locally in the method I set a CString variable with the items in the
safe array. I cannot access that variable in the watch window. The
only variables that show in the watch window are variables of type
int. Has anyone seen this and point me in the right direction?
Compiler: /Zi (and optionally /Od to disable optimizations if you are
working with release buld) Linker: /debug /debugtype:cv
/pdb:yourdll.pdb /pdbtype:con (and /opt:ref if this is a release
build)
All these options can be found in Project Settings, lookup an option
in VC6 help to find the corresponding setting, if necessary.
If you are debugging this dll on a machine other than the one where
the dll was built, copy the pdb file together with the dll.
--
Oleg
[VC++ MVP http://www.debuginfo.com/]
Loading...