How to store user-defined function in GDB?

Advertisements

After i quit GDB every user-defined function disappear. Im sure there should be some way to make it available between sessions.

>Solution :

GDB reads the following files before starting: ~/.config/gdb/gdbinit, ~/.gdbinit.

It is a common practice to edit e.g. ~/.gdbinit to define the user-defined function using an external editor and use source ~/.gdbinit in a GDB session to reload that file. Once the function works as you expect, just leave it in your ~/.gdbinit and it will be available in all future GDB sessions.

Leave a ReplyCancel reply