4

GDB supports function by command define. I want to write a helper script for GDB, and I hope each function has a meaningful name and an alias, just like bt and backtrace.

Does GDB support this feature?

2 Answers 2

4

An example to complete matt's answer:

alias ir = info registers
ir

as documented at: https://sourceware.org/gdb/onlinedocs/gdb/Aliases.html

Unlike Bash aliases, you cannot pass arguments to the definition of those aliases, e.g.:

alias ir = info registers eax

The registers part is only accepted because it is not an argument, but a subcommand.

But you can pass arguments when using the alias:

ir eax

You can then list all currently defined aliases with:

help aliases
Sign up to request clarification or add additional context in comments.

Comments

2
(gdb) apropos alias
alias -- Alias one command to another
aliases -- Aliases of other commands

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.