reimplement pDebug as protocal.js