Microsoft KB Archive/241848

From BetaArchive Wiki
Knowledge Base


How to set up remote debugging quickly by using Visual C++ 5.0 or Visual C++ 6.0

Article ID: 241848

Article Last Modified on 9/29/2005



APPLIES TO

  • Microsoft Visual C++ 6.0 Standard Edition
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 5.0 Professional Edition
  • Microsoft Visual C++ 6.0 Professional Edition



This article was previously published under Q241848

SUMMARY

This article describes how to set up remote debugging quickly when you use Microsoft Visual C++ 5.0 or Microsoft Visual C++ 6.0 to debug applications on non-development computers.

MORE INFORMATION

Note In these steps, the target computer is the computer that does not have Visual C++ installed on it, and it is the computer that is usually called the "clean" computer. The host computer is the computer on which Visual C++ is installed where the debugging with the integrated development environment (IDE) occurs.

  1. Make sure that both computers can see each other on the network. This makes it easier than setting up a serial connection between the two and makes the remote debugging much faster.
  2. On the target computer, create a share so that the host computer can access it. For example, it debug on the host like such as \\server\share\somedll.dll.
  3. Copy the following files to the target computer share created or the system folder. On a computer that is running Microsoft Windows 95, Microsoft Windows 98, Microsoft Windows NT 4.0, or Microsoft Windows 2000, the remote debug monitor consists of the following files:
    • Msvcmon.exe
    • Msvcrt.dll
    • Tln0t.dll
    • Dm.dll
    • Msvcp6o.dll
    • Msdis110.dll

    Note In Windows NT, the remote debugger also requires the Psapi.dll file. The files are located in the following folders:

    File Copy from location
    Msvcmon.exe \Common\Msdev98\Bin
    Tln0t.dll \Common\Msdev98\Bin
    Dm.dll \Common\Msdev98\Bin
    Msdis110.dll \Common\Msdev98\Bin
    Msvcrt.dll %SYSTEMROOT%\System(32)
    Msvcp60.dll %SYSTEMROOT%\System(32) (Msvcp50.dll for VC++ 5.0)
    Psapi.dll %SYSTEMROOT%\System32 (Do not copy this file to Windows 95-based computer or Windows 98-based computers.)
    Note If the Msvcrt.dll file is on the host computer and is an earlier version than the version of the Msvcrt.dll file that is on the target computer, do not copy the Msvcrt.dll file to the target. If the Msvcrt.dll file is copied to the target, restart the target computer because the Msvcrt.dll file is a known DLL.
  4. Copy your DLLs and .exe files to the share. Be sure to copy any third-party information that you may need. Also copy any dependent DLLs such as Mfc42d.dll and Msvcrtd.dll to the share. Also, make sure all that all COM DLL and .exe files being used by your program are registered on the target.
  5. Copy the .pdb files to the share. This includes all of the .pdb files in the debug or release folders for the project on the host computer. If you do not have any .pdb files because you are doing release builds, you can add debug info to the release project. To do this, follow these steps:
    1. On the Project menu, click Settings.
    2. Click the C/C++ tab.
    3. Click Category, and then click General.
    4. Change Debug info from None to Program Database.
    5. Click the Link tab.
    6. Click Category, and then click General.
    7. Click to select the Generate Debug Info check box.
    8. Rebuild and run.
  6. On the host computer, the one with the source code, change the debug target in the Remote executable path and file name box in the Project Settings Debug tab to reflect the DLL/EXE that is to be debugged.

    For example: \\server\share\somedll.dll
  7. In the Visual C++ IDE, click Debugger Remote Connection on the Build menu select . Change it from Local to Remote. Click Settings, and then change the Target machine name or address. You can also give an IP address instead.
  8. Set breakpoints in the source code that you want to debug. Do this before you start the remote monitor.
  9. On the target computer, run Msvcmon.exe. This has to be running before you try to connect. Click Settings, and then change the Target machine name or address to the host computer name. You can also give an IP address instead. Always be sure that the target has this running before wondering why the debugger is not working.

You are ready to debug now. On the host computer, click Start Debug on the Build menu, and then click Go.

REFERENCES

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

131058 Descriptions of tips for remote debugging with Visual C++ versions 2.x, 4.0, 5.0, and 6.0


Search for "Debugging Remote Applications" in the Visual C++ Programmer's Guide.

Keywords: kbhowto kbbug kbdebug KB241848