Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » CDT Remote debugging - Reconnecting to existing gdbserver instance
CDT Remote debugging - Reconnecting to existing gdbserver instance [message #755872] Wed, 09 November 2011 22:31 Go to next message
Vidya  is currently offline Vidya Friend
Messages: 9
Registered: November 2010
Junior Member
Hello All,

I have managed to establish a remote debug session using the "attach to application" option, after starting a gdbserver instance on the target.

From gdb command line(within eclipse), I can disconnect and connect to the already running gdbserver instance using the gdb "disconnect" command.
But on disconnecting and restarting the remote debug session on eclipse(not from command line), debugging does not work unless I restart the gdbserver instance too.

What is the right procedure to terminate and restart debug sessions, attaching them to the same gdbserver instance every time?

Thank you for your time,
Vidya

Re: CDT Remote debugging - Reconnecting to existing gdbserver instance [message #755888 is a reply to message #755872] Thu, 10 November 2011 02:22 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
If you terminate the debug session using the terminate button, you should be able to reconnect to the same gdbserver.
Be sure to run gdbserver like this:

gdbserver --multi :<port>
Re: CDT Remote debugging - Reconnecting to existing gdbserver instance [message #756728 is a reply to message #755888] Mon, 14 November 2011 20:36 Go to previous messageGo to next message
Vidya  is currently offline Vidya Friend
Messages: 9
Registered: November 2010
Junior Member
Hi Marc,

Thank you for the reply. The problem is I want to be able to start the gdbserver , already attached to a process.
i.e :

gdbserver --multi host:<port> --attach <pid>

On terminating a debug session from eclipse, the gdbserver instance disconnects from the process although it does not terminate, and I cannot reconnect to the existing gdbserver instance as no process is attached to it.

On the other hand if I use the "disconnect" command from the gdb cli from within eclipse, gdbserver does not detach from the process and I can reconnect to the running application.

I want to be able to achieve what is mentioned in scenario 2.

The other option is starting gdbserver in multiprocess mode without attaching to any process on the server. In this case what remote connection feature should be used on eclipse to view and attach a remote process to the existing gdbserver instance? ( I think we cannot achieve this using "attach to application" option )

Please let me know.

Thank you for your time
Vidya

Re: CDT Remote debugging - Reconnecting to existing gdbserver instance [message #756737 is a reply to message #756728] Mon, 14 November 2011 21:05 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
> The other option is starting gdbserver in multiprocess mode without attaching to any process on the server.

This is the way Eclipse/CDT expects things. You would use C/C++ Attach to application and when connected to the target, press the "Connect" button in the debug toolbar.
You can look in the below wiki for how to do it.

http://wiki.eclipse.org/CDT/User/FAQ#How_do_I_use_multi-process_debugging.3F

Marc
Re: CDT Remote debugging - Reconnecting to existing gdbserver instance [message #757015 is a reply to message #756737] Wed, 16 November 2011 03:19 Go to previous messageGo to next message
Vidya  is currently offline Vidya Friend
Messages: 9
Registered: November 2010
Junior Member
H Marc,

Thank you , I followed the steps mentioned above and could attach to the process, after starting gdbserver with "gdbserver --multi host:<port>". However, I still cannot disconnect and connect to the same gdbserver session from the eclipse GUI. It works if I use the "disconnect" command from gdb cli.

I have eclipse helios and do not target multi process debugging. Just debugging a single process, but without starting gdbserver everytime. Any other pointers on how I can debug this issue?

Thank you very much for your time.
Vidya
Re: CDT Remote debugging - Reconnecting to existing gdbserver instance [message #757063 is a reply to message #757015] Wed, 16 November 2011 10:25 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
I don't quite remember what Helios did compared to the latest Indigo release. My first recommendation would be to upgrade.

Also, you are probably having a problem with the preference to kill GDB once disconnected from the last process.
Go to Preferences->C/C++->Debug->GDB and make sure to uncheck "Terminate GDB when the last process exits"
You can see this option on the screenshot on this page:
http://wiki.eclipse.org/CDT/User/NewIn80#New_set_of_preferences

Marc
Re: CDT Remote debugging - Reconnecting to existing gdbserver instance [message #757338 is a reply to message #757063] Thu, 17 November 2011 19:08 Go to previous message
Vidya  is currently offline Vidya Friend
Messages: 9
Registered: November 2010
Junior Member
Thank you for the reply Marc. Changing the preferences you suggested did not work. I will try upgrading to Indigo and check how that goes.

Thank you for the detailed information.

Vidya
Previous Topic:synchronizing with several remote sites
Next Topic:Cannot run programs OSX
Goto Forum:
  


Current Time: Wed Apr 24 21:03:09 GMT 2024

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

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

Back to the top