In this section:
Depending on the location of the application files, CLion distinguishes between the following two debugging modes:
Debugging applications running on the built-in server. In this mode, the application files remain where they are in the CLion project on you machine.
CLion runs them on the built-in Web server with the root URL
http://localhost:<built-in server port>/<project root>. The built-in server port (1024 or higher) is specified on the Debugger page of the Settings dialog box.
Debugging applications running on a remote external server. In this mode, the application files are on an external web server
outside your CLion project root and you have their copies in your project.
No matter, whether the web server itself is running on a physically remote host or on your machine,
application files deployed on it are treated as remote, see Working with Web Servers: Copying Files for details.
You can deploy the application files to a web server and launch the application yourself or debug an already running application. In either case, a debugging session can be initiated only through a permanent debug configuration that you have to define yourself manually.
Debugging applications running on the built-in server is supported for Firefox, version 36 an higher, through the Firefox Remote debug configuration. Debugging applications running on external web servers in Firefox is not supported at all.
Debugging an application running on the built-in server in Firefox
Enable debugging in Firefox:
- Open your Firefox browser, then open .
- In the Development Tools pane that opens, click Toolbox Options button on the toolbar and select the Enable remote debugging check box under Advanced Settings.
In the console at the bottom of the browser (the console appeared opened when you opened the Developer toolbar),
listen <port number>. You can specify any port number, however it is recommended that you use 6000 and higher. Later you will specify this port number in the run configuration.
Create a run/debug configuration:
- Choose on the main menu
- In the Edit Configuration dialog box that opens, click the Add New Configuration toolbar button , and choose Firefox Remote on the context menu. Do not feel mislead by the term Remote. In this context it reflects the technical details of the implementation.
In the Run/Debug Configuration: Firefox Remote dialog box that opens, specify the host where the application is running
(currently it is always
localhost) and the port the debugger will listen to. It must be the port that you specified when enabling debugging in Firefox. The default value is 6000.
- Click OK to save the configuration settings.
- Set the breakpoints where necessary.
- Choose the newly created configuration in the Select run/debug configuration drop-down list on the toolbar and click the Debug toolbar button . In the dialog bo that opens, click OK to allow incoming connections. From the Choose Page to Debug pop-up list, choose the page with your application.
- Refresh the page with your application in Firefox: the page shows the results of code execution up to the first breakpoint.
- In the Debug tool window, proceed as usual: step through the program, stop and resume program execution, examine it when suspended, view actual HTML DOM, edit the code, etc.