This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: controlling gdb via python's pexpect
- From: Gaius Mulley <gaius at glam dot ac dot uk>
- To: George Russell <george at codeplay dot com>
- Cc: fpga <mgbg25171 at blueyonder dot co dot uk>, gdb at sourceware dot org
- Date: Fri, 06 Nov 2009 10:28:24 +0000
- Subject: Re: controlling gdb via python's pexpect
- References: <26221261.post@talk.nabble.com> <4AF336E4.5000002@codeplay.com>
George Russell <george@codeplay.com> writes:
> fpga wrote:
>> Can someone please give me an example of how this is done.
>> I'm afraid the documentation is not helping me.
>> Thx
>>
> Hi,
>
> I have had some success in controlling GDB (via MI) from python, using
> the subprocess module and communicating with GDB via
> pipes. (http://docs.python.org/library/subprocess.html)
>
> The main issue so far is that some applications detect when they are
> running with pipes instead of a terminal for output, and buffer
> program output by block rather than line as on a terminal, leading to
> delays in receiving program output issued via printf, for example,
> unless it is followed by an explicit fflush call.
>
> (I too would be interested in an example of using pexpect to control GDB)
> Cheers,
> George Russell
Hi,
for what it is worth feel free to download
http://floppsie.comp.glam.ac.uk/download/python/twingdb.tar.gz
which was written to run two gdb's debugging a stage1 and stage2
generation of a compiler and single step until a line number differs.
It is written in Python and uses pexpect
The code is very alpha - but it worked well enough to find the bug I
was hunting.
regards,
Gaius