Please refer the below details and update the port number as per your need -
Go to bin folder in crx-quickstart and change the line 25 in start.bat by adding the highlighted part here (address port number can be any number of your choice)
if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=10123
Change line no. 44 by adding this
set CQ_RUNMODE=%CQ_RUNMODE%,crx3,crx3tar,debug
Save the file.
Once saved open the command prompt, go to \crx-quickstart\bin and type “start.bat”, once it’s done you’ll see another window of cmd being opened and the server will start in debug mode as seen below

Check if the server is started or not by opening localhost:4502 in the browser
Setting up the debug config in eclipse
Go to Run -> Debug Configurations -> Remote Java Application
Set up a new configuration like seen below by selecting the project (mostly it’ll be core) and click Debug

Check if Debug is working fine or not by having the Debug view

Eclipse by default will suspend execution on uncaught exceptions which will debug the code which we haven’t even selected. This will waste our time. So please do this to avoid it
Go to Windows - > Preferences -> Java -> Debug and uncheck “Suspend execution on uncaught exceptions”

Set debug points in your code and explore!