gdb with python扩展:执行便利函数后返回错误

2024-06-28 20:03:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用python扩展在gdb中实现一个方便的函数。目前我的函数非常简单,不做任何事情:

import gdb
class ListLocalVars(gdb.Function):
    """listing local variables"""

    def __init__(self):
        super( ListLocalVars, self).__init__("local_vars")

    def invoke(self):
        return 

ListLocalVars()

在gdb解释器中调用函数时,出现以下错误:

(gdb) call $local_vars()
 Python Exception <class 'TypeError'> Could not convert Python object:None.: 
 Error while executing Python code.

顺便说一下,我的gdb使用python3.4.3

你知道吗?你知道吗


Tags: 函数importselfinitlocaldeffunctionvars