Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
调用GDB.execute时GDB Python API抛出GDB.error_Python_Gdb_Gdb Python - Fatal编程技术网

调用GDB.execute时GDB Python API抛出GDB.error

调用GDB.execute时GDB Python API抛出GDB.error,python,gdb,gdb-python,Python,Gdb,Gdb Python,我希望以任意慢的速度执行C/C++代码。事实证明这很难,我决定使用GDB,并以设定的速度逐步完成程序。我尝试使用GDB Python API,如下所示: res = gdb.execute('break main\n', to_string=True) #print(res) res = gdb.execute('run\n', to_string=True) print(res) res = gdb.execute('next\n', from_tty=True, to_string=True

我希望以任意慢的速度执行C/C++代码。事实证明这很难,我决定使用GDB,并以设定的速度逐步完成程序。我尝试使用GDB Python API,如下所示:

res = gdb.execute('break main\n', to_string=True)
#print(res)
res = gdb.execute('run\n', to_string=True)
print(res)
res = gdb.execute('next\n', from_tty=True, to_string=True)
print(res)
但我得到了这个错误:

Traceback (most recent call last):
  File "gdb_script.py", line 15, in <module>
    run()
  File "gdb_script.py", line 11, in run
    res = gdb.execute('next\n', from_tty=True, to_string=True)
gdb.error: A syntax error in expression, near `'.

看起来这是在8.1.1和8.2之间修复的。在早期版本中,解决方法是在gdb.execute的参数中省略尾随的
\n
。我想修复这个问题的补丁是
g++ -g -DASIO_STANDALONE -std=c++11 -Wall -Iasio/include main.cpp -o main.exe -lws2_32