This guide will use the Cloud functions Node.js emulators (since this allows the use of attaching to a debugger) From what I can tell, neither firebase serve nor cloud functions shell allow this functionality.
Install the Cloud functions Node.js emulator following this guide https://cloud.google.com/functions/docs/emulator
start the emulator
functions start