This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remote console output


On Thu, Feb 10, 2011 at 7:15 PM, Michael Snyder <msnyder@vmware.com> wrote:
>> As I expected, the printf output is appearing on the gdbserver
>> console rather than the client gdb console. However, I was
>> wondering if there is a way to change this behaviour so that
>> any console output from the executing program appears on the
>> client gdb console. How can I do this?
>>
>> I'm sure there must be a way of doing this for debugging on
>> embedded devices that have no display?
>
> With embedded devices, you may have a standard library that
> cooperates with gdb and the gdb stub.?In that case, the printf
> function will be implemented so as to send a special "O" packet
> to gdb, containing the text to be printed.

Or you might have embedded devices, that do not have STDOUT.

> If your target is linux, you would have to modify the glibc
> version of printf.

I think it could be easier to implement a printf (or use some
#define) and link it via .o file (should have precedence over
libc.a) or re-implement what libc's printf calls, but in any case
you need to have access to a gdbserver function that sends the
special packet.

On some embedded linux, wouldn't it be possible to redirect
STDOUT somehow? pipe(..); dup2(fifofd, STDOUT_FILENO) and read+send it
often? Maybe this is a gdbserver feature (or could become one)?

oki,

Steffen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]