Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » configuring remote debug from windows to linux
configuring remote debug from windows to linux [message #156429] Mon, 17 October 2005 16:02 Go to next message
Eclipse UserFriend
Originally posted by: bcrawford.casecentral.com

I am trying to configure Eclipse CDT to allow remote debug from a Windows PC
(where Eclipse runs) to an application running on a Linux server.
The application runs on the Linux server and is started with a number of
command line options.

Information on the net seems to indicate that this is possible, but I
haven't been able to put the pieces together yet.
Does anyone know of a tutorial or instructions?

My environment is the following:

Windows 2000 Professional
Eclipse 3.1.1
CDT 2.1.1
java 1.4.2_08

Linux 2.4.20-24.9smp #1 SMP Mon Dec 1 11:25:17 EST 2003
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Re: configuring remote debug from windows to linux [message #157015 is a reply to message #156429] Sun, 30 October 2005 08:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: graham.popwish.com

I have no solution to this, I'm afraid, but I just wanted to say that I am
hugely interested in this kind of set up myself. I have done some fairly
serious invesigation and here is where I am at at the moment:

I've written an ssh2-based plug-in that extends LaunchConfigurationType.

This allows me to successfully ssh-exec programs on the remote linux
machine.

Incidently, I can also create a shell over ssh and run a small terminal
emulator in an Eclipse console window.

But, next up is working out how to knit the launching facility into CDT.
There are, in my opinion, two problems here:

a) ssh-exec doesn't really offer the ability to create a full running
environment for the linux executable. I was thinking that I might be able
to solve this by preceding each ssh-exec command line with a CD command
and a bunch of EXPORT commands (could chain them all together on a single
bash command line that might get a bit long).

Another alternative is to run some kind of 'managed' shell session. This
would keep an execution environment open at all times with a 'current
directory' and an environment. I would then have to come up with some
means of establishing that a command line invocation had finished.

b) it's not clear how to structure this all into CDT. It has some
'spawner'/ lanuch system at the heart of its being. I was thinking I could
replace this in some way and had an initial try, which didn't seem to work
at all. It would be far better if there were some kind of official CDT
extension point available in this area.

There are other questions. Should I run the linux CDT on windows or the
windows one?

The main problem with all this kind of work for other plug-ins as well as
CDT is that all the code is litttered with calls to the Java System class,
which reports on the current environment and creates system processes. All
this is somewhat annoying because it really ties eclipse to the local file
system and local process creation.

It makes one suspect that the only real solution is to push the remoting
down into java itself - have a special java runtime that ssh's to a remote
machine and cooperates with it for delivering system services to the
running java application. If anybody knows if something like this exists,
I'd be very happy to hear about it.

I notice there is some work going on on the whole issue of remote target
management:

http://www.eclipse.org/dsdp/tm/

When this arrives (it appears to be in its infancy), it would be good to
have CDT aware of such things. Maybe it would be good for CDT to get
prepared for its arrival. I am a software manager and would be able to put
some resources on to this but without a deeper understanding of what
direction to take with regard to restructuring CDT, I'm not sure it would
be beneficial to me and others.

