This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
[Python] Input from user from extended breakpoint `stop' function
- From: Kevin Pouget <kevin dot pouget at gmail dot com>
- To: gdb at sourceware dot org
- Cc: pmuldoon at redhat dot com
- Date: Tue, 19 Apr 2011 10:41:30 -0400
- Subject: [Python] Input from user from extended breakpoint `stop' function
Hello,
is there any function provided by GDB to read from the terminal ?
(I still don't know much about Python)
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.
Any solution, or shall I send a bug report?
cordially,
Kevin