This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [Python] Input from user from extended breakpoint `stop' function
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Kevin Pouget <kevin dot pouget at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Tue, 19 Apr 2011 21:10:16 +0100
- Subject: Re: [Python] Input from user from extended breakpoint `stop' function
- References: <BANLkTimrLOuWZSsA8t315wRAhzxNPKkFVA@mail.gmail.com>
- Reply-to: pmuldoon at redhat dot com
Kevin Pouget <kevin.pouget@gmail.com> writes:
> Hello,
>
> is there any function provided by GDB to read from the terminal ?
> (I still don't know much about Python)
Nope, but in the context of this bug there might need to be. GDB does a
few things with stdout/tty.
> I'm facing a problem when I was to ask a question the user from an
> extended breakpoint `stop' function: try
>
> class MyBreakpoint (gdb.Breakpoint):
> def stop (self):
> bug = raw_input("Input ?")
> print "--> ", bug
> return True
> MyBreakpoint(spec="main")
>
>
> and you will see this output:
>
>> (gdb) source sigttin.py
>> Breakpoint 1 at 0x400579
>> (gdb) r
>> Starting program: /home/kevin/a.out
>> Input ?
>> [1]+ Stopped gdb-git a.out
>> kevin@kevin:~$ fg
>> gdb-git a.out
>> hello
>> --> hello
>> Breakpoint 1, 0x0000000000400579 in main ()
>
> because GDB receives a SIGTTIN ("SIGTTIN is the signal sent to a
> process when it attempts to read from the tty while in the
> background." says wikipedia), which somehow makes sense.
I'm not sure what is going on here. It seems GDB is not acting
correctly with the SIGTTIN. I really do not know this area of GDB at
all.
> Any solution, or shall I send a bug report?
Bug report please.
Cheers,
Phil