public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/12686] New: Input from user from extended breakpoint `stop' function
@ 2011-04-20  7:26 kevin.pouget at gmail dot com
  2011-07-01 13:50 ` [Bug python/12686] " kevin.pouget at gmail dot com
  2011-07-01 13:56 ` kevin.pouget at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: kevin.pouget at gmail dot com @ 2011-04-20  7:26 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12686

           Summary: Input from user from extended breakpoint `stop'
                    function
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
        AssignedTo: unassigned@sourceware.org
        ReportedBy: kevin.pouget@gmail.com


When you extend a Python breakpoint and override the `stop' function:

class MyBreakpoint (gdb.Breakpoint):
       def stop (self):
               bug = raw_input("Input ?")
               print "--> ", bug
               return True
MyBreakpoint(spec="main")

Python's `raw_input' will trigger the sending of 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 will send GDB to the background:

> (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 ()

--
From: Andreas Schwab <schwab@linux-m68k.org>
> The terminal still belongs to the inferior.  Before gdb is doing any
> input it must call terminal_ours.

http://sourceware.org/ml/gdb/2011-04/msg00099.html

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug python/12686] Input from user from extended breakpoint `stop' function
  2011-04-20  7:26 [Bug python/12686] New: Input from user from extended breakpoint `stop' function kevin.pouget at gmail dot com
@ 2011-07-01 13:50 ` kevin.pouget at gmail dot com
  2011-07-01 13:56 ` kevin.pouget at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: kevin.pouget at gmail dot com @ 2011-07-01 13:50 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12686

Kevin Pouget <kevin.pouget at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kevin.pouget at gmail dot
                   |                            |com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug python/12686] Input from user from extended breakpoint `stop' function
  2011-04-20  7:26 [Bug python/12686] New: Input from user from extended breakpoint `stop' function kevin.pouget at gmail dot com
  2011-07-01 13:50 ` [Bug python/12686] " kevin.pouget at gmail dot com
@ 2011-07-01 13:56 ` kevin.pouget at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: kevin.pouget at gmail dot com @ 2011-07-01 13:56 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12686

--- Comment #1 from Kevin Pouget <kevin.pouget at gmail dot com> 2011-07-01 13:55:42 UTC ---
http://sourceware.org/ml/gdb-patches/2011-04/msg00373.html
On Wed, Apr 20, 2011 at 9:32 PM, Tom Tromey <tromey@redhat.com> wrote:
> I'm not really sure of the implications

changing the "terminal ownership" during the gdb.Breakpoint::stop callback can
lead GDB to a freeze:

=================================

kevin@kevin:/tmp$ cat sleeper.c 
int main(){
    sleep(50);
}

=================================

kevin@kevin:/tmp$ cat sleeper-gdb.py 
class test(gdb.Breakpoint):
    def stop(self):
        import pdb;pdb.set_trace()
        return False

test("sleep")

=================================

gdb-git-master ./sleeper -nx
GNU gdb (GDB) 7.3.50.20110701-cvs
Breakpoint 1 at 0x4003c8
(gdb) run
Starting program: /tmp/sleeper 
> /tmp/sleeper-gdb.py(4)stop()
-> return False
(Pdb) 
[1]+  Stopped                 gdb-git-master ./sleeper -nx
kevin@kevin:/tmp$ fg
gdb-git-master ./sleeper -nx

(Pdb) c

============ frozen =============

#0  0x00007fcb1f59262a in sigsuspend () from /lib64/libc.so.6
#1  0x000000000049ec84 in linux_nat_wait_1 (ops=<optimized out>, ptid=...,
ourstatus=0x7fff88c02220, target_options=0) at
../../../srcs/git/gdb-fsf/gdb/linux-nat.c:3616
#2  0x000000000049f98c in linux_nat_wait (ops=0x1b434b0, ptid=...,
ourstatus=0x7fff88c02220, target_options=0) at
../../../srcs/git/gdb-fsf/gdb/linux-nat.c:3833
#3  0x0000000000586afc in target_wait (ptid=..., status=0x7fff88c02220,
options=<optimized out>) at ../../../srcs/git/gdb-fsf/gdb/target.c:2534
#4  0x000000000055778a in wait_for_inferior () at
../../../srcs/git/gdb-fsf/gdb/infrun.c:2670
#5  0x0000000000557a4b in proceed (addr=<optimized out>,
siggnal=TARGET_SIGNAL_0, step=0) at ../../../srcs/git/gdb-fsf/gdb/infrun.c:2236
#6  0x000000000054b91f in run_command_1 (args=0x0, from_tty=1,
tbreak_at_main=<optimized out>) at ../../../srcs/git/gdb-fsf/gdb/infcmd.c:602
#7  0x000000000045c685 in execute_command (p=0x1b0f151 "", from_tty=1) at
../../../srcs/git/gdb-fsf/gdb/top.c:438
#8  0x0000000000568618 in command_handler (command=0x1b0f150 "") at
../../../srcs/git/gdb-fsf/gdb/event-top.c:499
#9  0x000000000056908c in command_line_handler (rl=<optimized out>) at
../../../srcs/git/gdb-fsf/gdb/event-top.c:702
#10 0x00000000006413f9 in rl_callback_read_char () at
../../../srcs/git/gdb-fsf/readline/callback.c:220
#11 0x0000000000568689 in rl_callback_read_char_wrapper (client_data=<optimized
out>) at ../../../srcs/git/gdb-fsf/gdb/event-top.c:177
#12 0x0000000000567528 in process_event () at
../../../srcs/git/gdb-fsf/gdb/event-loop.c:402
#13 process_event () at ../../../srcs/git/gdb-fsf/gdb/event-loop.c:352
#14 0x0000000000567c68 in gdb_do_one_event (data=<optimized out>) at
../../../srcs/git/gdb-fsf/gdb/event-loop.c:467
#15 gdb_do_one_event (data=<optimized out>) at
../../../srcs/git/gdb-fsf/gdb/event-loop.c:417
...

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-01 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20  7:26 [Bug python/12686] New: Input from user from extended breakpoint `stop' function kevin.pouget at gmail dot com
2011-07-01 13:50 ` [Bug python/12686] " kevin.pouget at gmail dot com
2011-07-01 13:56 ` kevin.pouget at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).