2.73 如何判断GDB已经启用Python支持 https://scz.617.cn/unix/202103091316.txt A: (gdb) show version GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git ... (gdb) show configuration This GDB was configured as follows: configure --host=i686-linux-gnu --target=i686-linux-gnu ... --with-python=/usr (relocatable) --with-python-libdir=/usr/lib (relocatable) ... 若有如上内容,表明编译生成GDB时已经启用Python支持。此时GDB有一些基于Python 的内置函数: (gdb) help function ... function _memeq -- $_memeq - compare bytes of memory. function _regex -- $_regex - check if a string matches a regular expression. function _streq -- $_streq - check string equality. function _strlen -- $_strlen - compute string length. ... GDB有个python/py命令: (gdb) help python python, py Evaluate a Python command. The command can be given as an argument, for instance: python print (23) If no argument is given, the following lines are read and used as the Python commands. Type a line containing "end" to indicate the end of the command. (gdb) python print(True) True (gdb) python import sys;print(sys.version) (gdb) python print(sys.version) 3.9.1+ (default, Jan 20 2021, 14:49:22) [GCC 10.2.1 20210110]