gdb provides two mechanisms for extension. The first is based on composition of gdb commands, and the second is based on the Python scripting language.
To facilitate the use of these 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 offset script-extension softset script-extension strictshow script-extensionscript-extension option.