Bug 206018 - [remotecdt] gdb fails to connect to gdbserver
Summary: [remotecdt] gdb fails to connect to gdbserver
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 6.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-11 05:41 EDT by Sander Klous CLA
Modified: 2020-09-04 15:20 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sander Klous CLA 2007-10-11 05:41:05 EDT
Build ID: M20070921-1145

Steps To Reproduce:
1. Start SSH tunnels for ssh port and gdbserver port
2. Run gdbserver via ssh port over ssh tunnel
3. Run local gdb connecting to gdbserver port over ssh tunnel
4. gdb reports "putpkt: write failed: Broken pipe"


More information:
Target Management Service 2.0.0.v20070613
The tunnel is needed due to firewall settings

The problem is: gdb tries to connect to gdbserver before gdbserver started (due to login delays). So, gdb fails to connect and reports the above mentioned error. Instead, one should make sure gdbserver actually started before gdb tries to connect.
Comment 1 Martin Oberhuber CLA 2007-10-11 09:34:25 EDT
Do you have a suggestion how we could probe whether the gdbserver has been started or not?
Or, what would you think about another field in the launch config where the user could manually specify a delay in seconds to wait for gdbserver to start?
Comment 2 Sander Klous CLA 2007-10-11 10:12:02 EDT
Hi Martin,

> Do you have a suggestion how we could probe whether the gdbserver has been
> started or not?

Since the ssh connection is kept open to catch the gdbserver output, scanning the output, e.g. with select(), would be a nice solution. As soon as "Listening on port 2345" (or whatever other specified port number) appears in the output, gdb can be started.

> Or, what would you think about another field in the launch config where the
> user could manually specify a delay in seconds to wait for gdbserver to start?

This would work, it is sort of how I patched it at the moment:

[ ~]# cat /usr/bin/gdb.delayed 
#!/bin/bash
sleep 10
gdb $@

Thanks,
Sander
Comment 3 Martin Oberhuber CLA 2009-04-30 11:51:52 EDT
Moving into CDT as per bug 267065.