1 """
2 Similar to test_cfunction but test "py-bt-full" command.
3 """
4
5 import re
6
7 from .util import setup_module
8 from .test_cfunction import CFunctionTests
9
10
11 def setUpModule():
12 setup_module()
13
14
15 class ESC[4;38;5;81mCFunctionFullTests(ESC[4;38;5;149mCFunctionTests):
16 def check(self, func_name, cmd):
17 # Verify with "py-bt-full":
18 gdb_output = self.get_stack_trace(
19 cmd,
20 breakpoint=func_name,
21 cmds_after_breakpoint=['bt', 'py-bt-full'],
22 # bpo-45207: Ignore 'Function "meth_varargs" not
23 # defined.' message in stderr.
24 ignore_stderr=True,
25 )
26
27 # bpo-46600: If the compiler inlines _null_to_none() in
28 # meth_varargs() (ex: clang -Og), _null_to_none() is the
29 # frame #1. Otherwise, meth_varargs() is the frame #1.
30 regex = r'#(1|2)'
31 regex += re.escape(f' <built-in method {func_name}')
32 self.assertRegex(gdb_output, regex)
33
34
35 # Delete the test case, otherwise it's executed twice
36 del CFunctionTests