mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Merged revisions 80288 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80288 | victor.stinner | 2010-04-21 00:28:31 +0200 (mer., 21 avril 2010) | 2 lines Issue #8437: Fix test_gdb failures, patch written by Dave Malcolm ........
This commit is contained in:
parent
5e2be8737d
commit
50eb60e6bf
3 changed files with 35 additions and 14 deletions
|
@ -31,6 +31,19 @@ gdbpy_version, _ = p.communicate()
|
||||||
if gdbpy_version == b'':
|
if gdbpy_version == b'':
|
||||||
raise unittest.SkipTest("gdb not built with embedded python support")
|
raise unittest.SkipTest("gdb not built with embedded python support")
|
||||||
|
|
||||||
|
def gdb_has_frame_select():
|
||||||
|
# Does this build of gdb have gdb.Frame.select ?
|
||||||
|
cmd = "--eval-command=python print(dir(gdb.Frame))"
|
||||||
|
p = subprocess.Popen(["gdb", "--batch", cmd],
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
stdout, _ = p.communicate()
|
||||||
|
m = re.match(br'.*\[(.*)\].*', stdout)
|
||||||
|
if not m:
|
||||||
|
raise unittest.SkipTest("Unable to parse output from gdb.Frame.select test")
|
||||||
|
gdb_frame_dir = m.group(1).split(b', ')
|
||||||
|
return b"'select'" in gdb_frame_dir
|
||||||
|
|
||||||
|
HAS_PYUP_PYDOWN = gdb_has_frame_select()
|
||||||
|
|
||||||
class DebuggerTests(unittest.TestCase):
|
class DebuggerTests(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -554,6 +567,7 @@ class PyListTests(DebuggerTests):
|
||||||
bt)
|
bt)
|
||||||
|
|
||||||
class StackNavigationTests(DebuggerTests):
|
class StackNavigationTests(DebuggerTests):
|
||||||
|
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
|
||||||
def test_pyup_command(self):
|
def test_pyup_command(self):
|
||||||
'Verify that the "py-up" command works'
|
'Verify that the "py-up" command works'
|
||||||
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
||||||
|
@ -564,6 +578,7 @@ class StackNavigationTests(DebuggerTests):
|
||||||
baz\(a, b, c\)
|
baz\(a, b, c\)
|
||||||
$''')
|
$''')
|
||||||
|
|
||||||
|
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
|
||||||
def test_down_at_bottom(self):
|
def test_down_at_bottom(self):
|
||||||
'Verify handling of "py-down" at the bottom of the stack'
|
'Verify handling of "py-down" at the bottom of the stack'
|
||||||
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
||||||
|
@ -571,6 +586,7 @@ $''')
|
||||||
self.assertEndsWith(bt,
|
self.assertEndsWith(bt,
|
||||||
'Unable to find a newer python frame\n')
|
'Unable to find a newer python frame\n')
|
||||||
|
|
||||||
|
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
|
||||||
def test_up_at_top(self):
|
def test_up_at_top(self):
|
||||||
'Verify handling of "py-up" at the top of the stack'
|
'Verify handling of "py-up" at the top of the stack'
|
||||||
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
||||||
|
@ -578,6 +594,7 @@ $''')
|
||||||
self.assertEndsWith(bt,
|
self.assertEndsWith(bt,
|
||||||
'Unable to find an older python frame\n')
|
'Unable to find an older python frame\n')
|
||||||
|
|
||||||
|
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
|
||||||
def test_up_then_down(self):
|
def test_up_then_down(self):
|
||||||
'Verify "py-up" followed by "py-down"'
|
'Verify "py-up" followed by "py-down"'
|
||||||
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
||||||
|
@ -613,6 +630,7 @@ class PyPrintTests(DebuggerTests):
|
||||||
self.assertMultilineMatches(bt,
|
self.assertMultilineMatches(bt,
|
||||||
r".*\nlocal 'args' = \(1, 2, 3\)\n.*")
|
r".*\nlocal 'args' = \(1, 2, 3\)\n.*")
|
||||||
|
|
||||||
|
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
|
||||||
def test_print_after_up(self):
|
def test_print_after_up(self):
|
||||||
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
||||||
cmds_after_breakpoint=['py-up', 'py-print c', 'py-print b', 'py-print a'])
|
cmds_after_breakpoint=['py-up', 'py-print c', 'py-print b', 'py-print a'])
|
||||||
|
@ -638,6 +656,7 @@ class PyLocalsTests(DebuggerTests):
|
||||||
self.assertMultilineMatches(bt,
|
self.assertMultilineMatches(bt,
|
||||||
r".*\nargs = \(1, 2, 3\)\n.*")
|
r".*\nargs = \(1, 2, 3\)\n.*")
|
||||||
|
|
||||||
|
@unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
|
||||||
def test_locals_after_up(self):
|
def test_locals_after_up(self):
|
||||||
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
|
||||||
cmds_after_breakpoint=['py-up', 'py-locals'])
|
cmds_after_breakpoint=['py-up', 'py-locals'])
|
||||||
|
|
|
@ -318,6 +318,8 @@ C-API
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #8437: Fix test_gdb failures, patch written by Dave Malcolm
|
||||||
|
|
||||||
- Issue #6547: Added the ignore_dangling_symlinks option to shutil.copytree.
|
- Issue #6547: Added the ignore_dangling_symlinks option to shutil.copytree.
|
||||||
|
|
||||||
- Issue #1540112: Now allowing the choice of a copy function in
|
- Issue #1540112: Now allowing the choice of a copy function in
|
||||||
|
|
|
@ -1133,8 +1133,7 @@ class Frame(object):
|
||||||
return index
|
return index
|
||||||
|
|
||||||
def is_evalframeex(self):
|
def is_evalframeex(self):
|
||||||
if self._gdbframe.function():
|
if self._gdbframe.name() == 'PyEval_EvalFrameEx':
|
||||||
if self._gdbframe.function().name == 'PyEval_EvalFrameEx':
|
|
||||||
'''
|
'''
|
||||||
I believe we also need to filter on the inline
|
I believe we also need to filter on the inline
|
||||||
struct frame_id.inline_depth, only regarding frames with
|
struct frame_id.inline_depth, only regarding frames with
|
||||||
|
@ -1294,8 +1293,6 @@ class PyUp(gdb.Command):
|
||||||
def invoke(self, args, from_tty):
|
def invoke(self, args, from_tty):
|
||||||
move_in_stack(move_up=True)
|
move_in_stack(move_up=True)
|
||||||
|
|
||||||
PyUp()
|
|
||||||
|
|
||||||
class PyDown(gdb.Command):
|
class PyDown(gdb.Command):
|
||||||
'Select and print the python stack frame called by this one (if any)'
|
'Select and print the python stack frame called by this one (if any)'
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -1308,6 +1305,9 @@ class PyDown(gdb.Command):
|
||||||
def invoke(self, args, from_tty):
|
def invoke(self, args, from_tty):
|
||||||
move_in_stack(move_up=False)
|
move_in_stack(move_up=False)
|
||||||
|
|
||||||
|
# Not all builds of gdb have gdb.Frame.select
|
||||||
|
if hasattr(gdb.Frame, 'select'):
|
||||||
|
PyUp()
|
||||||
PyDown()
|
PyDown()
|
||||||
|
|
||||||
class PyBacktrace(gdb.Command):
|
class PyBacktrace(gdb.Command):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue