Remote debugging a Linux process from CDT on Windows [message #553452] |
Tue, 17 August 2010 15:04 |
Robin Fernandes Messages: 5 Registered: July 2009 |
Junior Member |
|
|
Hi all,
I am running Eclipse CDT on Windows to develop C code that is built & tested on remote Linux systems. Currently, the code is only compiled on Linux - never on Windows.
My aim is to remotely debug a Linux process from the Windows CDT environment. The RSE FAQ describes two general approaches to achieve this:
- Option 1: Launch the gdb client on the remote system over ssh.
- Option 2: Use a cross-debugging version of the gdb client that can run on the Windows development system and understand the remote Linux process data fed to it by gdbserver.
Option 1 seems more simple. The idea is simply to replace the gdb command in the debug launch configuration with e.g. "plink remotehost gdb". However, this fails, because many fields in the launcher are forcefully tied to the local system. For example, the project directory must be a path on the system on which CDT is running. Consequently, when gdb runs on the remote host, it fails with errors like:
Error in final launch sequence
Failed to execute MI command:
-environment-cd "C:/code/helios.workspace/Build Test C"
Error message from debugger back end:
C:/code/helios.workspace/Build Test C: No such file or directory.
Where "C:\code\helios.workspace\Build Test C" is a path on the Windows system where CDT is running, so is of course not found on the remote Linux system where gdb is running. So question 1 is: has anyone ever successfully launched a debug session from CDT using gdb over ssh from CDT, and if so, how?
Option 2 should be as simple as getting hold of / building the appropriate flavour of gdb. So question 2 is: does anyone know where I can find a cross-build of gdb that will allow me to debug Linux processes from a Windows system, or where I can find instructions to build one myself?
Many thanks,
-R
[Updated on: Tue, 17 August 2010 15:42] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Remote debugging a Linux process from CDT on Windows [message #553912 is a reply to message #553732] |
Thu, 19 August 2010 12:06 |
Robin Fernandes Messages: 5 Registered: July 2009 |
Junior Member |
|
|
andreyvo wrote on Wed, 18 August 2010 11:51 | debug.sh - bash helper script on target linux machine:
#!/bin/bash
# Delete windows drive letter from gdb cmd line parameters
options=${@//C:\\/}
# replace backslashes
options=${options//\\/\/}
# replace possible path inconsistencies
options=${options//SambaPathToProject/\/LinuxPathToProject}
sed -u -e 's/\\/\//g'| \
sed -u -e "s/C:\/SambaPathToProject/\/LinuxPathToProject/g"| \
gdb ${options}
|
Thanks for your reply! Unfortunately, I've had no luck with this sort of script: CDT seems to send some paths to the remote process over gdb/mi after launching it, so the paths are not as command line arguments. There's an open bug here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=252758 .
Could you share how you got around this? There are many options that can be configured in the launch (process launcher, debugger, protocol etc...). Perhaps you have some combination of launcher config parameters which ensures the paths are only passed on the command line?
[Updated on: Thu, 19 August 2010 13:29] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04714 seconds