Extending GDB - Debugging with GDB
Description: Debugging with GDB

Next: Interpreters, Previous: Controlling GDB, Up: Top

## 23 Extending gdb

gdb provides three mechanisms for extension. The first is based on composition of gdb commands, the second is based on the Python scripting language, and the third is for defining new aliases of existing commands.

To facilitate the use of the first two extensions, gdb is capable of evaluating the contents of a file. When doing so, gdb can recognize which scripting language is being used by looking at the filename extension. Files with an unrecognized filename extension are always treated as a gdb Command Files. See Command files.

You can control how gdb evaluates these files with the following setting:

`set script-extension off`
  All scripts are always evaluated as gdb Command Files.
`set script-extension soft`
  The debugger determines the scripting language based on filename extension. If this scripting language is supported, gdb evaluates the script using that language. Otherwise, it evaluates the file as a gdb Command File.
`set script-extension strict`
  The debugger determines the scripting language based on filename extension, and evaluates the script using that language. If the language is not supported, then the evaluation fails.
`show script-extension`
  Display the current value of the `script-extension` option.