-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_gdb should better detect when Python is optimized #84200
Comments
On my PR 19077 which changes Python/ceval.c, test_gdb fails on Travis CI with Python compiled with clang -Og. The -Og optimization level is a compromise between performance and the ability to debug Python. The problem is that gdb fails to retrieve some information and so test_gdb fails. I proposed bpo-38350 "./configure --with-pydebug should use -O0 rather than -Og", but the status quo is to continue to use -Og by default. See examples of test_gdb failures from PR 19077 below. I propose to skip a test if one of the follow pattern is found in gdb output:
====================================================================== AssertionError: (...) 'Breakpoint 1 at 0x5aabf1: file Python/bltinmodule.c, line 1173. Breakpoint 1, builtin_id (self=, v=42) at Python/bltinmodule.c:1173 did not end with ' 5 ====================================================================== 'Breakpoint 1 at 0x5aabf1: file Python/bltinmodule.c, line 1173. Breakpoint 1, builtin_id (self=, v=42) at Python/bltinmodule.c:1173
1173\t PyObject *id = PyLong_FromVoidPtr(v);
Traceback (most recent call first):
<built-in method id of module object at remote 0x7ffff7f87050>
(frame information optimized out)
File "/home/travis/build/python/cpython/Lib/test/gdb_sample.py", line 7, in bar
baz(a, b, c)
File "/home/travis/build/python/cpython/Lib/test/gdb_sample.py", line 4, in foo
bar(a, b, c)
(frame information optimized out)
' did not match '^.* |
The fix works as expected: test_gdb passed on PR 19077. Well, likely because a few tests have been skipped. I don't think that in test_gdb can do better than skipping the test if gdb fails to read debug information. |
We have this issue in Fedora Rawhide. test_gdb of Python 3.8 fails on s390x and armv7hl architectures with GCC 10: I tested manually that my change fix test_gdb: tests are skipped as expected: So I backported the change to 3.7 and 3.8. This change only fix test_gdb. To get a fully working python-gdb.py, IMHO the best is to disable all compiler optimization using -O0 optimization level. |
Ok, test_gdb should now be more reliable with various compilers and compiler optimization levels. I chose to not skip a test if '<optimized out>' is found in the gdb output. If it becomes an issue, test_gdb can easily be modified to also be skipped in this case. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: