refactor build_debug.cpp