How to write to stderr/stdout of debuggee

Konstantin Kharlamov Hi-Angel@yandex.ru
Mon Nov 13 18:10:04 GMT 2023


On Mon, 2023-11-13 at 10:47 -0700, Tom Tromey wrote:
> > > > > > Konstantin Kharlamov via Gdb <gdb@sourceware.org> writes:
> 
> > My usecase is I'm debugging some plugin written in Go, and I don't
> > have
> > anything language related in the visibility scope to be able to
> > write
> > to stderr/stdout. Though apparently gdb does see a `write` function
> > (which I presume is a C write function, not Go), but executing a
> 
> > 	p (int) write(2, "Hello", 6)
> 
> > gives me a `syntax error in expression`. So anyway, I'm just
> > wondering
> > if there's some built-in way to do that. I don't see a built-in
> > $_write
> > function in gdb :(
> 
> It's possible you have gdb in 'go' language mode.
> Try 'set language c' before that print.  It might help.
> 
> Tom

Haha, thanks, that worked!


More information about the Gdb mailing list