mirror of https://github.com/python/cpython
Issue #19743: fix test_gdb on some optimized Python builds
This commit is contained in:
parent
3ab9cfc501
commit
f6eb31fdc6
|
@ -145,7 +145,7 @@ class DebuggerTests(unittest.TestCase):
|
||||||
args += [script]
|
args += [script]
|
||||||
|
|
||||||
# print args
|
# print args
|
||||||
# print ' '.join(args)
|
# print (' '.join(args))
|
||||||
|
|
||||||
# Use "args" to invoke gdb, capturing stdout, stderr:
|
# Use "args" to invoke gdb, capturing stdout, stderr:
|
||||||
out, err = run_gdb(*args, PYTHONHASHSEED=PYTHONHASHSEED)
|
out, err = run_gdb(*args, PYTHONHASHSEED=PYTHONHASHSEED)
|
||||||
|
@ -191,6 +191,11 @@ class DebuggerTests(unittest.TestCase):
|
||||||
#
|
#
|
||||||
# For a nested structure, the first time we hit the breakpoint will
|
# For a nested structure, the first time we hit the breakpoint will
|
||||||
# give us the top-level structure
|
# give us the top-level structure
|
||||||
|
|
||||||
|
# NOTE: avoid decoding too much of the traceback as some
|
||||||
|
# undecodable characters may lurk there in optimized mode
|
||||||
|
# (issue #19743).
|
||||||
|
cmds_after_breakpoint = cmds_after_breakpoint or ["backtrace 1"]
|
||||||
gdb_output = self.get_stack_trace(source, breakpoint=BREAKPOINT_FN,
|
gdb_output = self.get_stack_trace(source, breakpoint=BREAKPOINT_FN,
|
||||||
cmds_after_breakpoint=cmds_after_breakpoint,
|
cmds_after_breakpoint=cmds_after_breakpoint,
|
||||||
import_site=import_site)
|
import_site=import_site)
|
||||||
|
@ -221,11 +226,10 @@ class PrettyPrintTests(DebuggerTests):
|
||||||
gdb_output = self.get_stack_trace('id(42)')
|
gdb_output = self.get_stack_trace('id(42)')
|
||||||
self.assertTrue(BREAKPOINT_FN in gdb_output)
|
self.assertTrue(BREAKPOINT_FN in gdb_output)
|
||||||
|
|
||||||
def assertGdbRepr(self, val, exp_repr=None, cmds_after_breakpoint=None):
|
def assertGdbRepr(self, val, exp_repr=None):
|
||||||
# Ensure that gdb's rendering of the value in a debugged process
|
# Ensure that gdb's rendering of the value in a debugged process
|
||||||
# matches repr(value) in this process:
|
# matches repr(value) in this process:
|
||||||
gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')',
|
gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')')
|
||||||
cmds_after_breakpoint)
|
|
||||||
if not exp_repr:
|
if not exp_repr:
|
||||||
exp_repr = repr(val)
|
exp_repr = repr(val)
|
||||||
self.assertEqual(gdb_repr, exp_repr,
|
self.assertEqual(gdb_repr, exp_repr,
|
||||||
|
|
Loading…
Reference in New Issue