public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* mi, new-ui and the target
@ 2024-05-04 19:55 Bob Rossi
  2024-05-06 19:16 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Bob Rossi @ 2024-05-04 19:55 UTC (permalink / raw)
  To: gdb

Hi,

I maintain cgdb, a curses based front end to gdb.
I got a bug report here,
  https://github.com/cgdb/cgdb/issues/352
that i'm trying to resolve.

In one terminal i run
    valgrind --vgdb-error=0 ./main.

In another terminal i run
    gdb --ex "new-ui mi /dev/pts/12" --ex 'target remote | vgdb'
From a 3rd terminal i run 'tty' to get /dev/pts/12.

Now, when i run 'monitor help' from the gdb terminal, i get this:
    (gdb) monitor help
    (gdb) 
please note the second prompt displayed by gdb.

In the third terminal, represented by /dev/pts/12, i see the proper
valgrind output. For instance,
  @"general valgrind monitor commands:\n"
  ....
  @"\n"
please note, it does not end with a (gdb) prompt or with ^done.

My issue is as follows. When i try to take the target output specified
by @ and display it in the gdb window within cgdb, gdb decides to print
to stdout it's primpt (gdb), in the middle of the target output.
So I end up with the prompt randomely in the middle of the target
output and not at the end.

Is there any way to synchronize this text properly?

Please remember the point of the new-ui feature is to allow the user to
type the commands they want, and have the front end run the commands it
wants, in these should work together in a natural way.

Thanks,
Bob Rossi

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

* Re: mi, new-ui and the target
  2024-05-04 19:55 mi, new-ui and the target Bob Rossi
@ 2024-05-06 19:16 ` Tom Tromey
  2024-05-17 19:12   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2024-05-06 19:16 UTC (permalink / raw)
  To: Bob Rossi; +Cc: gdb

>>>>> "Bob" == Bob Rossi <bob@brasko.net> writes:

Bob> My issue is as follows. When i try to take the target output specified
Bob> by @ and display it in the gdb window within cgdb, gdb decides to print
Bob> to stdout it's primpt (gdb), in the middle of the target output.
Bob> So I end up with the prompt randomely in the middle of the target
Bob> output and not at the end.

Bob> Is there any way to synchronize this text properly?

Bob> Please remember the point of the new-ui feature is to allow the user to
Bob> type the commands they want, and have the front end run the commands it
Bob> wants, in these should work together in a natural way.

This appears to be a bug in new-ui.

In particular, mi_interp::resume sets gdb_stdtarg but nothing ever
resets it in this scenario.

Could you file a bug report for this?

I don't know how this code is really supposed to work.
Maybe gdb_stdtarg* all have to be macros like gdb_stdout et al.

Or maybe some command executor somewhere should resume the tty's
interpreter before invoking the command.

I don't really understand the design of the ui/interpreter code.  To me
it seems a lot more convoluted than is really desirable or necessary.

Tom

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

* Re: mi, new-ui and the target
  2024-05-06 19:16 ` Tom Tromey
@ 2024-05-17 19:12   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2024-05-17 19:12 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Bob Rossi, gdb

Tom> In particular, mi_interp::resume sets gdb_stdtarg but nothing ever
Tom> resets it in this scenario.

Tom> Could you file a bug report for this?

I have a patch for this, but as always, writing the test is a lot harder
than writing the patch itself.  So it might be a while before I send it.

Tom

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

end of thread, other threads:[~2024-05-17 19:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-04 19:55 mi, new-ui and the target Bob Rossi
2024-05-06 19:16 ` Tom Tromey
2024-05-17 19:12   ` Tom Tromey

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