Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* python-interactive, and quitting gdb pagination
@ 2012-08-23 17:07 Pedro Alves
  2012-08-23 17:32 ` Khoo Yit Phang
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2012-08-23 17:07 UTC (permalink / raw)
  To: Khoo Yit Phang, GDB Patches

FYI, I just tried playing with this a little, and stumbled on:

(gdb) python-interactive
>>> help (gdb)
Help on package gdb:
...
...
...
        TypeIterator
        Value
    exceptions.Exception(exceptions.BaseException)
        GdbError
---Type <return> to continue, or q <return> to quit---q
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site.py", line 471, in __call__
    return pydoc.help(*args, **kwds)
  File "/usr/lib64/python2.7/pydoc.py", line 1744, in __call__
    self.help(request)
  File "/usr/lib64/python2.7/pydoc.py", line 1791, in help
    else: doc(request, 'Help on %s:')
  File "/usr/lib64/python2.7/pydoc.py", line 1528, in doc
    pager(render_doc(thing, title, forceload))
  File "/usr/lib64/python2.7/pydoc.py", line 1432, in plainpager
    sys.stdout.write(plain(text))
  File "<string>", line 13, in write
KeyboardInterrupt: Quit
>>>

That traceback surprised me, but maybe it's expected.

-- 
Pedro Alves


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

* Re: python-interactive, and quitting gdb pagination
  2012-08-23 17:07 python-interactive, and quitting gdb pagination Pedro Alves
@ 2012-08-23 17:32 ` Khoo Yit Phang
  2012-09-10 20:07   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Khoo Yit Phang @ 2012-08-23 17:32 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Khoo Yit Phang, GDB Patches

Hi,


On Aug 23, 2012, at 1:07 PM, Pedro Alves wrote:

> FYI, I just tried playing with this a little, and stumbled on:
> 
> (gdb) python-interactive
>>>> help (gdb)
> Help on package gdb:
> ...
> ...
> ...
>        TypeIterator
>        Value
>    exceptions.Exception(exceptions.BaseException)
>        GdbError
> ---Type <return> to continue, or q <return> to quit---q
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/usr/lib64/python2.7/site.py", line 471, in __call__
>    return pydoc.help(*args, **kwds)
>  File "/usr/lib64/python2.7/pydoc.py", line 1744, in __call__
>    self.help(request)
>  File "/usr/lib64/python2.7/pydoc.py", line 1791, in help
>    else: doc(request, 'Help on %s:')
>  File "/usr/lib64/python2.7/pydoc.py", line 1528, in doc
>    pager(render_doc(thing, title, forceload))
>  File "/usr/lib64/python2.7/pydoc.py", line 1432, in plainpager
>    sys.stdout.write(plain(text))
>  File "<string>", line 13, in write
> KeyboardInterrupt: Quit
> 
> That traceback surprised me, but maybe it's expected.

Hmm, this happens because quitting from GDB's pager happens to raise the same error reason, RETURN_QUIT, as typing Ctrl-C, i.e., quitting from the pager looks exactly like Ctrl-C. I'm not quite sure what the best way to fix this is; perhaps disable the pager while in Python? Python's "help" runs a pager too, but I think it's disabled because stdin/stdout is redirected through GDB. Or alternatively, perhaps somehow differentiate quitting from the pager or quitting from Ctrl-C, e.g., with a different error.message?

Yit
August 23, 2012


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

* Re: python-interactive, and quitting gdb pagination
  2012-08-23 17:32 ` Khoo Yit Phang
@ 2012-09-10 20:07   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2012-09-10 20:07 UTC (permalink / raw)
  To: Khoo Yit Phang; +Cc: Pedro Alves, GDB Patches

>>>>> "Yit" == Khoo Yit Phang <khooyp@cs.umd.edu> writes:

Yit> Hmm, this happens because quitting from GDB's pager happens to raise
Yit> the same error reason, RETURN_QUIT, as typing Ctrl-C, i.e., quitting
Yit> from the pager looks exactly like Ctrl-C. I'm not quite sure what the
Yit> best way to fix this is; perhaps disable the pager while in Python?
Yit> Python's "help" runs a pager too, but I think it's disabled because
Yit> stdin/stdout is redirected through GDB. Or alternatively, perhaps
Yit> somehow differentiate quitting from the pager or quitting from Ctrl-C,
Yit> e.g., with a different error.message?

Having Python use the pager is kind of a feature.  It lets one write gdb
commands in Python that work like other gdb commands.

I suppose we could provide a way to bypass the pager.
Doing so during python-interactive might make sense, though I am not
sure.

Tom


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

end of thread, other threads:[~2012-09-10 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-23 17:07 python-interactive, and quitting gdb pagination Pedro Alves
2012-08-23 17:32 ` Khoo Yit Phang
2012-09-10 20:07   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox