Add missing debug.h include
_XOPEN_SOURCE_EXTENDED define is needed for key_name