Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Can gdbserver tunnel stdout/stdin to/from gdb ?
@ 2022-02-08  4:04 William Tambe via Gdb-patches
  2022-02-08  9:20 ` Andrew Burgess via Gdb-patches
  0 siblings, 1 reply; 3+ messages in thread
From: William Tambe via Gdb-patches @ 2022-02-08  4:04 UTC (permalink / raw)
  To: gdb-patches

Can gdbserver tunnel stdout/stdin to/from gdb so as to debug an
application as if it was executing on the machine running gdb ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can gdbserver tunnel stdout/stdin to/from gdb ?
  2022-02-08  4:04 Can gdbserver tunnel stdout/stdin to/from gdb ? William Tambe via Gdb-patches
@ 2022-02-08  9:20 ` Andrew Burgess via Gdb-patches
  2022-02-10 20:58   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess via Gdb-patches @ 2022-02-08  9:20 UTC (permalink / raw)
  To: William Tambe, gdb-patches

William Tambe via Gdb-patches <gdb-patches@sourceware.org> writes:

> Can gdbserver tunnel stdout/stdin to/from gdb so as to debug an
> application as if it was executing on the machine running gdb ?

I don't believe gdbserver itself supports this feature.

The remote protocol doe have limited support for this using the File I/O
extensions:

  https://sourceware.org/gdb/onlinedocs/gdb/File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension

as far as I understand it though, this is mostly used when debugging
devices that don't have their own console, so we have some support for
allowing the target to print to gdb's console.  Though I don't see why a
bigger target couldn't make use of that extension - you'd just need a
mechanism to intercept the syscalls at the remote end and have gdbserver
forward them to gdb.

The final thing that might be relevant to this topic, though clearly not
what you're actually asking about, is the 'O' packet, which allows
gdbserver to write messages to gdb's console.  As I understand it, this
is often used to allow things like monitor commands to print diagnostic
output, but in general I think this is more for gdbserver itself (not
the thing running under gdbserver) to communicate with the gdb user.

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can gdbserver tunnel stdout/stdin to/from gdb ?
  2022-02-08  9:20 ` Andrew Burgess via Gdb-patches
@ 2022-02-10 20:58   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2022-02-10 20:58 UTC (permalink / raw)
  To: Andrew Burgess via Gdb-patches; +Cc: Andrew Burgess

>> Can gdbserver tunnel stdout/stdin to/from gdb so as to debug an
>> application as if it was executing on the machine running gdb ?

Andrew> I don't believe gdbserver itself supports this feature.

I wish it did though :)

Andrew> Though I don't see why a
Andrew> bigger target couldn't make use of that extension - you'd just need a
Andrew> mechanism to intercept the syscalls at the remote end and have gdbserver
Andrew> forward them to gdb.

Would it work to redirect I/O when launching the inferior?

Andrew> The final thing that might be relevant to this topic, though clearly not
Andrew> what you're actually asking about, is the 'O' packet, which allows
Andrew> gdbserver to write messages to gdb's console.  As I understand it, this
Andrew> is often used to allow things like monitor commands to print diagnostic
Andrew> output, but in general I think this is more for gdbserver itself (not
Andrew> the thing running under gdbserver) to communicate with the gdb user.

Note also the 'O' packet doesn't work with non-stop.  GDB needs a bit of
protocol work in this area.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-10 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08  4:04 Can gdbserver tunnel stdout/stdin to/from gdb ? William Tambe via Gdb-patches
2022-02-08  9:20 ` Andrew Burgess via Gdb-patches
2022-02-10 20:58   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox