* Building gdb frontend
@ 2012-09-07 10:36 Johannes Bauer
2012-09-07 10:46 ` Pedro Alves
2012-09-07 16:42 ` Andrew Burgess
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Bauer @ 2012-09-07 10:36 UTC (permalink / raw)
To: gdb
Hi list,
I'm having a strange issue with gdb. Currently I'm building a frontend
for gdb to augment its features easily. It uses Python and forks a gdb
subprocess that it communicates over stdin/stdout.
This all works nice and well, but sometimes it locks up. The frontend
always waits to see a terminated line and then the prompt "(gdb) ". So
for example, if I send "p" without arguments, usually the response will
be (calling read with a 1024 bytes buffer):
b'The history is empty.'
b'\n'
b'(gdb) '
At which I know gdb is ready to receive another command. However,
sometimes the order of these messages is messed up and reception happens
like this:
b'The history is empty.'
b'(gdb) '
b'\n'
So that my frontend waits for the prompt (because it sees "The history
is empty.(gdb) " as one line).
When I change the reading buffer to minimum size 1, the results become
even more unpredictable:
b'('
b'The history is empty.\n'
b'g'
b'd'
b'b'
b')'
b' '
i.e. "(The history is empty.\n" and "gdb) ", which also leads to a lockup.
There seems to be some kind of concurrency/buffering issue here. Is
there a way to solve this? Is there a preferred way to talk to gdb in a
"machine-readable" friendly way so I know exactly when gdb is ready to
receive commands again?
Best regards,
Johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Building gdb frontend
2012-09-07 10:36 Building gdb frontend Johannes Bauer
@ 2012-09-07 10:46 ` Pedro Alves
2012-09-07 11:05 ` Johannes Bauer
2012-09-07 16:42 ` Andrew Burgess
1 sibling, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2012-09-07 10:46 UTC (permalink / raw)
To: Johannes Bauer; +Cc: gdb
On 09/07/2012 11:36 AM, Johannes Bauer wrote:
> Is there a preferred way to talk to gdb in a
> "machine-readable" friendly way so I know exactly when gdb is ready to
> receive commands again?
See "The gdb/mi Interface" in the manual.
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Building gdb frontend
2012-09-07 10:46 ` Pedro Alves
@ 2012-09-07 11:05 ` Johannes Bauer
0 siblings, 0 replies; 4+ messages in thread
From: Johannes Bauer @ 2012-09-07 11:05 UTC (permalink / raw)
To: gdb; +Cc: palves
On 07.09.2012 12:45, Pedro Alves wrote:
> On 09/07/2012 11:36 AM, Johannes Bauer wrote:
>> Is there a preferred way to talk to gdb in a
>> "machine-readable" friendly way so I know exactly when gdb is ready to
>> receive commands again?
>
> See "The gdb/mi Interface" in the manual.
Aaaahhhh! This is *beautiful*. Even better than what I hoped for. This
will work out nicely, a first test shows that it works perfectly.
Thank you very much,
Best regards,
Johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Building gdb frontend
2012-09-07 10:36 Building gdb frontend Johannes Bauer
2012-09-07 10:46 ` Pedro Alves
@ 2012-09-07 16:42 ` Andrew Burgess
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Burgess @ 2012-09-07 16:42 UTC (permalink / raw)
To: gdb
On 07/09/2012 11:36 AM, Johannes Bauer wrote:
> I'm having a strange issue with gdb. Currently I'm building a frontend
> for gdb to augment its features easily. It uses Python and forks a gdb
> subprocess that it communicates over stdin/stdout.
You may already be aware of this, forgive me if I'm telling you
something you already know...
gdb has python scripting support built in, see,
http://sourceware.org/gdb/current/onlinedocs/gdb/Python.html#Python
so you /might/ be able to achieve the augmentation you are aiming for by
writing python scripts that are loaded into gdb.
Cheers,
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-07 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 10:36 Building gdb frontend Johannes Bauer
2012-09-07 10:46 ` Pedro Alves
2012-09-07 11:05 ` Johannes Bauer
2012-09-07 16:42 ` Andrew Burgess
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).