64-bit insider volume 1 issue 10

Upload: nayeemkhan

Post on 08-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 64-Bit Insider Volume 1 Issue 10

    1/5

    64-bit Insider NewsletterVolume 1, Issue 10

    Page 1/5

    64-bit InsiderVolume I, Issue 10

    Remotely Debugging anUnmanaged

    Application in Windows 64-bit

    Remote debugging has been around for quite some time;however, it is during this 64-bit era that remotedebugging will become an indispensable tool for the 64-

    bit developer. In a 64-bit development environment, noteveryone will have exclusive use of an Intel EM64Tserver or an Itanium server. More likely, manydevelopers will have to share a 64-bit server to completedebugging tasks. Fortunately, this does not mean thatevery developer will have to have a remote desktopconnection to the server or that everyone will be runningMicrosoft Visual Studio to debug applications.Furthermore, in some 64-bit servers, such as the Itanium,remote debugging is the only way to debug code fromMicrosoft Visual Studio 2005.

    The 64-bit Advantage

    The computer industry ischanging, and 64-bit technologyis the next, inevitable step. The64-bit Insider newsletter will help

    you adopt this technology by providing tips and tricks for asuccessful port.

    Development and migration of 64-bit technology is not ascomplicated as the 16-bit to 32-bittransition. However, as with anynew technology, several areas dorequire close examination andconsideration. The goal of the 64-bit Insider newsletter is to identifypotential migration issues andprovide viable, effective solutionsto these issues. With a plethora of Web sites already focused on 64-bit technology, the intention of this newsletter is not to repeatpreviously published information.Instead, it will focus on 64-bit

    issues that are somewhat isolatedyet extremely important tounderstand. It will also connectyou to reports and findings from64-bit experts.

  • 8/6/2019 64-Bit Insider Volume 1 Issue 10

    2/5

    64-bit Insider NewsletterVolume 1, Issue 10

    Page 2/5

    Using Remote Debugging To understand how remote debugging works, we must first understand how the regulardebugging cycle is completed. Figure 1 presents a simplified version of an applicationsdevelopment process.

    Figure 1 High-level representation of the application development process

    When planning the development of 64-bit application, you might assume that it would beideal to complete all development tasks on a 64-bit server, such as the Itanium or theIntel EM64T. But this is not always the case.

    For example, consider a situation in which the next-generationof your organizations line of business application is going torun on an Itanium 2 server. Writing code on the Itanium serverand using Visual Studio 2005 is not possible because thedevelopmental suite is not compatible with the Itaniumarchitecture. While the specifics as to why this is the case arebeyond the scope of this article, generally, it has to do with thefact that Itanium 2 computers are high-end servers and notmeant to be used as development computers. But rest assured,there are several options that you can use to write code for theItanium 2 server and debug the code, beyond using thePlatform Software Development Kit (PSDK) and a WindowsDebugger (WinDbg), both of which are two excellent tools.

    Visual Studio 2005 is packed with a plethora of great new features. And one of the mostvaluable features gives you the ability to remotely debug an application on a Windows 64-bit computer from any remote 32-bit Windows system. If you are currentlydebugging 64-bit code in Visual Studio that is running on an EM64T, you are alreadyusing remote debugging. The only way that a 32-bit application like Visual Studio caninteract at the debug level with a 64-binary is out-of-process; remember that 32-bit codeand 64-bit code cannot exist within the same process space. Even though you did nothave to set anything in your integrated development environment, Visual Studio makesall the necessary changes so that you are remotely debugging without even knowing it.

    Visual Studio 2005 is packed with a plethora

    of great new features. And one of the most valuable is the abilityto remotely debug an

    application onWindows 64-bit from

    any 32-bit computer.

    Write/PortCode

    DebugCode

    ReleaseProduct

    Fix Bugs

  • 8/6/2019 64-Bit Insider Volume 1 Issue 10

    3/5

    64-bit Insider NewsletterVolume 1, Issue 10

    Page 3/5

    Understanding Remote Debugging Remote debugging is a great way (and in some cases, the only way) to debug your 64-bitcode. For example, remote debugging provides the capabilities you need to overcome thechallenges encountered in Itanium 2 development (introduced above). First, you can

    write the code in Visual Studio on a 32-bit workstation. Then, to debug your application,you can use the remote debugging server on the 64-bit computer in conjunction with theremote debugger in Visual Studio. Your 64-bit server will now allow many developers toconnect concurrently to debug their applications unless you are doing kernel modedebugging, in which case you would not want anyone else working in the system.

    Setting up Remote DebuggingFollow these steps to set up your remote debugging environment.

    1. Install the 64-bit Debugging Tools on the 64-bit server. To access the installationfiles, navigate to the Remote Debugger folder (under the vs folder) on the VisualStudio installation DVD. You will need administrative privileges to complete this

    task. Installation is easy and will place all the necessary files in your computer sothat it can work as a remote server.

    Note If you have installed Microsoft SQL Server 2005 on your 64-bit server,then the Remote Debugger is probably already installed. Debugging SQL Server2005 will be covered in a future issue of the 64-bit Insider newsletter.

    2. Start the remote debugger in the 64-bit server by navigating to Start > Programs> Microsoft Visual Studio 2005 > Visual Studio Tools > Visual Studio 2005Remote Debugger (either Itanium or x64, depending on your architecture).

    3. Set up special permissions in the Visual Studio Remote Debugging Monitor by

    creating several user accounts with debugging permissions granted.4. Select Tools > Options from the Remote Debugger Monitor . From the dialog

    box that opens, specify which users will be allowed to connect to your serverremotely. While the example in Figure 3 shows No Authentication , for securityreasons, you should never select this option in your server. For more informationabout how to create the necessary accounts with the correct debuggingpermissions, please visit:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtskinstallingdcom.asp

    Configuring the Remote Debugging Client

    After you have finished setting up the remote debugger, you are ready to configure thedebugging clients so that they can access the server. Follow these steps to configure theremote debugging client.

    1. Open project properties, access the Debugging node, and then select Remote Windows Debugger from the list. Figure 2 shows the dialog box, filled out withinformation for a sample C++ application that needs to be debugged.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtskinstallingdcom.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtskinstallingdcom.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtskinstallingdcom.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtskinstallingdcom.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtskinstallingdcom.asp
  • 8/6/2019 64-Bit Insider Volume 1 Issue 10

    4/5

    64-bit Insider NewsletterVolume 1, Issue 10

    Page 4/5

    Figure 2 Remote Windows Debugger settings

    2. Fill out the following fields: Remote Command refers to the path of the executable on the remote server

    where the application to debug resides. You only need to copy the binary. Thedebugging symbols are not required on the server, but are required on theclient computer.

    Command Arguments contains the parameters you wish to send to theapplication, if any.

    Working Directory refers to the project folder path, which is the default one if you leave this option blank.

    Remote Server Name is the name of the server; this can also be the IP address. Connection refers to the authentication type used when connecting to the

    server. The example does not use authentication. Debugger Type refers to the type of debugging you would like to use. You can

    use the default in most cases. Attach determines whether to attach to a running process on the 64-bit server. SQL debugging refers to whether you are going to be doing any SQL Server

    debugging.3. Press F5 on your project to start debugging.

    From this point on, you should be able to follow the same debugging procedure youwould otherwise follow if you were debugging a 32-bit application. For example, settingup breakpoints and stepping in and out of methods havent changed. However , someprocesses will look slightly different. For example, while debugging select Debug >Windows > Registers from the Visual Studio menu. You will see that your registers are64-bit in size. (See Figure 3.)

  • 8/6/2019 64-Bit Insider Volume 1 Issue 10

    5/5

    64-bit Insider NewsletterVolume 1, Issue 10

    Page 5/5

    Figure 3 Registers are 64-bit in size.

    Summary Remote Debugging is very similar to the usual debugging techniques used in previousversions of Visual Studio. The main differences are found when setting up and runningthe remote debugging server, and when configuring your project properties bothactivities have been addressed in this issue of the 64-bit Insider newsletter.

    Remote debugging is not always required when building 64-bit applications, but it ishelpful if you must share a 64-bit server with other colleagues. In addition, when writingan application in Visual Studio 2005 that will run on an Itanium 2 server, remotedebugging might be the only way to debug the application. Whatever your case may be,we hope you find this newsletter helpful when setting up your development environment.

    For More Information Visual Studio 2005 Remote Debugging http://msdn.microsoft.com/netframework/programming/64bit/remotedebugging/

    How to: Set Up Remote Debugginghttp://msdn2.microsoft.com/en-us/library/bt727f1t.aspx

    How to: Debug 64-Bit Applicationshttp://msdn2.microsoft.com/en-us/library/ms184681(VS.80).aspx

    http://msdn.microsoft.com/netframework/programming/64bit/remotedebugging/http://msdn.microsoft.com/netframework/programming/64bit/remotedebugging/http://msdn2.microsoft.com/en-us/library/bt727f1t.aspxhttp://msdn2.microsoft.com/en-us/library/bt727f1t.aspxhttp://msdn2.microsoft.com/en-us/library/ms184681(VS.80).aspxhttp://msdn2.microsoft.com/en-us/library/ms184681(VS.80).aspxhttp://msdn2.microsoft.com/en-us/library/ms184681(VS.80).aspxhttp://msdn2.microsoft.com/en-us/library/bt727f1t.aspxhttp://msdn.microsoft.com/netframework/programming/64bit/remotedebugging/