assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

fix: fix shadowstack pass discard debuginfo

Open HerrCai0907 opened this issue 1 year ago • 3 comments

In shadowstack pass, if some function need to add temp local, It need to be removed and re-added. It will discard all debug info because debug info bind with functionref.

This PR aims at re-assign the debug info after shadowstack pass

  • [x] I've read the contributing guidelines
  • [x] I've added my name and email to the NOTICE file

HerrCai0907 avatar Sep 02 '22 11:09 HerrCai0907

Would it perhaps be preferable to add a replaceFunction(..., preserveDebugInfo = true) helper of sorts that can be called instead of removing the function and adding a new one? I guess then we'd not need to remember intermediate state.

dcodeIO avatar Sep 02 '22 11:09 dcodeIO

Yeah, also prefer to update updateFunction(funcRef: FunctionRef) to updateFunction(funcRef: FunctionRef, preserveDebugInfo: bool)

or simply check this.options.debugInfo inside updateFunction

MaxGraey avatar Sep 02 '22 11:09 MaxGraey

Would it perhaps be preferable to add a replaceFunction(..., preserveDebugInfo = true) helper of sorts that can be called instead of removing the function and adding a new one? I guess then we'd not need to remember intermediate state.

You mean add this API in binaryen? I also agree it is more eleganta

HerrCai0907 avatar Sep 02 '22 15:09 HerrCai0907