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]

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


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


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