classification
Title: eval frame rename in pep 0523 broke gdb's python extension
Type: Stage: resolved
Components: Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: bcap, cooperlees, lukasz.langa, vstinner
Priority: normal Keywords:

Created on 2017-07-21 13:02 by bcap, last changed 2017-08-22 20:23 by lukasz.langa. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2803 merged bcap, 2017-07-21 13:12
PR 3090 merged lukasz.langa, 2017-08-14 22:31
PR 3091 merged lukasz.langa, 2017-08-14 22:40
PR 3100 merged vstinner, 2017-08-16 08:38
PR 3101 merged vstinner, 2017-08-16 08:39
PR 3153 merged lukasz.langa, 2017-08-19 00:11
PR 3153 merged lukasz.langa, 2017-08-19 00:11
PR 3192 merged lukasz.langa, 2017-08-22 19:49
Messages (15)
msg298804 - (view) Author: Bruno Penteado (bcap) * Date: 2017-07-21 13:02
pep 0523 renames PyEval_EvalFrameEx to _PyEval_EvalFrameDefault while the gdb python extension only looks for PyEval_EvalFrameEx to understand if it is dealing with a frame.

Final effect is that attaching gdb to a python3.6 process doesnt resolve python objects. Eg. py-list and py-bt dont work properly
msg300267 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-08-14 22:14
New changeset 2e0f4db114424a00354eab889ba8f7334a2ab8f0 by Łukasz Langa (Bruno "Polaco" Penteado) in branch 'master':
bpo-30983: eval frame rename in pep 0523 broke gdb's python extension (#2803)
https://github.com/python/cpython/commit/2e0f4db114424a00354eab889ba8f7334a2ab8f0
msg300269 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-08-14 23:06
New changeset 09b77165e3fffa7b7ff160ad06042cdcfa004bf5 by Łukasz Langa in branch '3.6':
[3.6] bpo-30983: eval frame rename in pep 0523 broke gdb's python extension (GH-2803) (#3090)
https://github.com/python/cpython/commit/09b77165e3fffa7b7ff160ad06042cdcfa004bf5
msg300332 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-08-16 08:31
This change broke test_gdb on most buildbots :-(

http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%203.x/builds/1159/steps/test/logs/stdio

======================================================================
FAIL: test_pyup_command (test.test_gdb.StackNavigationTests)
Verify that the "py-up" command works
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_gdb.py", line 688, in test_pyup_command
    $''')
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_gdb.py", line 259, 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/i386-linux-gnu/libthread_db.so.1".\n\nBreakpoint 1, builtin_id (self=self@entry=, v=42) at Python/bltinmodule.c:1103\n1103\t{\n#4 Frame 0x4086b4cc, for file /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/gdb_sample.py, line 10, in baz (args=(1, 2, 3))\n    id(42)\n#5 Frame 0x4086b4cc, for file /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/gdb_sample.py, line 10, in baz (args=(1, 2, 3))\n    id(42)\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$'
msg300333 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-08-16 08:43
I chose to revert the change because I don't have the bandwidth right now to investigate why the change broke test_gdb.

I'm surprised that a change affecting python-gdb.py wasn't properly tested manually using test_gdb.py :-( I understand that Travis CI doesn't have gdb and/or that the test pass in some cases?

The revert only gives us more time to design the proper solution.
msg300340 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-08-16 09:02
New changeset 7cc33998b83df6ab8cf2c1afe16a61ee232e39ec by Victor Stinner in branch 'master':
bpo-30983: Revert changes which broke most buildbots (#3100)
https://github.com/python/cpython/commit/7cc33998b83df6ab8cf2c1afe16a61ee232e39ec
msg300341 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-08-16 09:02
New changeset 98e26979aa4c15b391fd3780340772a17d513d4d by Victor Stinner in branch '3.6':
Revert "[3.6] bpo-30983: eval frame rename in pep 0523 broke gdb's python extension (GH-2803) (#3090)" (#3101)
https://github.com/python/cpython/commit/98e26979aa4c15b391fd3780340772a17d513d4d
msg300457 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-08-17 20:50
In this case it would be great if the buildbots commented on the relevant pull request that it broke the build. Otherwise this creates this dissonance that it was all green during merging of the PR when in fact it wasn't.

I think we need to make test_gdb run on Travis, this is an unfortunate omission.
msg300461 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-08-17 22:21
While our CI is getting better everyday, it still has a few flaws.

There is no automated buildbot failure notification to the author and
committer yet because random failures were very common 6 months ago. I
fixed something like 90% of the most common race conditions (in tests but
also in the code), and now the remaining 10% are the least funny ones :-)
My latest report:
https://haypo.github.io/python-buildbots-2017q2.html

In the meanwhile I check manually buildbots output and report bugs and
regressions.

For gdb, don't worry, the buildbots were fixed quickly, it's fine if the
pre-commit CI missed the issue since gdb changes are rare. I am confident
that we can design a fix without introducing regressions ;-)
msg300462 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-08-17 23:54
I am unable to repro this locally. With the changes to libpython.py test_gdb still passes on CentOS 7 and macOS 10.12.
msg300528 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-08-18 19:58
OK, I got the repro. You have to rebuild python for /Tools/gdb/libpython.py to land in /python-gdb.py. The latter is used during test_gdb.py.
msg300529 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-08-18 20:17
> You have to rebuild python for /Tools/gdb/libpython.py to land in
/python-gdb.py. The latter is used during test_gdb.py.

Ah yes, sorry, that's not obvious. "make" does the copy for you.
msg300552 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-08-18 23:31
The issue originally stems from the fact that a non-debug Python build with --enable-shared is inlining PyEval_EvalFrameEx into _PyEval_EvalFrameDefault.

So, the patch should really become to *replace* discovering PyEval_EvalFrameEx with the discovery of _PyEval_EvalFrameDefault. This might be problematic in the future when there is an actual JIT but currently it's strictly better than the current situation where the gdb bindings simply don't work for shared builds.
msg300662 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-08-21 23:40
New changeset 5fe59f8e3a0a56a155c18f9d581205ec533764b6 by Łukasz Langa in branch 'master':
bpo-30983: [gdb] Fix py-bt, etc. for non-debug shared builds (#3153)
https://github.com/python/cpython/commit/5fe59f8e3a0a56a155c18f9d581205ec533764b6
msg300720 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-08-22 20:20
New changeset 8e572491b59c2334723bfd7411ab2a9fbd100f70 by Łukasz Langa in branch '3.6':
[3.6] bpo-30983: [gdb] Fix py-bt, etc. for non-debug shared builds (GH-3153) (#3192)
https://github.com/python/cpython/commit/8e572491b59c2334723bfd7411ab2a9fbd100f70
History
Date User Action Args
2017-08-22 20:23:45lukasz.langasetstatus: open -> closed
resolution: fixed
2017-08-22 20:20:42lukasz.langasetmessages: + msg300720
2017-08-22 19:49:44lukasz.langasetpull_requests: + pull_request3231
2017-08-21 23:40:31lukasz.langasetmessages: + msg300662
2017-08-19 00:11:41lukasz.langasetpull_requests: + pull_request3188
2017-08-19 00:11:39lukasz.langasetpull_requests: + pull_request3187
2017-08-18 23:31:53lukasz.langasetmessages: + msg300552
2017-08-18 20:17:36vstinnersetmessages: + msg300529
2017-08-18 19:58:40lukasz.langasetmessages: + msg300528
2017-08-17 23:54:14lukasz.langasetmessages: + msg300462
2017-08-17 22:21:31vstinnersetmessages: + msg300461
2017-08-17 20:50:21lukasz.langasetmessages: + msg300457
2017-08-16 09:02:10vstinnersetmessages: + msg300341
2017-08-16 09:02:09vstinnersetmessages: + msg300340
2017-08-16 08:43:53vstinnersetmessages: + msg300333
2017-08-16 08:39:50vstinnersetpull_requests: + pull_request3140
2017-08-16 08:38:45vstinnersetpull_requests: + pull_request3139
2017-08-16 08:31:37vstinnersetstatus: closed -> open

nosy: + vstinner
messages: + msg300332

resolution: fixed -> (no value)
2017-08-14 23:06:59lukasz.langasetstatus: open -> closed
resolution: fixed
stage: resolved
2017-08-14 23:06:30lukasz.langasetmessages: + msg300269
2017-08-14 22:40:41lukasz.langasetpull_requests: + pull_request3131
2017-08-14 22:31:41lukasz.langasetpull_requests: + pull_request3130
2017-08-14 22:14:19lukasz.langasetnosy: + lukasz.langa
messages: + msg300267
2017-07-21 18:21:26cooperleessetnosy: + cooperlees
2017-07-21 13:12:58bcapsetpull_requests: + pull_request2853
2017-07-21 13:08:50bcapsettitle: eval frame rename in pep 0523 broke gdp's python extension -> eval frame rename in pep 0523 broke gdb's python extension
2017-07-21 13:02:35bcapcreate