mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-18 05:12:33 +08:00
Throw a "quit" on a KeyboardException in py-framefilter.c
If a C-c comes while the Python code for a frame filter is running, it will be turned into a Python KeyboardException. It seems good for this to be treated like a GDB quit, so this patch changes py-framefilter.c to notice this situation and call throw_quit in this case. gdb/ChangeLog 2018-03-26 Tom Tromey <tom@tromey.com> * python/py-framefilter.c (throw_quit_or_print_exception): New function. (gdbpy_apply_frame_filter): Use it. gdb/testsuite/ChangeLog 2018-03-26 Tom Tromey <tom@tromey.com> * gdb.python/py-framefilter.exp: Add test for KeyboardInterrupt. * gdb.python/py-framefilter.py (name_error): New global. (ErrorInName.function): Use name_error.
This commit is contained in:
@ -213,6 +213,12 @@ gdb_test_multiple "bt 1" $test {
|
||||
}
|
||||
}
|
||||
|
||||
# Now verify that we can see a quit.
|
||||
gdb_test_no_output "python name_error = KeyboardInterrupt" \
|
||||
"Change ErrorFilter to throw KeyboardInterrupt"
|
||||
gdb_test "bt 1" "Quit" "bt 1 with KeyboardInterrupt"
|
||||
|
||||
|
||||
# Test with no debuginfo
|
||||
|
||||
# We cannot use prepare_for_testing as we have to set the safe-patch
|
||||
|
@ -134,13 +134,17 @@ class FrameElider ():
|
||||
def filter (self, frame_iter):
|
||||
return ElidingIterator (frame_iter)
|
||||
|
||||
# This is here so the test can change the kind of error that is
|
||||
# thrown.
|
||||
name_error = RuntimeError
|
||||
|
||||
# A simple decorator that gives an error when computing the function.
|
||||
class ErrorInName(FrameDecorator):
|
||||
def __init__(self, frame):
|
||||
FrameDecorator.__init__(self, frame)
|
||||
|
||||
def function(self):
|
||||
raise RuntimeError('whoops')
|
||||
raise name_error('whoops')
|
||||
|
||||
# A filter that supplies buggy frames. Disabled by default.
|
||||
class ErrorFilter():
|
||||
|
Reference in New Issue
Block a user