Thread: Execute & debug remotely?

  1. #1
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545

    Execute & debug remotely?

    Hi,
    I'm using Visual C++ 6.0 (go ahead & laugh, but I have no choice), and I was wondering if there's any way to execute the debug .exe on a remote system and debug it from my dev machine?
    I'd rather not install the whole program I'm fixing on my machine because, well -- it sucks, and I don't want to blow up my own machine...

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by cpjust View Post
    Hi,
    I'm using Visual C++ 6.0 (go ahead & laugh, but I have no choice), and I was wondering if there's any way to execute the debug .exe on a remote system and debug it from my dev machine?
    I'd rather not install the whole program I'm fixing on my machine because, well -- it sucks, and I don't want to blow up my own machine...
    First Google hit for "visual studio remote debugging" looks promising. EDIT: Oh wait, you said 6.0? Hmm

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by brewbuck View Post
    First Google hit for "visual studio remote debugging" looks promising. EDIT: Oh wait, you said 6.0? Hmm
    And still it is possible
    You have to copy some file to the remote computer ( I do not remember the exact list - read manual)
    In the build menu - select Debug Remote connection ...

    Just read the http://msdn2.microsoft.com/en-us/library/aa293540.aspx
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    6.0 did have remote debugging facilities. But I think only on the professional version.

    Meanwhile, http://msdn2.microsoft.com/en-us/lib...29(VS.71).aspx
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Mario F. View Post
    6.0 did have remote debugging facilities. But I think only on the professional version.

    Meanwhile, http://msdn2.microsoft.com/en-us/lib...29(VS.71).aspx
    Not saying it didn't, but the Google hit I mentioned wasn't relevant to that version.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I tell you one thing that the docs aren't real clear on, in the "Remote Executable Path" be sure to use a UNC path the evaluates correctly in the context of both machines - for example: "\\192.168.1.10\C$\MyApp\MyApp.exe".

    So to get that path to work, you'll have to turn off simple file sharing on the remote machine and you'll need to have already authenticated for access to C$ before debugging.

    gg

  7. #7
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by Codeplug View Post
    I tell you one thing that the docs aren't real clear on, in the "Remote Executable Path" be sure to use a UNC path the evaluates correctly in the context of both machines - for example: "\\192.168.1.10\C$\MyApp\MyApp.exe".

    So to get that path to work, you'll have to turn off simple file sharing on the remote machine and you'll need to have already authenticated for access to C$ before debugging.

    gg
    I do not remember it is necesary

    Executable for Debug Session Enter the name and path of the executable file as the debugger host computer sees it.
    The path should be the local path of remote computer because it is remote debugger monitor running there, who search for the executable to start
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I use it every day and it's needed for me...but I'm debugging a large project with multiple DLL's that I step in and out of. Simply following the instructions may work for single EXE - but if it doesn't, make the remote executable path visible to both machines.

    gg

  9. #9
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Thanks, I'll give all that a try.
    Wow, my first remote debugging -- I can't wait!

  10. #10
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by Codeplug View Post
    I use it every day and it's needed for me...but I'm debugging a large project with multiple DLL's that I step in and out of. Simply following the instructions may work for single EXE - but if it doesn't, make the remote executable path visible to both machines.

    gg
    As I remember - there is a list of "used dlls" that you should add setting up the remote exe to debug.
    And they'll be found and be available for debugging as well
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  11. #11
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    It's coming back to me.....I think the problem was that only the EXE could be debugged if the remote executable path wasn't absolute for both machines.

    Another technique I've seen people use is to copy all your debug binaries and PDB's to the same "remote executable path" directory structure on both machines. So if you use "C:\MyApp\MyApp.exe", you would copy everything needed to that directory on both machines.

    gg

  12. #12
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Codeplug View Post
    I tell you one thing that the docs aren't real clear on, in the "Remote Executable Path" be sure to use a UNC path the evaluates correctly in the context of both machines - for example: "\\192.168.1.10\C$\MyApp\MyApp.exe".

    So to get that path to work, you'll have to turn off simple file sharing on the remote machine and you'll need to have already authenticated for access to C$ before debugging.

    gg
    I did that, but when I press F5 I get "The remote machine '\\qa-vm-w2k3-sp1\c$\Program Files\MyCompany\My Program\MyProgram.exe' could not be found."
    I'm wondering if it's having problems with the spaces in the path?
    I tried putting quotes around the whole path, but that didn't help.

  13. #13
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You may need to use the 8.3 format for the entire pathname - ie. "Program Files" -> "Progra~1" ect...

    What I do is map a drive to the program directory on both machines. So on the debugging machine, I would map R:\ to "\\qa-vm-w2k3-sp1\c$\Program Files\MyCompany\My Program\" using "map network drive", and on the remote machine map R:\ to "C:\Program Files\MyCompany\My Program\" (using the subst command).

    Then your remote executable path will simply be "R:\MyProgram.exe". Another nice thing about doing it this way is that you can setup a simple "post build command" to copy the the target to R:\ so your ready to F5 as soon as you make a change

    Your post build command would be "copy $(TargetPath) R:\".

    gg

  14. #14
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Codeplug View Post
    You may need to use the 8.3 format for the entire pathname - ie. "Program Files" -> "Progra~1" ect...

    What I do is map a drive to the program directory on both machines. So on the debugging machine, I would map R:\ to "\\qa-vm-w2k3-sp1\c$\Program Files\MyCompany\My Program\" using "map network drive", and on the remote machine map R:\ to "C:\Program Files\MyCompany\My Program\" (using the subst command).

    Then your remote executable path will simply be "R:\MyProgram.exe". Another nice thing about doing it this way is that you can setup a simple "post build command" to copy the the target to R:\ so your ready to F5 as soon as you make a change

    Your post build command would be "copy $(TargetPath) R:\".

    gg
    Thanks, I used subst to map those paths to a drive and shortened the .exe name to 8.3 format. Now when I press F5 it pauses for a few seconds like it's trying to connect, but then gives me the same error.

    Let me make sure I'm doing everything right:
    - In the Project Settings, Debug/General tab, I added "V:\MyProg~1.exe" to the "Remote executable and filename" field.

    - In Build->Debugger Remote Connection, TCP/IP, Settings, I have "V:\MyProg~1.exe" in the "Target machine name or address" field.

    - On the remote machine, in the Debug Monitor Settings, I have "V:\MyProg~1.exe" in the "Target machine name or address" field.

    When I click "Connect" in the Debug Monitor program it has a dialog that says "Connecting..." which never changes until I click "Disconnect". Is it ever supposed to say "Connected" or anything?

  15. #15
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    OK, for those last 2 I changed it from V:\... to just the machine name of the remote machine and it got further. It failed because the Windows DLLs were different on the two machines, but at least it's connecting now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary not built with debug info - why?
    By ulillillia in forum C Programming
    Replies: 15
    Last Post: 12-11-2008, 01:37 AM
  2. makefiles - debug & release?
    By cpjust in forum C Programming
    Replies: 6
    Last Post: 10-26-2007, 04:00 PM
  3. Debug --> Exceptions in Visual Studio 2005
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-10-2007, 02:12 AM
  4. Results in Debug and Release mode are different
    By jaro in forum C Programming
    Replies: 11
    Last Post: 05-27-2006, 11:08 AM
  5. Ask about Debug Assert Failed
    By ooosawaddee3 in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2002, 11:07 PM