MSVC++ 5.0: How to debug MSVCRTD.DLL ? 
Author Message
 MSVC++ 5.0: How to debug MSVCRTD.DLL ?

Hello,

Occasionaly, I'd like to debug (step into (F11)) standard C runtime
routines like open(), write(), stdio package, etc., that are part of
MSCVRTD.{LIB|DLL} and their sources are located in ".../VC/crt/src".

Having spent one day on this, I've found out that it's possible only
for static versions of runtime library, not DLL:

  Project Settings -> C/C++ -> Code Generation -> Use runtime library
  -> Debug Single-Threaded / Debug Multithreaded

As long as "Debug Multithreaded DLL" is used (MSCVRTD.DLL), step-in
(F11) doesn't work for runtime routines. Apparently because of the
following message in "Debug" window during the de{*filter*} startup:

  "Loaded 'C:\WINNT\system32\MSVCRTD.DLL', no matching symbolic
   information found."

Okay, this DLL doesn't really contain any symbolic information, but I
wonder as to why the de{*filter*} doesn't load them from
"C:\WINNT\system32\MSVCRTD.PDB", where they actually are.

While searching for solution at DejaNews, I noticed many articles from
other people and their debug output contained "Loaded symbols for
....\WIN*\MSVCRTD.DLL". So I wonder, why it doesn't work on my system
(I
tried this also on colleague's box).

Here are details regarding above mentioned files on my system:

  Name           Version    Folder               Size  Modified
  ---------------------------------------------------------------------
  Msvcrtd.dll    5.00.7128  C:\WINNT\system32   368KB  1997/10/24 13:28
  Msvcrtd.pdb    NA         C:\WINNT\system32  2492KB  1997/01/22 20:43

I have even tried to touch *.pdb to make its modification time more
recent than on *.dll thinking de{*filter*} would change its mind and load
*.pdb eventually, but no luck.

Well, I could use static CRT library for debugging, but I link my apps
with my own static library, that is built to use dynamic CRT so it
would yield in multiple definitions of various CRT symbols when
linking. Of course, I can build my library with static CRT too, but
resulting exe would be unnecessarily too large.

I have read various articles on debugging DLLs both in MSVC online
books and MS KBase, but couldn't find an answer. I noticed only the
following excerpt in MS Knowledge Base (January 1999):

" Title: "INFO: Visual C++ 5.0 Readme, MFC and Other Libraries"
"
" [...]
"  - You can use the Visual C++ 5.0 de{*filter*} to debug into the MFC or
"    CRT DLLs.
" [...]

Hmm, this sounds like it should work, but I don't know how.

Here's a simple example for anyone who wants to try it out. Let's take
routine `getch()` (btw, not suitable for `WaitFor...()`, because it
swallows down key release events):

---8<---
#include <conio.h>
void main(int argc,char *argv[])
{
    int ch = getch();

Quote:
}

---8<---

Creat new console app project with this source file and select Debug
configuration and then Project Settings -> C/C++ -> Code Generation ->
Use runtime library -> Debug Multithreaded DLL.

Then build this project and try to step into `getch()` with F11. In my
case, it just waits until key is pressed in console output screen (i.e.
"[run]" in MSVC window title).

Is there any way to debug MSVCRTD.DLL ?

I'm using MSVC++ 5.0, Win NT 4.0 WKS (SP3).

Thanks very much for any suggestions/comments in advance.

Radek Tomis



Wed, 18 Jul 2001 03:00:00 GMT  
 MSVC++ 5.0: How to debug MSVCRTD.DLL ?
Hello Radek,

you have to install the source code for the runtime library
from the Visual C-CD to debug into to runtime code (for
example in "<INSTALLDIR>\crt\src".

Sincerely,

Radek Tomis schrieb in Nachricht

Quote:
>Hello,

>Occasionaly, I'd like to debug (step into (F11)) standard C
runtime
>routines like open(), write(), stdio package, etc., that
are part of
>MSCVRTD.{LIB|DLL} and their sources are located in

".../VC/crt/src".


Wed, 18 Jul 2001 03:00:00 GMT  
 MSVC++ 5.0: How to debug MSVCRTD.DLL ?

Quote:

> you have to install the source code for the runtime library
> from the Visual C-CD to debug into to runtime code (for
> example in "<INSTALLDIR>\crt\src".

Frank, maybe I wasn't quite clear in my previous post, but I have CRT
sources installed ("C:\Program Files\DevStudio\VC\crt\src").

Anyway, thanks for responding.

Quote:
> Radek Tomis schrieb in Nachricht

> >Hello,

> >Occasionaly, I'd like to debug (step into (F11)) standard C
> >runtime routines like open(), write(), stdio package, etc., that
> >are part of MSCVRTD.{LIB|DLL} and their sources are located in
> ".../VC/crt/src".

--
Radek Tomis



Fri, 20 Jul 2001 03:00:00 GMT  
 MSVC++ 5.0: How to debug MSVCRTD.DLL ?
Two possibilities come to mind:

1) The msvcrtd.pdb file that you have does not match your version of
msvcrtd.dll. This more commonly happens with the release version,
since many applications install an updated msvcrt.dll but don't install
an updated .pdb file :-( Given that MS distributes map files for
some of their DLLs that don't match (different link times) who knows
how it happened. Try checking the original install disk or service pack
and manually grab both files from the same location.

Dumpbin will give you the link time stamp for the .dll file, but I don't
know how to get it from the .pdb file - anyone?

2) The msvcrtd.pdb file is the correct one, but is a version that VC++
does not understand. This happens if you install VC++ 6.0 and then
try using VC++ 5.0 - 5.0 can't understand 6.0's debug info. I'm
constantly copying versions of mfc42*.* and msvcrt*.* around
depending on what version I'm using.

If the problem was missing source you would get different behaviour -
the de{*filter*} would tell you that symbols were loaded, and would
prompt you for source files when you stepped in.

BTW - one solution is to build your own copy from the provided
source.

Quote:


> > you have to install the source code for the runtime library
> > from the Visual C-CD to debug into to runtime code (for
> > example in "<INSTALLDIR>\crt\src".

> Frank, maybe I wasn't quite clear in my previous post, but I have CRT
> sources installed ("C:\Program Files\DevStudio\VC\crt\src").

> Anyway, thanks for responding.

> > Radek Tomis schrieb in Nachricht

> > >Hello,

> > >Occasionaly, I'd like to debug (step into (F11)) standard C
> > >runtime routines like open(), write(), stdio package, etc., that
> > >are part of MSCVRTD.{LIB|DLL} and their sources are located in
> > ".../VC/crt/src".

> --
> Radek Tomis


--
.Bruce Dawson, Cavedog Entertainment.
Makers of Total Annihilation - http://www.*-*-*.com/


Fri, 20 Jul 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Mfc42d.dll Mfco42d.dll and Msvcrtd.dll

2. Linking a DLL created with MSVC 5.0 into Delphi 2.0

3. DLL, linking msvc++ dll in borland

4. DLL workspace creation under MSVC++ 5.0 - question

5. MSVC 5.0 and OLEAUT32.DLL ?

6. Using MSVC 5.0 and MSVC 6.0 On One Machine

7. msvc++ 5.0 compiler optimization problem

8. MSVC++ 5.0/Direct X 5.0?

9. VC 5.0 Remote debugging a DLL

10. Error #-108 debugging ISAPI DLL in VC++ 5.0

11. Upgraded From VC 5.0 to 6.0 - MDI App Calling USER DLL - ASSERT in Debug

12. DLL debug problem with delete operation in VC 5.0

 

 
Powered by phpBB® Forum Software