gdb加载python_gdb加载python脚本的方法
脚本名称为hello.py,内容如下:
import gdb
class HelloPrefixCommand( gdb.Command ):
"just to say hello"
def __init__(self):
super( HelloPrefixCommand, self).__init__("hello",
gdb.COMMAND_SUPPORT,
gdb.COMPLETE_NONE, True )
HelloPrefixCommand()
加载方法1:
sudo gdb httpd -x hello.py
查看一下:
(gdb) help hello
just to say hello
List of hello subcommands:
Type "help hello" followed by hello subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
加载方法2:
(gdb) source hello.py
查看一下:
(gdb) help hello
just to say hello
List of hello subcommands:
Type "help hello" followed by hello subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
本文同步分享在 博客“debugeeker”(CSDN)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。
总结
以上是生活随笔为你收集整理的gdb加载python_gdb加载python脚本的方法的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: springboot 按钮权限验证_sp
- 下一篇: python入门教程收藏_python入