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
- 下一篇: mysql中如何求字段的个数字_求高手帮