bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0#6754
Conversation
|
Reminder for reviewers: test_gdb is not run on Travis CI. Tests must be run manually before merging such change. |
|
Also in order to test the change, gcc >= 8 is required. |
-mcet -fcf-protection -O0…H-6754) When Python is built with the intel control-flow protection flags, -mcet -fcf-protection, gdb is not able to read the stack without actually jumping inside the function. This means an extra 'next' command is required to make the $pc (program counter) enter the function and make the stack of the function exposed to gdb.
Lib/test/test_gdb.py
Outdated
| # ignore all warnings | ||
| 'warning: ', | ||
| # See #32962 | ||
| 'Python Exception', |
There was a problem hiding this comment.
Hum, this is not a good idea to ignore bugs :-( Please revert this change.
My #7693 should fix this bug.
|
|
||
| if cmds_after_breakpoint: | ||
| commands += cmds_after_breakpoint | ||
| commands += ['next'] + cmds_after_breakpoint |
There was a problem hiding this comment.
Please add a comment explaining why next is needed. Something like:
# bpo-32962: When Python is compiled with -mcet -fcf-protection,
# arguments are unusable before running the first instruction
# of the function entry point.
| # Verify with "py-bt": | ||
| gdb_output = self.get_stack_trace(cmd, | ||
| cmds_after_breakpoint=['break wrapper_call', 'continue', 'py-bt']) | ||
| cmds_after_breakpoint=['break wrapper_call', 'continue', 'next', 'py-bt']) |
vstinner
left a comment
There was a problem hiding this comment.
LGTM, just two minor remarks on comments.
Lib/test/test_gdb.py
Outdated
|
|
||
| # bpo-32962: When Python is compiled with -mcet -fcf-protection, | ||
| # arguments are unusable before running the first instruction | ||
| # of the function entry point. Next makes the required first step. |
There was a problem hiding this comment.
Would you mind to replace Next with >The 'next' command< to make it more explicit?
Move also the comment inside the if block.
Lib/test/test_gdb.py
Outdated
| l = MyList() | ||
| ''') | ||
| # bpo-32962: same case as in get_stack_trace(): | ||
| # we need one extra step in order to read arguments |
There was a problem hiding this comment.
Replace "we need one extra step" with "we need 'next' extra command".
|
@vstinner: Please replace |
…H-7710) * bpo-32962: python-gdb catchs ValueError on read_var() (GH-7692) python-gdb now catchs ValueError on read_var(): when Python has no debug symbols for example. (cherry picked from commit 019d33b) * bpo-32962: python-gdb catchs UnicodeDecodeError (GH-7693) python-gdb now catchs UnicodeDecodeError exceptions when calling string(). (cherry picked from commit d22fc0b) * bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0 (GH-6754) When Python is built with the intel control-flow protection flags, -mcet -fcf-protection, gdb is not able to read the stack without actually jumping inside the function. This means an extra 'next' command is required to make the $pc (program counter) enter the function and make the stack of the function exposed to gdb. (cherry picked from commit 9b7c74c)
… (GH-7711) * bpo-32962: python-gdb catchs ValueError on read_var() (GH-7692) python-gdb now catchs ValueError on read_var(): when Python has no debug symbols for example. (cherry picked from commit 019d33b) * bpo-32962: python-gdb catchs UnicodeDecodeError (GH-7693) python-gdb now catchs UnicodeDecodeError exceptions when calling string(). (cherry picked from commit d22fc0b) * bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0 (GH-6754) When Python is built with the intel control-flow protection flags, -mcet -fcf-protection, gdb is not able to read the stack without actually jumping inside the function. This means an extra 'next' command is required to make the $pc (program counter) enter the function and make the stack of the function exposed to gdb. (cherry picked from commit 9b7c74c) (cherry picked from commit ca4cb84)
|
@Traceur759: I'm sorry, I had to revert this change because it caused failures on two buildbots: |
This pull request solves problem with reading stack of the interpreter from gdb when new protection flags are used.
The new flags also cause some noise, which is now ignored, on stderr.
https://bugs.python.org/issue32962