gdb provides several mechanisms for extension. gdb also provides the ability to automatically load extensions when it reads a file for debugging. This allows the user to automatically customize gdb for the program being debugged.
To facilitate the use of extension languages, gdb is capable of evaluating the contents of a file. When doing so, gdb can recognize which extension 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
set script-extension soft
set script-extension strict