How to crash Firebird server

Sometimes it is necessary to crash Firebird server engine, to create a dump file or check the reliability of your backup/replication scheme, or for debugging purposes.
In order to provoke the crash on Windows, you can use the following UDF: badudf.dll.7z
Download it, put to the UDF folder, and create the .bat file with the following contents:

@echo off
setlocal enabledelayedexpansion enableextensions

set fbc=C:\HQBird25\bin
set dbnm=%~dp0tmptest.fdb.tmp
set usr=SYSDBA
set psw=masterkey

del  2>nul
echo create database 'localhost:!dbnm!' user '!usr!' password '!psw!'; | "!fbc!\isql.exe" -q -z

    echo set echo on;
    echo declare external function crashme
    echo returns int by value
    echo entry_point 'crashme' module_name 'badudf';
    echo commit;

    echo show function;

    echo select crashme(^) from rdb$database;
) > %~dp0tmptest.sql.tmp

"!fbc!\isql.exe" ^
    localhost:!dbnm! ^
    -q -i %~dp0tmptest.sql.tmp ^
    -user !usr! -pas !psw!
del !dbnm!
del %~dp0tmptest.sql.tmp
In the script, assign to the environment variable fbc the path to the Firebird folder, for example
c:\Firebird25\bin or C:\Firebird30
and your actual superuser login and password (SYSDBA/masterkey is default) to variables usr and psw.

The script will create the temporary database, register UDF in it and execute "killer query", after that it deletes the database.
The result will be Firebird crash and if you have set up Windows Error Reporting properly, the dump of firebird.exe process.
Please don't register BadUDF.dll in the production database!
​Also, delete it from UDF folder after the experiment.