Skip to content

use string_print() in gdb #47882

Closed
Closed

Description

@vstinner
BPO 3632
Nosy @amauryfa, @vstinner, @devdanzin
Files
  • pyobject_dump.patch: Call PyGILState_Ensure() in _PyObject_Dump()
  • 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:

    assignee = None
    closed_at = <Date 2008-12-15.22:29:29.165>
    created_at = <Date 2008-08-21.12:39:39.593>
    labels = ['library', 'performance']
    title = 'use string_print() in gdb'
    updated_at = <Date 2008-12-15.22:29:29.164>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2008-12-15.22:29:29.164>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-12-15.22:29:29.165>
    closer = 'amaury.forgeotdarc'
    components = ['Library (Lib)']
    creation = <Date 2008-08-21.12:39:39.593>
    creator = 'vstinner'
    dependencies = []
    files = ['11193']
    hgrepos = []
    issue_num = 3632
    keywords = ['patch']
    message_count = 8.0
    messages = ['71628', '71630', '71631', '72806', '72822', '73156', '77637', '77886']
    nosy_count = 3.0
    nosy_names = ['amaury.forgeotdarc', 'vstinner', 'ajaksu2']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue3632'
    versions = ['Python 2.6']

    Activity

    1. vstinner commented on Aug 21, 2008

      @vstinner
      MemberAuthor

      "pyo" macro from gdbinit (see bpo-3631) uses _PyObject_Dump() to display
      an object. This function calls (indirectly) string_print() to display
      one line of text. But if the GIL is released (I guess it's the GIL or
      is it called the "thread state"?), gdb crashs Python:

      object : Fatal Python error: PyEval_SaveThread: NULL tstate
      Program received signal SIGABRT, Aborted.
      0xffffe410 in __kernel_vsyscall ()

      Workaround: ensure GIL before Py_BEGIN_ALLOW_THREADS... That sounds
      ugly but it works :-) So I propose to enable it in debug mode (#ifdef
      Py_DEBUG) with a patch.

      I guess that the issue is very specific to (gdb) debugging and should
      not affect normal usage of Python. That's why I choosed to enable it
      only in debug mode.

    2. added
      stdlib
      performance
      on Aug 21, 2008
    3. amauryfa commented on Aug 21, 2008

      @amauryfa
      Contributor

      I once fell into the same issue, but the patch should modify
      _PyObject_Dump(), around the call to PyObject_Print.

      string_print() is not the only function called by _PyObject_Dump, by far...

      And beware that many people routinely run python in "debug mode" outside
      gdb, for example during development.
      That's why it's better to modify _PyObject_Dump only; we can be sure
      that it only affects a debugger session.

    4. vstinner commented on Aug 21, 2008

      @vstinner
      MemberAuthor

      Oh! I have a better idea: why not patching _PyObject_Dump() instead of
      string_print() :-) So here is a new patch.

    5. vstinner commented on Sep 8, 2008

      @vstinner
      MemberAuthor

      Can anyone review my new patch?

    6. amauryfa commented on Sep 9, 2008

      @amauryfa
      Contributor

      The patch is fine.
      I don't know if it can make the 2.6 release, but it is very simple, and
      affect only a function used in debugger macros.

    7. devdanzin commented on Sep 13, 2008

      devdanzinmannequin
      Mannequin

      I would love to have this patch, along with those of bpo-3631 and bpo-3610,
      included in Misc as diffs. This would make it easier to get the improved
      functionality in a new development box, besides allowing distributions
      to apply them at will.

    8. vstinner commented on Dec 11, 2008

      @vstinner
      MemberAuthor

      Can anyone apply this patch? Or explain me why it can not be applied?

    9. amauryfa commented on Dec 15, 2008

      @amauryfa
      Contributor

      Committed in r67802.

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      performancestdlib

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions