dm: Add a panic_str() function to reduce code size