首页 > 解决方案 > 在 Linux 上运行 GDB

问题描述

我正在尝试使用 linux 内核运行 gdb。我使用 CONFIG_GDB_SCRIPTS=y 构建了 linux,并尝试在“../linux/scripts/gdb”中的 gdb 中运行 python 脚本“vmlinux-gdb.py”。但结果我得到了错误

File "../linux/scripts/gdb/linux/proc.py", line 15, in <module>
    from linux import constants
ImportError: cannot import name constants

目录“../linux/scripts/gdb/linux”中有几个文件:

clk.py           device.py     lists.py     proc.pyc     tasks.pyc
config.py        dmesg.py      lists.pyc    rbtree.py    timerlist.py
config.pyc       dmesg.pyc     Makefile     rbtree.pyc   utils.py
constants.py.in  genpd.py      modules.py   symbols.py   utils.pyc
cpus.py          __init__.py   modules.pyc  symbols.pyc
cpus.pyc         __init__.pyc  proc.py      tasks.py

所以,这个目录没有文件 constants.py。
我的问题是如何从 constants.py.in 构建 constants.py?

标签: pythonlinuxlinux-kernelgdb

解决方案


推荐阅读