Debugging Jenkins pipelines and shared library

We are using both scripted and declarative pipelines. In CI flow we are using Jenkinsfile and in some other flows we are using Jenkins GUI pipelines which triggers different functionality from shared library. Our shared library is divided to vars and Src where all our classed are located and vars where we have common pipelines steps we use.

We are interested in finding a way that will allow us to set breakpoints and debug Jenkins pipelines and shared library including src classes and vars flows.