@@ -162,7 +162,11 @@ def get_stack_trace(self, source=None, script=None, |
|
|
162 |
162 |
commands += ['set print entry-values no'] |
163 |
163 |
|
164 |
164 |
if cmds_after_breakpoint: |
165 |
|
-commands += cmds_after_breakpoint |
|
165 |
+# bpo-32962: When Python is compiled with -mcet -fcf-protection, |
|
166 |
+# arguments are unusable before running the first instruction |
|
167 |
+# of the function entry point. The 'next' command makes the |
|
168 |
+# required first step. |
|
169 |
+commands += ['next'] + cmds_after_breakpoint |
166 |
170 |
else: |
167 |
171 |
commands += ['backtrace'] |
168 |
172 |
|
@@ -847,9 +851,12 @@ def __init__(self): |
|
|
847 |
851 |
id("first break point") |
848 |
852 |
l = MyList() |
849 |
853 |
''') |
|
854 |
+# bpo-32962: same case as in get_stack_trace(): |
|
855 |
+# we need an additional 'next' command in order to read |
|
856 |
+# arguments of the innermost function of the call stack. |
850 |
857 |
# Verify with "py-bt": |
851 |
858 |
gdb_output = self.get_stack_trace(cmd, |
852 |
|
-cmds_after_breakpoint=['break wrapper_call', 'continue', 'py-bt']) |
|
859 |
+cmds_after_breakpoint=['break wrapper_call', 'continue', 'next', 'py-bt']) |
853 |
860 |
self.assertRegex(gdb_output, |
854 |
861 |
r"<method-wrapper u?'__init__' of MyList object at ") |
855 |
862 |
|