开发者

How to make gdb run a user-defined function (defined in .gdbinit) everytime it starts?

开发者 https://www.devze.com 2022-12-14 16:08 出处:网络
I have a set of basic breakpoints defined in a user-defined fn setup in my .gdbinit. So, every time i start gdb, I have to execute that fn. to开发者_如何学编程 set all my brkpoints , before I start de

I have a set of basic breakpoints defined in a user-defined fn setup in my .gdbinit. So, every time i start gdb, I have to execute that fn. to开发者_如何学编程 set all my brkpoints , before I start debugging. Can I configure my .gdbinit so that whenever it starts , it first executes my user-defined fn setup ?


Just call it by function name:

My .gdbinit:

define setup    
  echo Foobar\n
end   

setup #This is the function call

And when I run it:

$ gdb
GNU gdb Fedora (6.8-37.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Foobar
(gdb) 
0

精彩评论

暂无评论...
验证码 换一张
取 消