This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_gdb fails
Type: Stage: resolved
Components: Tests Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: dmalcolm Nosy List: Michael.Blume, dmalcolm, loewis, tfmorris
Priority: normal Keywords:

Created on 2010-07-05 07:27 by Michael.Blume, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (11)
msg109311 - (view) Author: Michael Blume (Michael.Blume) Date: 2010-07-05 07:27
After building Python 2.7 on two separate X68 Ubuntu boxes, test_gdb failed both times.

./configure
make
make test

output follows:


test_gdb
test test_gdb failed -- Traceback (most recent call last):
  File "/home/mike/workspace/Python-2.7/Lib/test/test_gdb.py", line 637, in test_basic_command
    ''')
  File "/home/mike/workspace/Python-2.7/Lib/test/test_gdb.py", line 163, in assertMultilineMatches
    msg='%r did not match %r' % (actual, pattern))
AssertionError: 'Breakpoint 1 at 0x80957d6: file Objects/object.c, line 329.\n[Thread debugging using libthread_db enabled]\n\nBreakpoint 1, PyObject_Print (op=42, fp=0x401cf4e0, flags=1) at Objects/object.c:329\n329\t{\n#3 Frame 0x81e322c, for file /home/mike/workspace/Python-2.7/Lib/test/gdb_sample.py, line 10, in baz (args=(1, 2, 3))\n    print(42)\n#7 (unable to read python frame information)\n#10 Frame 0x81d5544, for file /home/mike/workspace/Python-2.7/Lib/test/gdb_sample.py, line 7, in bar (a=1, b=2, c=3)\n    baz(a, b, c)\n#13 Frame 0x81d53dc, for file /home/mike/workspace/Python-2.7/Lib/test/gdb_sample.py, line 4, in foo (a=1, b=2, c=3)\n    bar(a, b, c)\n' did not match '^.*\n#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \\(a=1, b=2, c=3\\)\n    baz\\(a, b, c\\)\n#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 4, in foo \\(a=1, b=2, c=3\\)\n    bar\\(a, b, c\\)\n#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 12, in <module> \\(\\)\nfoo\\(1, 2, 3\\)\n'

machines have the following packages installed, with the following versions:
gdb 7.1-1ubuntu2
libgdb-dev 7.1-1ubuntu2
msg109313 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-07-05 08:23
Dave, can you please take a look?
msg109417 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-07-06 20:15
Deciphering the output from the assertion, the stdout from gdb when running the test was:
--- BEGIN ---
Breakpoint 1, PyObject_Print (op=42, fp=0x401cf4e0, flags=1) at Objects/object.c:329
329     {
#3 Frame 0x81e322c, for file /home/mike/workspace/Python-2.7/Lib/test/gdb_sample.py, line 10, in baz (args=(1, 2, 3))
    print(42)
#7 (unable to read python frame information)
#10 Frame 0x81d5544, for file /home/mike/workspace/Python-2.7/Lib/test/gdb_sample.py, line 7, in bar (a=1, b=2, c=3)
    baz(a, b, c)
#13 Frame 0x81d53dc, for file /home/mike/workspace/Python-2.7/Lib/test/gdb_sample.py, line 4, in foo (a=1, b=2, c=3)
    bar(a, b, c)
--- END ---

but the expected output was:

--- BEGIN ---
^.*
#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
    baz\(a, b, c\)
#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 4, in foo \(a=1, b=2, c=3\)
    bar\(a, b, c\)
#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 12, in <module> \(\)
foo\(1, 2, 3\)
--- END  ---

There are various tests named "test_basic_command".  From the linenumber and assertion, it's clear that this one is PyBtTests.test_basic_command.

This looks a lot like issue 8482.

What compiler options did you use when building Python?
msg109428 - (view) Author: Michael Blume (Michael.Blume) Date: 2010-07-06 21:25
The commands I issued to build were just

./configure
make
make install

These machines were both fairly vanilla setups, so I don't think there should have been any strange flags going to the compiler.
msg109429 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-07-06 21:29
Thanks.

Just to clarify, what's the output of:
./python -c "import sysconfig; print sysconfig.get_config_vars()['PY_CFLAGS']"
msg109430 - (view) Author: Michael Blume (Michael.Blume) Date: 2010-07-06 21:34
-fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include  -DPy_BUILD_CORE
msg109433 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-07-06 21:57
Thanks for the info.  The final optimization option passed to gcc is the "-O3", so the build was done with optimization.

It's not going to be possible to determine if and when gdb will be able to work in an optimized build across all different compilers and configurations.  Issue 8605 has a patch to skip test_gdb if optimization was present in the compilation flags, and I think we should apply it.
msg109571 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-07-08 19:02
This should be fixed now that issue 8605 is resolved: we now skip test_gdb if the compiler optimization level is above -O0
msg118074 - (view) Author: Tom Morris (tfmorris) Date: 2010-10-06 18:32
Did this fix actually make the 2.7 release?  I just installed 2.7 on 64-bit Ubuntu and ran into the same problem.

python -c "import sysconfig; print sysconfig.get_config_vars()['PY_CFLAGS']"
-fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include  -DPy_BUILD_CORE

Python 2.7 (r27:82500, Oct  6 2010, 12:53:54) 
[GCC 4.4.1] on linux2

uname -a
Linux tfmorris-laptop 2.6.31-22-generic #65-Ubuntu SMP Thu Sep 16 16:21:34 UTC 2010 x86_64 GNU/Linux
msg118077 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-10-06 19:45
> Did this fix actually make the 2.7 release?

Are you sure you posted to the right issue? I fail to see the
relationship between your message and the original report.

If you found a bug in Python 2.7, please report it as a
separate issue.
msg118079 - (view) Author: Tom Morris (tfmorris) Date: 2010-10-06 20:32
Sorry, I misread the 'version' field as the version the fix was committed for, not the version the bug was reported against.

The fix was reportedly fixed in r82648 and v2.7 is r82500.  If there's ever a 2.7.1, I guess the fix will appear, but since the solution is to just ignore the test, that's easy to do manually. :-)
History
Date User Action Args
2022-04-11 14:57:03adminsetgithub: 53409
2010-10-06 20:32:14tfmorrissetmessages: + msg118079
2010-10-06 19:45:46loewissetmessages: + msg118077
2010-10-06 18:32:58tfmorrissetnosy: + tfmorris
messages: + msg118074
2010-07-08 19:04:01dmalcolmsetstatus: open -> closed
2010-07-08 19:02:47dmalcolmsetresolution: fixed
messages: + msg109571
stage: resolved
2010-07-06 21:57:30dmalcolmsetmessages: + msg109433
2010-07-06 21:34:59Michael.Blumesetmessages: + msg109430
2010-07-06 21:29:26dmalcolmsetmessages: + msg109429
2010-07-06 21:25:08Michael.Blumesetmessages: + msg109428
2010-07-06 20:15:05dmalcolmsetmessages: + msg109417
2010-07-05 08:23:07loewissetassignee: dmalcolm

messages: + msg109313
nosy: + dmalcolm, loewis
2010-07-05 07:27:41Michael.Blumecreate