This is the mail archive of the
mailing list for the GDB project.
Re: Fwd: Can GDB interact with serial ports on remote targets?
- From: Brendan J <bhenryj0117 at googlemail dot com>
- To: lgustavo at codesourcery dot com
- Cc: gdb at sourceware dot org
- Date: Fri, 20 Feb 2015 15:45:21 +0000
- Subject: Re: Fwd: Can GDB interact with serial ports on remote targets?
- Authentication-results: sourceware.org; auth=none
- References: <CAJUwWUNyZ=CYr9xL0h5kD0UABpy12LS1hO-hXhwM6-aTh946Zg at mail dot gmail dot com> <CAJUwWUMX_qowt2ePjCbXKcyhmve01L9a-rz5Oa9QdbA1vj9ojA at mail dot gmail dot com> <54E74F64 dot 9080308 at codesourcery dot com>
Hi Luis, thanks for your response.
Hmm, yes I now realise I was remotely aware of semihosting.
Unfortunately my project is running on bare-metal (no OS, no u-boot or
UEFI or anything) so I don't think semihosting is quite appropriate.
As I understand it, typical use of semihosting goes like this:
You're debugging an application on a remote target, and that target
has an OS, and that OS has support for semihosting. The application
issues a "read" system call, and the OS handles it by issuing a
semihosting debug call (as opposed to actually reading the file or
UART or whatever).
That is to say, the system under debug needs to be modified to support
semihosting, which I'd really like to avoid doing in my case. Please
correct me if my understanding of semihosting is wrong.
Otherwise, are there any other options?
Thanks again for your help,
On Fri, Feb 20, 2015 at 3:14 PM, Luis Machado <email@example.com> wrote:
> Hi Brendan,
> On 02/20/2015 12:27 PM, Brendan J wrote:
>> I am using GDB to debug a remote target: I start GDB then type `target
>> remote foo:1234`. I do I/O with the target via a serial port. So I
>> have to have two terminals open: one with picocom (connected to
>> something like /dev/ttyUSB0) and one with GDB (connected to OpenOCD
>> via a socket). To be clear: the debug connection is *not over the
>> serial port*, it's over a totally separate JTAG interface.
>> As you know, when you debug a "normal" (i.e. not "remote") inferior in
>> GDB, its stdin and stdout are multiplexed into GDB's TTY so that you
>> can interact with it while it's running .
>> Is it possible to achieve that for a remote target - that is: can GDB
>> connect to the serial port itself so I can do I/O with the target from
>> within the GDB session?
>> If not, is this something that might be feasible? Maybe GDB could
>> multiplex its I/O so that while the inferior is running it passes
>> characters to/from an external tool like picocom? (As you can see I'm
>> fairly ignorant about this whole issue at the moment).
>> PS: I'm using arm-none-eabi-gdb, in case that happens to be relevant.
>>  https://sourceware.org/gdb/onlinedocs/gdb/Input_002fOutput.html
> It sounds like what you want is semihosting support, an I/O operation that
> is initiated on the remote end, passing through the host and then back again
> to the remote end.
> For example, the remote program needs to read a character. In this case the
> remote debug agent issues a vFile request with the right system call, GDB
> receives it, the user enters the character via GDB and then GDB sends the
> reply back to the target. The remote program then reads the character and
> continues executing.
> You can check the documentation here:
> Check this one as well:
> This feature is only available on all-stop mode.