This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]