<tfoot id='lhAy3'></tfoot>
    <bdo id='lhAy3'></bdo><ul id='lhAy3'></ul>

      <legend id='lhAy3'><style id='lhAy3'><dir id='lhAy3'><q id='lhAy3'></q></dir></style></legend>
        <i id='lhAy3'><tr id='lhAy3'><dt id='lhAy3'><q id='lhAy3'><span id='lhAy3'><b id='lhAy3'><form id='lhAy3'><ins id='lhAy3'></ins><ul id='lhAy3'></ul><sub id='lhAy3'></sub></form><legend id='lhAy3'></legend><bdo id='lhAy3'><pre id='lhAy3'><center id='lhAy3'></center></pre></bdo></b><th id='lhAy3'></th></span></q></dt></tr></i><div id='lhAy3'><tfoot id='lhAy3'></tfoot><dl id='lhAy3'><fieldset id='lhAy3'></fieldset></dl></div>

        <small id='lhAy3'></small><noframes id='lhAy3'>

      1. 如何更改 gdb 使用的 Python 解释器?

        时间:2023-08-29
            <bdo id='qavOW'></bdo><ul id='qavOW'></ul>
              <tbody id='qavOW'></tbody>
            • <tfoot id='qavOW'></tfoot>

            • <legend id='qavOW'><style id='qavOW'><dir id='qavOW'><q id='qavOW'></q></dir></style></legend>
              <i id='qavOW'><tr id='qavOW'><dt id='qavOW'><q id='qavOW'><span id='qavOW'><b id='qavOW'><form id='qavOW'><ins id='qavOW'></ins><ul id='qavOW'></ul><sub id='qavOW'></sub></form><legend id='qavOW'></legend><bdo id='qavOW'><pre id='qavOW'><center id='qavOW'></center></pre></bdo></b><th id='qavOW'></th></span></q></dt></tr></i><div id='qavOW'><tfoot id='qavOW'></tfoot><dl id='qavOW'><fieldset id='qavOW'></fieldset></dl></div>

              1. <small id='qavOW'></small><noframes id='qavOW'>

                1. 本文介绍了如何更改 gdb 使用的 Python 解释器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我使用的是 ubuntu 14.04,其中 python3 是默认系统包.

                  I'm using ubuntu 14.04, where python3 is a default system package.

                  我想用gdb调试Python2.7程序,但是我好像遇到了这个问题:

                  I want to debug Python2.7 programs with gdb, but I seem to encounter this issue:

                  当我在 gdb 中时,使用 py 命令会将我置于解释器中,因此我在解释器中运行了这些命令:

                  When i'm in gdb, using the py command puts me in an interpreter, so i ran these commands in the interpreter:

                  首先我检查解释器版本:

                  First I check the interpreter version:

                  (gdb) py
                  >import sys
                  >print(sys.version)
                  >end
                  3.4.0 (default, Apr 11 2014, 13:08:40) 
                  [GCC 4.8.2]
                  

                  然后我检查正在使用的解释器可执行文件

                  Then I check what interpreter executable is being used

                  (gdb) py
                  >import sys
                  >print(sys.executable)
                  >end
                  /usr/bin/python
                  (gdb) 
                  

                  然后在 bash 中,我检查解释器:

                  Then in bash, I check the interpreter:

                  12:34]hostname ~ $ls -l /usr/bin/python 
                  lrwxrwxrwx 1 root root 9 Dec 21  2013 /usr/bin/python -> python2.7
                  

                  虽然 gdb 说它使用的是我的 2.7 解释器,但实际上它使用的是另一个解释器.我需要一个 2.7 解释器才能将它与 ubuntu 包python2.7-dbg"提供的 python 特定扩展一起使用,因为据我所知,python 3.4 还没有这样的包,即使有,我要调试的程序运行 python 2.7

                  So although gdb says it's using my 2.7 interpreter, it's actually using another one. I need a 2.7 interpreter to be able to use it with the python specific extensions that the ubuntu package 'python2.7-dbg' provides, because as far as i know there's no such package for python 3.4 yet, and even if there was, the programs that i want to debug run python 2.7

                  我的问题是如何让它使用我想要的解释器?

                  My question is how do i make it use the interpreter I want?

                  不要卸载 python3 顺便说一句.我在 ubuntu 14.04 上完成了它,它破坏了我的系统.没能重新站起来.我目前正在使用它而没有窗口管理器(它很酷,1337),但你明白了.

                  Do not uninstall python3 btw. I did it on ubuntu 14.04 and it wrecked my system. Couldn't manage to get it up again. I'm currently using it with no window-manager (it's cool and 1337), but you get the idea.

                  推荐答案

                  虽然 gdb 说它使用的是我的 2.7 解释器

                  So although gdb says it's using my 2.7 interpreter

                  GDB 没有这么说.它说它使用的是 3.4.0,并且解释器以 libpython3.4.alibpython3.4.so链接到 GDB代码>.

                  GDB doesn't say that. It says it's using 3.4.0, and that interpreter is linked into GDB, in the form of libpython3.4.a or libpython3.4.so.

                  由于不涉及实际的 Python 二进制文件,这里的(小)错误是 sys.executable 返回 /usr/bin/python.返回 /usr/bin/gdb 可能会更好.

                  Since there is no actual Python binary involved, the (minor) bug here is that sys.executable returns /usr/bin/python. It would possibly be better for it to return /usr/bin/gdb instead.

                  我需要一个 2.7 的解释器

                  I need a 2.7 interpreter

                  在这种情况下,您必须在使用适当的 --with-python 值配置之后,从源代码重建 gdb.

                  In that case, you'll have to rebuild gdb from source, after configuring it with appropriate --with-python value.

                  这篇关于如何更改 gdb 使用的 Python 解释器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                    <legend id='CAZaI'><style id='CAZaI'><dir id='CAZaI'><q id='CAZaI'></q></dir></style></legend>

                      <small id='CAZaI'></small><noframes id='CAZaI'>

                    1. <tfoot id='CAZaI'></tfoot>
                        <tbody id='CAZaI'></tbody>
                      • <bdo id='CAZaI'></bdo><ul id='CAZaI'></ul>

                      • <i id='CAZaI'><tr id='CAZaI'><dt id='CAZaI'><q id='CAZaI'><span id='CAZaI'><b id='CAZaI'><form id='CAZaI'><ins id='CAZaI'></ins><ul id='CAZaI'></ul><sub id='CAZaI'></sub></form><legend id='CAZaI'></legend><bdo id='CAZaI'><pre id='CAZaI'><center id='CAZaI'></center></pre></bdo></b><th id='CAZaI'></th></span></q></dt></tr></i><div id='CAZaI'><tfoot id='CAZaI'></tfoot><dl id='CAZaI'><fieldset id='CAZaI'></fieldset></dl></div>