When compiling python3, test_gdb fails due to regex mismatch on the expected output, on s390x and arm 32 bits. Traceback: ====================================================================== FAIL: test_basic_command (test.test_gdb.PyPrintTests) Verify that the "py-print" command works ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 924, in test_basic_command self.assertMultilineMatches(bt, File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 279, in assertMultilineMatches self.fail(msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 (builtin_id) pending.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/libthread_db.so.1".\n\nBreakpoint 1, builtin_id (self=, v=42) at /builddir/build/BUILD/Python-3.8.2/Python/bltinmodule.c:1171\n1171\t{\n#4 (frame information optimized out)\n\'args\' not found\n' did not match ".*\\nlocal 'args' = \\(1, 2, 3\\)\\n.*" ====================================================================== FAIL: test_print_after_up (test.test_gdb.PyPrintTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 933, in test_print_after_up self.assertMultilineMatches(bt, File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 279, in assertMultilineMatches self.fail(msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 (builtin_id) pending.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/libthread_db.so.1".\n\nBreakpoint 1, builtin_id (self=, v=42) at /builddir/build/BUILD/Python-3.8.2/Python/bltinmodule.c:1171\n1171\t{\n#4 (frame information optimized out)\n#10 (frame information optimized out)\n\'c\' not found\n\'b\' not found\n\'a\' not found\n' did not match ".*\\nlocal 'c' = 3\\nlocal 'b' = 2\\nlocal 'a' = 1\\n.*" ====================================================================== FAIL: test_printing_builtin (test.test_gdb.PyPrintTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 949, in test_printing_builtin self.assertMultilineMatches(bt, File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 279, in assertMultilineMatches self.fail(msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 (builtin_id) pending.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/libthread_db.so.1".\n\nBreakpoint 1, builtin_id (self=, v=42) at /builddir/build/BUILD/Python-3.8.2/Python/bltinmodule.c:1171\n1171\t{\n#4 (frame information optimized out)\n\'len\' not found\n' did not match ".*\\nbuiltin 'len' = <built-in method len of module object at remote 0x-?[0-9a-f]+>\\n.*" ====================================================================== FAIL: test_printing_global (test.test_gdb.PyPrintTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 941, in test_printing_global self.assertMultilineMatches(bt, File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 279, in assertMultilineMatches self.fail(msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 (builtin_id) pending.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/libthread_db.so.1".\n\nBreakpoint 1, builtin_id (self=, v=42) at /builddir/build/BUILD/Python-3.8.2/Python/bltinmodule.c:1171\n1171\t{\n#4 (frame information optimized out)\n\'__name__\' not found\n' did not match ".*\\nglobal '__name__' = '__main__'\\n.*" ====================================================================== FAIL: test_basic_command (test.test_gdb.PyLocalsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 958, in test_basic_command self.assertMultilineMatches(bt, File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 279, in assertMultilineMatches self.fail(msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 (builtin_id) pending.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/libthread_db.so.1".\n\nBreakpoint 1, builtin_id (self=, v=42) at /builddir/build/BUILD/Python-3.8.2/Python/bltinmodule.c:1171\n1171\t{\n#4 (frame information optimized out)\n' did not match '.*\\nargs = \\(1, 2, 3\\)\\n.*' ====================================================================== FAIL: test_locals_after_up (test.test_gdb.PyLocalsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 967, in test_locals_after_up self.assertMultilineMatches(bt, File "/builddir/build/BUILD/Python-3.8.2/Lib/test/test_gdb.py", line 279, in assertMultilineMatches self.fail(msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 (builtin_id) pending.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/libthread_db.so.1".\n\nBreakpoint 1, builtin_id (self=, v=42) at /builddir/build/BUILD/Python-3.8.2/Python/bltinmodule.c:1171\n1171\t{\n#4 (frame information optimized out)\n#10 (frame information optimized out)\n' did not match '.*\\na = 1\\nb = 2\\nc = 3\\n.*' ---------------------------------------------------------------------- Ran 46 tests in 144.929s
I validated with success that backporting my https://bugs.python.org/issue40019 change to 3.8 fix test_gdb on s390x and armv7hl. See my PR https://src.fedoraproject.org/rpms/python3/pull-request/182 created to test that. I backported my fix upstream from master to Python 3.7 and 3.8: https://bugs.python.org/issue40019. 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.
We need to not skip the test in the SPEC
Python 3.8.3 has my fix https://github.com/python/cpython/commit/4ced9a7611ddfd923bd8f72aa61121d0e5aeb8fc We can try to reenable test_gdb python3.9 package, and maybe also python 3.8 package.
I created https://src.fedoraproject.org/rpms/python3.8/pull-request/1 to reenable test_gdb in python3.8. Let's see how it goes in CIs.
Let's build debug with -O0.
*** Bug 1846390 has been marked as a duplicate of this bug. ***
FYI I modified test_gdb to skip it on gdb 9.2 and newer to work around a gdb issue: * https://bugs.python.org/issue41473 * https://bugzilla.redhat.com/show_bug.cgi?id=1866884 "AArch64: sometimes, gdb fails to load symbols of a dynamic library with a pending breakpoint" Fedora Rawhide is affected by the gdb issue.
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle. Changing version to 33.
So if we simply change -Og with -O0, we get warnings like this: In file included from /usr/include/bits/libc-header-start.h:33, from /usr/include/limits.h:26, from /usr/lib/gcc/x86_64-redhat-linux/10/include/limits.h:195, from /usr/lib/gcc/x86_64-redhat-linux/10/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/10/include/limits.h:34, from /builddir/build/BUILD/Python-3.9.0rc1/Include/Python.h:11, from /builddir/build/BUILD/Python-3.9.0rc1/Programs/_freeze_importlib.c:5: /usr/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] 397 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O) | ^~~~~~~ If we add -Wp,-D_FORTIFY_SOURCE=0, we have warnings like this: <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition More over, even if we replace the FORTIFY_SOURCE value with some sed magic, annobin warns as well: annobin: /builddir/build/BUILD/Python-3.9.0rc1/Programs/_freeze_importlib.c: Warning: -D_FORTIFY_SOURCE defined as 0 I suppose we will always get a warning of some sort anyway, one way it to use -Wno-cpp with the debug build. WDYT?
> More over, even if we replace the FORTIFY_SOURCE value with some sed magic, annobin warns as well: (...) Is it possible to tell annobin to ignore -D_FORTIFY_SOURCE?
I don't know.
Here is a PR: https://src.fedoraproject.org/rpms/python3.9/pull-request/30
test_gdb is skipped upstream. Compiling with -Og doesn't fix it even in versions where it isn't skipped. Restoring test_gdb should be done upstream before we do this.
https://bugzilla.redhat.com/show_bug.cgi?id=1866884 has been fixed (gdb 10.1). I reenabled test_gdb on gdb 9.2+ on Python upstream: https://github.com/python/cpython/commit/066394018a8463643cc63d933493f0afa99d72cc I move the issue statuc back to NEW even if there is a (closed) PR: https://src.fedoraproject.org/rpms/python3.9/pull-request/30
Woooot, thanks, that's a major enhancement to make gdb usable on python3.9-debug! No make "optimized out" issue which prevent to inspect anything ;-)