Move the bits useful there from src/lib/commands/xdump.c to new include/xdump.h and src/lib/common/xdump.c.