Pop-Up Thingie

>>> Magnum BBS <<<
  • Home
  • Forum
  • Files
  • Log in

  1. Forum
  2. Usenet
  3. COMP.LANG.PYTHON
  • Debugging Python C extensions with GDB

    From Jen Kris@21:1/5 to All on Mon Nov 14 19:59:14 2022
    In September 2021, Victor Stinner wrote “Debugging Python C extensions with GDB” (https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#getting_started_with_python_3_9). 

    My question is:  with Python 3.9+, can I debug into a C extension written in pure C and called from ctypes  -- that is not written using the C_API? 

    Thanks. 

    Jen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Barry@21:1/5 to All on Mon Nov 14 22:32:35 2022
    On 14 Nov 2022, at 19:10, Jen Kris via Python-list <[email protected]> wrote:

    In September 2021, Victor Stinner wrote “Debugging Python C extensions with GDB” (https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#getting_started_with_python_3_9).

    My question is: with Python 3.9+, can I debug into a C extension written in pure C and called from ctypes -- that is not written using the C_API?

    Yes.

    Just put a breakpoint on the function in the c library that you want to debug. You can set the breakpoint before a .so is loaded.

    Barry


    Thanks.

    Jen



    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jen Kris@21:1/5 to All on Tue Nov 15 00:44:28 2022
    Thanks for your reply.  Victor's article didn't mention ctypes extensions, so I wanted to post a question before I build from source. 


    Nov 14, 2022, 14:32 by [email protected]:



    On 14 Nov 2022, at 19:10, Jen Kris via Python-list <[email protected]> wrote:

    In September 2021, Victor Stinner wrote “Debugging Python C extensions with GDB” (https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#getting_started_with_python_3_9).

    My question is: with Python 3.9+, can I debug into a C extension written in pure C and called from ctypes -- that is not written using the C_API?


    Yes.

    Just put a breakpoint on the function in the c library that you want to debug.
    You can set the breakpoint before a .so is loaded.

    Barry


    Thanks.

    Jen



    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Barry@21:1/5 to All on Tue Nov 15 21:50:43 2022
    On 14 Nov 2022, at 23:44, Jen Kris <[email protected]> wrote:

    
    Thanks for your reply. Victor's article didn't mention ctypes extensions, so I wanted to post a question before I build from source.

    Gdb works on any program its not special to python.
    Victor is only talking about a specific use of gdb for python c extensions.

    Barry




    Nov 14, 2022, 14:32 by [email protected]:

    On 14 Nov 2022, at 19:10, Jen Kris via Python-list <[email protected]> wrote:

    In September 2021, Victor Stinner wrote “Debugging Python C extensions with GDB” (https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#getting_started_with_python_3_9).

    My question is: with Python 3.9+, can I debug into a C extension written in pure C and called from ctypes -- that is not written using the C_API?

    Yes.

    Just put a breakpoint on the function in the c library that you want to debug.
    You can set the breakpoint before a .so is loaded.

    Barry

    Thanks.

    Jen



    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • Who's Online

  • Recent Visitors

    • Rixter
      Wed Sep 16 12:01:34 2026
      from Madison, Nc via Telnet
    • Bob Worm
      Wed Sep 16 10:17:33 2026
      from Wales, Uk via Telnet
    • Rixter
      Wed Sep 16 00:01:35 2026
      from Madison, Nc via Telnet
    • Stormwallker
      Tue Sep 15 15:52:32 2026
      from Hinckley, Leicestershire via Telnet
    • Rixter
      Tue Sep 15 12:01:35 2026
      from Madison, Nc via Telnet
    • Bob Worm
      Tue Sep 15 11:25:46 2026
      from Wales, Uk via Telnet
    • Andrew Andrew
      Tue Sep 15 02:46:28 2026
      from Chicago, Il via Telnet
    • Netmages
      Tue Sep 15 01:13:15 2026
      from Santiago, Chile via SSH
  • System Info

    Sysop: Keyop
    Location: Huddersfield, West Yorkshire, UK
    Users: 766
    Nodes: 16 (0 / 16)
    Uptime: 04:58:58
    Calls: 12,765
    Calls today: 3
    Files: 15,363
    Messages: 6,557,267

© >>> Magnum BBS <<<, 2026