In D which has CTFE support since ages, you'd debug such functions by invoking them at runtime.
https://tour.dlang.org/tour/en/gems/compile-time-function-ev...
There are also tools to print values at compile time.
A compile time debugger for the CTFE interpreter is on our extended feature list for the current interpreter rewrite, but it's less of a priority atm.