简体   繁体   中英

How to debug a linux C++ program from Windows with Eclipse?

I use a headless (ie no screen) remote ubuntu server x64 for developping a C++ application (with no UI either).

I want to conveniently (IDE like, not command line) debug this program from windows (7/64), with Eclipse if possible. I have a windows share between the two and full root access on both machines.

So far I have heard of two solutions :

  1. Remote gdb
  2. Remote X server

I have worked on solution 1 : built a cross gdb, copied my program and libs on windows. I'm able to remote-gdb from cygwin command line, but not from eclipse (stuck at "launching... 85%" with no error message nor log)

I have also worked on solution 2 : installed xauth, set X forwarding, installed xming on my windows, set DISPLAY on the linux box. But no effect "can't open DISPLAY xxx" with no easy troubleshoot.

When googling for those problems, I only find outdated pages or different problems.

Did anyone do it ? Can you share advices or fresh pointers on how to remote debug a C++ linux app from Windows ?

I suggest to install an X11 server on your Windows machine (eg Xming perhaps?) and to do ssh -X with some X11 client applications (like emacs , ddd if needed, xterm ) on your Linux server. Don't use a complex thing like Eclipse. You could just use emacs (remotely on the Linux server, displaying on the Windows desktop X11 server)...

Once emacs works well (running on the remote Linux server, displaying on the Windows desktop X11 server), you can run gdb inside it.

To get ssh -X working, you need to configure it appropriately. Maybe you forgot that step. To test it, just use ssh -X yourlinuxhost xterm , and work on configuration till that step works.

Of course you could also install Linux on your laptop or desktop, perhaps inside a virtual machine above your Windows.

NB. I never used Windows, but I do know that some X11 servers exist for it.

You can use the following simple plugin for Eclipse.

http://marketplace.eclipse.org/content/direct-remote-c-debugging

It needs just ssh connection to the server and it cares about anything else

There is a eclipse plugin RSE (Remote System Explorer), it can pretty much do what you are expecting. The code base can be in linux server, eclipses uses telnet / ssh to login. Execution again can happen on a server, native gdb is used to debug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM