public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* How to write to stderr/stdout of debuggee
@ 2023-11-10 15:06 Konstantin Kharlamov
  2023-11-13 17:47 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Kharlamov @ 2023-11-10 15:06 UTC (permalink / raw)
  To: gdb

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 :(

P.S.: please keep me in CC, I'm not a list subscriber

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

* Re: How to write to stderr/stdout of debuggee
  2023-11-10 15:06 How to write to stderr/stdout of debuggee Konstantin Kharlamov
@ 2023-11-13 17:47 ` Tom Tromey
  2023-11-13 18:10   ` Konstantin Kharlamov
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2023-11-13 17:47 UTC (permalink / raw)
  To: Konstantin Kharlamov via Gdb; +Cc: Konstantin Kharlamov

>>>>> 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

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

* Re: How to write to stderr/stdout of debuggee
  2023-11-13 17:47 ` Tom Tromey
@ 2023-11-13 18:10   ` Konstantin Kharlamov
  0 siblings, 0 replies; 3+ messages in thread
From: Konstantin Kharlamov @ 2023-11-13 18:10 UTC (permalink / raw)
  To: Tom Tromey, Konstantin Kharlamov via Gdb

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!

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

end of thread, other threads:[~2023-11-13 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-10 15:06 How to write to stderr/stdout of debuggee Konstantin Kharlamov
2023-11-13 17:47 ` Tom Tromey
2023-11-13 18:10   ` Konstantin Kharlamov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).