Graham
Re: configuring remote debug from windows to linux [message #157022 is a reply to message #157015] Sun, 30 October 2005 18:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikhailkhod.rogers.com

The CDT team is aware of the DSDP project and is working closely with the
DSDP team to coordinate the efforts.
To use the CDT for remote debugging you have to implement a special launcher
(LaunchConfigurationDelegate) that fits into your requirements. There are
many commercial systems based on the CDT, mostly designed for remote
development.

"Graham Darnell" <graham@popwish.com> wrote in message
news:2db26d0681befff9abf329b4baad3827$1@www.eclipse.org...
> I have no solution to this, I'm afraid, but I just wanted to say that I am
> hugely interested in this kind of set up myself. I have done some fairly
> serious invesigation and here is where I am at at the moment:
>
> I've written an ssh2-based plug-in that extends LaunchConfigurationType.
>
> This allows me to successfully ssh-exec programs on the remote linux
> machine.
>
> Incidently, I can also create a shell over ssh and run a small terminal
> emulator in an Eclipse console window.
>
> But, next up is working out how to knit the launching facility into CDT.
> There are, in my opinion, two problems here:
>
> a) ssh-exec doesn't really offer the ability to create a full running
> environment for the linux executable. I was thinking that I might be able
> to solve this by preceding each ssh-exec command line with a CD command
> and a bunch of EXPORT commands (could chain them all together on a single
> bash command line that might get a bit long).
>
> Another alternative is to run some kind of 'managed' shell session. This
> would keep an execution environment open at all times with a 'current
> directory' and an environment. I would then have to come up with some
> means of establishing that a command line invocation had finished.
>
> b) it's not clear how to structure this all into CDT. It has some
> 'spawner'/ lanuch system at the heart of its being. I was thinking I could
> replace this in some way and had an initial try, which didn't seem to work
> at all. It would be far better if there were some kind of official CDT
> extension point available in this area.
>
> There are other questions. Should I run the linux CDT on windows or the
> windows one?
>
> The main problem with all this kind of work for other plug-ins as well as
> CDT is that all the code is litttered with calls to the Java System class,
> which reports on the current environment and creates system processes. All
> this is somewhat annoying because it really ties eclipse to the local file
> system and local process creation.
>
> It makes one suspect that the only real solution is to push the remoting
> down into java itself - have a special java runtime that ssh's to a remote
> machine and cooperates with it for delivering system services to the
> running java application. If anybody knows if something like this exists,
> I'd be very happy to hear about it.
>
> I notice there is some work going on on the whole issue of remote target
> management:
>
> http://www.eclipse.org/dsdp/tm/
>
> When this arrives (it appears to be in its infancy), it would be good to
> have CDT aware of such things. Maybe it would be good for CDT to get
> prepared for its arrival. I am a software manager and would be able to put
> some resources on to this but without a deeper understanding of what
> direction to take with regard to restructuring CDT, I'm not sure it would
> be beneficial to me and others.
>
> Graham
>
>
Re: configuring remote debug from windows to linux [message #157241 is a reply to message #157022] Wed, 02 November 2005 13:01 Go to previous messageGo to next message
Karen Ploski is currently offline Karen PloskiFriend
Messages: 11
Registered: July 2009
Junior Member
Assuming that you did not wish to use a commerical product based on CDT to
perform remote debugging in this scenario, would it be practical to keep
Eclipse on Windows, use a cross compiler to produce code that runs on
Linux, and then use DDD with GDB for debugging?

Assuming you keep the source files on Windows, you would need to point DDD
at the source files and that means you'd be accessing the source over a
network. If you put the source files on Linux, it seems that Eclipse
would need to drag them over the network to compile them.

Assuming what I've just written would work, it's not clear (to me at
least) that it would be practical, due to the overhead of dragging files
across the network, and also due to the need to use another tool (e.g.,
cygwin/X) to gain access to DDD.

Would anyone care to comment?

Thanks,
- Karen
Re: configuring remote debug from windows to linux [message #157290 is a reply to message #157241] Fri, 04 November 2005 16:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bcrawford.casecentral.com

In my particular case the source is on a Linux server where the
application must execute, but I have a Samba link to the source so I edit
the source using Eclipse on my Windows desktop.

I do have a copy of the source and cygwin installed on the Windows box,
but the application needs the Linux server environment to execute.

I can establish an X-Window to the Linux server and run DDD or GDB, but it
would be much more productive to be able to do this directly from Eclipse
running on the Windows desktop.

In a previous job I was able to do this with a Java application running in
a JBoss application server using a remote connection.

I keep thinking that using the GDB Server capability might work, but if so
I haven't figured out how to make it happen.
Re: configuring remote debug from windows to linux [message #157879 is a reply to message #157290] Mon, 14 November 2005 07:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: graham.popwish.com

Me too. Source on the Linux machine. Executables built on the Linux
machine using a build system based on SCons. Editing using Eclipse over
Samba. The build system can build for multiple targets, so running and
debugging generally involves deployment to a third device.

I call it the 'Canadian Cross-Execution Environment' based around three
machines:

Linux server: SVN repository, development source, and build system
Windows client: Developer machines running Eclipse
Targets: Networked target machines.

Graham
Re: configuring remote debug from windows to linux [message #157887 is a reply to message #157022] Mon, 14 November 2005 08:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: graham.popwish.com

Hi Mikhail,

I have written the ssh-based LaunchConfigurationDelegate. However, I guess
I'm missing an understanding of how to tell CDT to use my
LaunchConfigurationDelegate rather than its default one.

I imagine that involves wrapping it in something more like a 'spawner'.

I'd be grateful if you could point me to some of the commercial products
you have in mind.

Best regards
Graham
Re: configuring remote debug from windows to linux [message #157953 is a reply to message #157887] Mon, 14 November 2005 18:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stanley.apogee.com

Graham,

you can put the following snippet in plugin.xml included
with your plugin:

<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
delegate="my.ssh.launch.DeviceLaunchDelegate"
id="my.ssh.launch.DeviceLaunchConfigurationType"
modes="run,debug"
name="SSH Launch"
public="true"
sourceLocatorId=" org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDire ctor "

sourcePathComputerId=" org.eclipse.jdt.launching.sourceLookup.javaSourcePathCompute r "/>
</extension>

<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
class="my.ssh.launch.DeviceLaunchConfigurationTabGroup"
id="my.ssh.launch.DeviceLaunchConfigurationTabGroup"
type="my.ssh.launch.DeviceLaunchConfigurationType"/>
</extension>


change 'delegate=' line to your class. Once you start Eclipse, go to
'Run'->'Run...' menu and you should see 'SSH Launch' as one of the options.
You would also need to implement
'my.ssh.launch.DeviceLaunchConfigurationTabGroup' class that will pop up
configuration tabs that will allow you to configure the runtime parameters.

-- stanley

p.s. if your plugin is open-source (or eclipse licensed), i'd like to take
a look at it, since i am looking for something similar and don't want to
reinvent the wheel :)


Graham Darnell wrote:
> Hi Mikhail,
>
> I have written the ssh-based LaunchConfigurationDelegate. However, I
> guess I'm missing an understanding of how to tell CDT to use my
> LaunchConfigurationDelegate rather than its default one.
>
> I imagine that involves wrapping it in something more like a 'spawner'.
>
> I'd be grateful if you could point me to some of the commercial products
> you have in mind.
>
> Best regards
> Graham
>
Re: configuring remote debug from windows to linux [message #158023 is a reply to message #157887] Mon, 14 November 2005 21:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikhailk.qnx.com

> I have written the ssh-based LaunchConfigurationDelegate. However, I guess
> I'm missing an understanding of how to tell CDT to use my
> LaunchConfigurationDelegate rather than its default one.

Use the "plugin.xml" file of the "org.eclipse.cdt.launch" plugin as an
example.

> I'd be grateful if you could point me to some of the commercial products
> you have in mind.

I can't point you to a commercial product that supports your environment,
but there are various products for remote and cross platform development
based on the CDT. For example, QNX Momentics and DevRocket from Monta-Vista.
Check also http://www.zylin.com/embeddedcdt.html.

"Graham Darnell" <graham@popwish.com> wrote in message
news:8117bdaa2ce7d42d43027ec172bf1168$1@www.eclipse.org...
> Hi Mikhail,
>
> I have written the ssh-based LaunchConfigurationDelegate. However, I guess
> I'm missing an understanding of how to tell CDT to use my
> LaunchConfigurationDelegate rather than its default one.
>
> I imagine that involves wrapping it in something more like a 'spawner'.
>
> I'd be grateful if you could point me to some of the commercial products
> you have in mind.
>
> Best regards
> Graham
>
Re: configuring remote debug from windows to linux [message #158194 is a reply to message #157953] Wed, 16 November 2005 21:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: graham.popwish.com

Stanley,

I haven't open-sourced the plug in because I haven't yet applied myself to
some of the security issues with it. For instance, I have the user
configuring the plugin with their RSA passphrase but have as yet gone to
no lengths to encrypt that in the eclipse memento.

Could probably knock it into some sort of publishable shape though, or at
least send it to you. Tell me if you really want it and I'll see what I
can do.

Graham
Re: configuring remote debug from windows to linux [message #158202 is a reply to message #157953] Wed, 16 November 2005 21:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: graham.popwish.com

Yeah, but what I really want is for CDT to launch, for instance, gdb, on
the remote machine, automatically.

So, where CDT would normally create a local process, I want it to create a
process on the Linux server.

That's why I was suggesting that I might really want to run the Linux CDT
on Windows with some sort of ssh-based fiddle working away inbetween to
fool everything that all is cool.

Graham
Re: configuring remote debug from windows to linux [message #158435 is a reply to message #158202] Fri, 18 November 2005 19:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stanley.apogee.com

Graham,

i've done the exact thing for WSDD (IBM's eclipse version). Basically,
the idea is to create alternate launch (e.g. "Remote C/C++ Application")
using the plugin.xml contents provided in my previous post. You can also
subclass org.eclipse.cdt.launch.internal.ui.LocalRunLaunchConfigurati onTabGroup
for your <launcConfigurationTabGroup> entry. You will need to add an
additional tab to configure 'remote host name', 'user', 'passkey', etc.
You can then subclass org.eclipse.cdt.launch.internal.LocalRunLaunchDelegate
class to configure majority of the run parameters. Then 'launch' method
of your LaunchDelegate will basically do the following operations:

a) collect the command-line information as if the application would
be invoked on the local machine (see how LocalRunLaunchDelegate class
does it).
b) collect the 'ssh' command line based on the values that were
configure by the user in your extra tab (hostname, user, passkey, etc).
c) prepend ssh command line (obtained in (b)) to local command line
(obtained in (a)).
d) call run() method to invoke the actual 'ssh' process (or however
you invoke your ssh implementation).

-- stanley

p.s there is an eclipse subproject (eclipse.org/dsdp) which is trying
to deal with the same issues. Your plugin may be of some use to the
above group (i'm also interested in DSDP), so if you are planning to
open-source it, i can help you with the implementation/suggestions.

Graham Darnell wrote:
> Yeah, but what I really want is for CDT to launch, for instance, gdb, on
> the remote machine, automatically.
>
> So, where CDT would normally create a local process, I want it to create
> a process on the Linux server.
>
> That's why I was suggesting that I might really want to run the Linux
> CDT on Windows with some sort of ssh-based fiddle working away inbetween
> to fool everything that all is cool.
>
> Graham
>
Re: configuring remote debug from windows to linux [message #158468 is a reply to message #158435] Fri, 18 November 2005 22:15 Go to previous message
Eclipse UserFriend
Originally posted by: graham.popwish.com

Hey Stanley,

Thanks for the help. I'll send you my stuff soon. It uses the jcraft ssh
library. Its a BSD style license but I just want to make sure I've
fulfilled all the requirements before distributing.

Thanks
Graham
Previous Topic:Compiling multiple source types with managed make
Next Topic:Favorite documentation system for C++
Goto Forum:
  


Current Time: Thu Aug 29 14:20:31 GMT 2024

Powered by FUDForum. Page generated in 0.26049 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top