[Python] Input from user from extended breakpoint `stop' function

Kevin Pouget kevin.pouget@gmail.com
Tue Apr 19 14:42:00 GMT 2011


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

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?



More information about the Gdb mailing list