推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
kamushin
V2EX  ›  Python

GDB attach Python 程序, 打印执行栈, 遇到问题

  •  
  •   kamushin · May 16, 2016 · 5122 views
    This topic created in 3794 days ago, the information mentioned may be changed or developed.
    根据这篇文档 https://docs.python.org/devguide/gdb.html
    在 ~/.gdbinit 中加入了 set auto-load safe-path /home/my/python-gdb.py
    可是 GDB 给出了报错 "/root/.gdbinit:1: Error in sourced command file:
    No symbol table is loaded. Use the "file" command."
    V 站上 Python 程序员应该是比较多的, 大家有用 GDB 看 Python 调用栈的经验吗
    4 replies  •  2016-05-16 22:22:15 +08:00
    introom
        1
    introom  
       May 16, 2016 via Android
    这个和 python 没关系, gcc 编译的时候不要任何优化,用-O0 就可以了
    kamushin
        2
    kamushin  
    OP
       May 16, 2016
    @introom 感觉是编译的 Python 版本是不带 debug symbol 的
    congeec
        3
    congeec  
       May 16, 2016
    你说的靠谱, debian 系的可以安装 python-dbg 。
    在 OS X 我是自己编译一个带 debug symbol 的版本来调试 CPython 扩展的
    daybyday
        4
    daybyday  
       May 16, 2016
    要不要试试 pyrasite ,可以 attach 到运行中的 Python 进程,并执行任意 Python 代码
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2293 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 10:34 · PVG 18:34 · LAX 03:34 · JFK 06:34
    ♥ Do have faith in what you're doing.