【发布时间】:2014-03-31 08:25:18
【问题描述】:
我正在做一个课堂项目(别担心,这个问题不是家庭作业),最近我从部门机器转到了我自己的机器上。 该项目是构建一个简单的操作系统。为了使任务更容易,我们提供了将 gdb“附加”到程序运行的 QEMU 的能力。在我的计算机上不附加 gdb 的情况下运行这个程序可以正常工作,但是当我开始尝试使用 gdb 时它没有运行。 需要注意的主要事情(我认为)是它在部门计算机(gdb 7.4.1-debian)上运行良好,但在我的计算机(7.6.1-ubuntu)上运行良好。
我得到的与 python 相关的错误是 gdb 扩展是用 python 编写的,但似乎找不到它们。我也收到语法错误。程序运行如下所示:
/usr/bin/qemu-system-i386
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/alfonso/course/cs167/weenix/kernel/weenix.dbg...done.
之后它挂了一会儿,然后给我这个错误:
inittmp.gdb:1: Error in sourced command file:
localhost:1234: Connection timed out.
Traceback (most recent call last):
File "/home/alfonso/course/cs167/weenix/kernel/mm/memcheck.py", line 5, in <module>
import weenix
ImportError: No module named 'weenix'
File "/home/alfonso/course/cs167/weenix/kernel/mm/page.py", line 15
print "pagesize: {0}".format(weenix.kmem.pagesize())
^
SyntaxError: invalid syntax
File "/home/alfonso/course/cs167/weenix/kernel/mm/slab.py", line 40
print "{1:<{0}} {3:>{2}} {5:>{4}} {7:>{6}}".format(
^
SyntaxError: invalid syntax
File "/home/alfonso/course/cs167/weenix/kernel/proc/proc.py", line 17
print weenix.proc.str_proc_tree()
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "/home/alfonso/course/cs167/weenix/kernel/util/debug.py", line 3, in <module>
import weenix
ImportError: No module named 'weenix'
Traceback (most recent call last):
File "/home/alfonso/course/cs167/weenix/kernel/util/list.py", line 3, in <module>
import weenix
ImportError: No module named 'weenix'
Breakpoint 1 at 0xc0008f04: file util/debug.c, line 190.
Breakpoint 2 at 0xc0007016: file main/kmain.c, line 298.
Breakpoint 3 at 0xc0006cf3: file main/kmain.c, line 129.
init.gdb:6: Error in sourced command file:
The program is not being run.
当然,导入错误和无效语法让我最初想到了我的 PYTHONPATH 和/或包设置,但这是可以正常工作的(经过测试)。我唯一能想到的就是我忽略了一些配置问题。
如果您愿意,我可以发布 bash 脚本、.gdb 文件和其他文件,但由于这在部门计算机上运行良好,我怀疑这是问题所在。
Python 版本:(部门:“2.7.3”,我:“2.7.5+”)
编辑: 经过一番搜索,我意识到最新的 Linux Mint(petra) 使用 gdb 将 python 解释为 python3。我目前正在寻找一种配置 gdb 的方法,但由于我以前从未这样做过,如果有人能指导我这样做,我将不胜感激。
【问题讨论】:
-
它抱怨“weenix”模块。语法错误可能是因为这个
-
嗨,praveen,您能详细说明一下吗?该模块已正确命名并正确设置(根据我的 PYTHONPATH 测试)。语法错误让我想到的唯一一件事是,出于某种原因,gdb 需要 python3。您知道检查/更改它的方法吗?