Remove all breakpoints (or at least uncheck them) at Run View Breakpoints, leaving only the Exception one. Remove all debug watches if any. Update Xdebug to 2.9.4. Created April 07, 2020 11:49. Comment actions. By default Xdebug will now show variable information in the stack traces that it produces. Variable information can take quite a bit of resources, both while collecting or displaying. However, in many cases it is useful that variable information is displayed, and that is why Xdebug has the setting xdebug.collectparams.
If a fatal error occurs while your program is being debugged, PHP Tools breaks on it by default. A fatal error is an error which prevents the continuation of the script execution, e.g. a parse error or an unhandled exception.
In this case the debugger can be used to inspect the current program state. If you continue or step, the exception will continue to be thrown until it is either handled or you exit the program.
Some fatal errors (e.g. user-unhandled exception) are raised outside of the running context after the script has finished. The inspection of the program state, in this case, does not work because the script is not running anymore.
You can choose to break on any exception immediately when thrown. These settings can be modified in the Exceptions dialog. On the Debug menu, click Exceptions, and expand the PHP Exceptions entry. Here you can see all the exceptions that are already known and can be configured.
To configure an exception that does not appear in this list, click the Add button
to add it. The name must match the full name of the exception precisely.
The right-hand checkbox ('Thrown') for each exception controls whether the debugger always breaks when it is raised. You should check this box when you want to break more often for a particular exception.
Common issues
Stepping through code works, but PHP exceptions are not thrown in Visual Studio
Check your php.ini
for xdebug.default_enable directive
and make sure it is set to 1
(this is a default value).
Xdebug debugger client for Sublime Text 2 and 3
Details
Installs
- Total140K
- Win78K
- Mac32K
- Linux30K
Apr 25 | Apr 24 | Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | Apr 6 | Apr 5 | Apr 4 | Apr 3 | Apr 2 | Apr 1 | Mar 31 | Mar 30 | Mar 29 | Mar 28 | Mar 27 | Mar 26 | Mar 25 | Mar 24 | Mar 23 | Mar 22 | Mar 21 | Mar 20 | Mar 19 | Mar 18 | Mar 17 | Mar 16 | Mar 15 | Mar 14 | Mar 13 | Mar 12 | Mar 11 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 9 | 14 | 17 | 11 | 18 | 13 | 20 | 10 | 17 | 14 | 17 | 16 | 15 | 12 | 16 | 10 | 22 | 21 | 15 | 21 | 15 | 14 | 11 | 15 | 15 | 17 | 21 | 18 | 14 | 12 | 15 | 16 | 18 | 20 | 21 | 10 | 14 | 17 | 24 | 23 | 25 | 14 | 13 | 18 | 22 | 15 |
Mac | 4 | 2 | 5 | 6 | 2 | 9 | 6 | 1 | 2 | 5 | 2 | 4 | 3 | 3 | 3 | 0 | 4 | 8 | 1 | 4 | 5 | 3 | 1 | 3 | 5 | 4 | 3 | 5 | 2 | 3 | 4 | 8 | 3 | 5 | 3 | 5 | 4 | 5 | 6 | 3 | 8 | 4 | 1 | 0 | 3 | 2 |
Linux | 1 | 7 | 2 | 2 | 3 | 4 | 6 | 2 | 4 | 4 | 1 | 4 | 4 | 11 | 1 | 2 | 9 | 2 | 1 | 3 | 3 | 3 | 4 | 6 | 4 | 5 | 7 | 3 | 2 | 3 | 7 | 5 | 7 | 8 | 7 | 8 | 4 | 7 | 9 | 10 | 8 | 6 | 4 | 3 | 6 | 3 |
Readme
- Source
- raw.githubusercontent.com
Xdebug debugger client integration for Sublime Text.
Based on the Xdebug protocol functionality in SublimeXdebug package by Kindari.
Overview
Features
- Remote debugging by configuring path mapping
- Navigate on breakpoint hit to relevant file on specific line, when found on local drive
- Customizable debugging layout for displaying stack history and context variables with syntax
- Overview of breakpoints in all files and disable/enable breakpoints with simple click
- Evaluate code within the current execution context, by setting watch expressions
- Inspect (nested) context variables
- Works on both Sublime Text 2 and 3
Commands
Here is a complete list of commands you can find Command Palette under the Xdebug
namespace or in the menu under Tools / Xdebug
:
Start/Stop debugging session
- Start Debugging - Ctrl+Shift+F9 or ⌘+Shift+F9
- Start Debugging (Launch Browser)
- Restart Session
- Stop Debugging - Ctrl+Shift+F10 or ⌘+Shift+F10
- Stop Debugging (Launch Browser)
- Stop Debugging (Close Windows)
Launch Browser menu option will only show if you have an url configured within settings.
Breakpoints
- Add/Remove Breakpoint - Ctrl+F8 or ⌘+F8
- Set Conditional Breakpoint - Shift+F8
- Clear Breakpoints
- Clear All Breakpoints
Watch expressions
- Set Watch Expression
- Edit Watch Expression
- Remove Watch Expression
- Clear Watch Expressions
Session commands
- Evaluate
- Execute
- Status
Continuation commands
- Run - Ctrl+Shift+F5 or ⌘+Shift+F5
- Run To Line
- Step Over - Ctrl+Shift+F6 or ⌘+Shift+F6
- Step Into - Ctrl+Shift+F7 or ⌘+Shift+F7
- Step Out - Ctrl+Shift+F8 or ⌘+Shift+F8
- Stop
- Detach
Other
- Restore Layout / Close Windows - Ctrl+Shift+F11 or ⌘+Shift+F11
- Settings - Default
- Settings - User
Xdebug Break On Exception Codes
Installation
Package Control
Execute “Package Control: Install Package” in the Command Palette to retrieve a list of available packages.Search in the list and install package Xdebug Client
.
Git
Clone the repository by executing the following command in your Packages directory:
Download
Get the latest source from GitHub and extract the source into your Packages directory.
Note: You can locate your Packages directory in the menu underPreferences / Browse Packages..
Xdebug
In order to be able to debug your PHP scripts, you will need have Xdebug extension installed on your server.See here for installation instructions
Below is a configuration template for php.ini/xdebug.ini, be warned if you are on a Live environment, remote_connect_back allows every debug request from any source to be accepted.
For details about all available settings for configuring Xdebug, see here. Onenote slack integration.
Configuration
The following settings can be configured in Xdebug.sublime-settings or in *.sublime-project files:
path_mapping
For remote debugging to resolve the file locations it is required to configure the path mapping with the server path as key and local path as value.
url
Determine which URL to launch in the default web browser when starting/stopping a session.
ide_key
An IDE key is used to identify with debugger engine when Sublime Text will start or stop a debugging session.
This package does not filter sessions by IDE key, it will accept any IDE key, also ones that do not match this configured IDE key. It is merely used when launching the default web browser with the configured URL.
host
Host address of network interface which Sublime Text should listen to connect with debugger engine.
When specifying host address of network interface, be sure to specify an IPv4 address as Sublime Text will listen for connections through an IPv4 socket.
port
Which port number Sublime Text should listen to connect with debugger engine.
max_children
Maximum amount of array children and object's properties to return.
max_data
Maximum amount of variable data to initially retrieve.
max_depth
Maximum amount of nested levels to retrieve of array elements and object properties.
break_on_start
Break at first line on session start, when debugger engine has connected.
break_on_exception
Break on exceptions, suspend execution when the exception name matches an entry in this list value.
close_on_stop
Always close debug windows and restore layout on session stop.
super_globals
Show information about super globals in context view.
fullname_property
Display property by fullname in context view.
hide_password
Do not show possible password values in context view.
pretty_output
Render evaluated result as parsed output instead of raw XML.
launch_browser
Always launch browser on session start/stop.
This will only work if you have the 'url' setting configured.
browser_no_execute
When launching browser on session stop do not execute script.
By using parameter XDEBUG_SESSION_STOP_NO_EXEC instead of XDEBUG_SESSION_STOP.
Xdebug Break On Exception List
disable_layout
Do not use the debugging window layout.
debug_layout
Window layout that is being used when debugging.
breakpoint_group
breakpoint_index
context_group
context_index
stack_group
stack_index
watch_group
watch_index
Cossacks 3 build order. Group and index positions for debug views.
breakpoint_enabled
breakpoint_disabled
breakpoint_current
current_line
Custom gutter icons for indicating current line or enabled/disabled breakpoints.
Do not use same icon for above values, because Sublime Text is unable to use the same icon for different scopes, in case there are duplicate icons detected it will fall back to the corresponding icon in the package.
python_path
Path to Python installation on your system.
Which is being used to load missing modules.
debug
Show detailed log information about communication between debugger engine and Sublime Text.
Below are examples how to configure your Xdebug.sublime-settings and *.sublime-project files.
Xdebug.sublime-settings
*.sublime-project
Troubleshoot
Can I have both SublimeTextXdebug and SublimeXdebug installed?
No. Having installed both packages can cause conflicts, because they might both listen to the same port for a debugger engine response and have similar keymapping.
However (project) settings from SublimeXdebug are compatible with SublimeTextXdebug.
How can I start a debugging session?
SublimeTextXdebug can start or stop a debugging session by launching the default web browser with the configured URL and parameter XDEBUG_SESSION_START
or XDEBUG_SESSION_STOP
which uses the configured IDE key as value. By default the IDE key is sublime.xdebug
.
When you do not configure the URL, the plugin will still listen for debugging connections from Xdebug, but you will need to trigger Xdebug for a remote session.
If you want to run a start a debugging session from command line, before you run your script, you will need to set the environment variable XDEBUG_CONFIG with the IDE key.
Windows
UNIX
Make sure before defining the environment variable you have switched to the proper user environment.
As example you would set the environment variable as guest and execute the script as root(sudo), then root will not have the environment variable XDEBUG_CONFIG that was defined by guest.
How do I set a breakpoint and/or watch expression?
With SublimeTextXdebug you can easily add/remove breakpoints, which are send on session start.
Or set/edit/remove watch expressions, that are evaluated in the current execution context.
Setting a conditional breakpoints or watch expressions is quite easy, it is like an if statement in PHP.
As example you only want to stop on breakpoint when value of $number is equal to 13, then your Breakpoint condition would be $number13
.
Another example would be when you would like to know the value of $item['image'] on each break, then your Watch expression would be $item['image']
.
Another way is to set the breakpoint in your PHP code with the following function xdebug_break()
.
How to configure or disable breaking on exceptions?
By default the execution of a debugging session is suspended on each of the following exception names:* “Fatal error” - E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR* “Catchable fatal error” - E_RECOVERABLE_ERROR (since PHP 5.2.0)* “Warning” - E_WARNING, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING* “Parse error” - E_PARSE* “Notice” - E_NOTICE, E_USER_NOTICE* “Strict standards” - E_STRICT* “Deprecated” - E_DEPRECATED, E_USER_DEPRECATED (since PHP 5.3.0)* “Xdebug”* “Unknown error”
In order to specify which exception names to suspend the execution of a debugging session, configure the break_on_exception
setting with a list of the specific exception names by choice from the list shown above.
It is also possible to specify custom exceptions instead of all exceptions (“Fatal error”). For example if you would configure “MissingArgumentException” instead of “Fatal error”, it would not break on “InvalidParameterException”.
To disable breaking on exceptions either configure an empty list break_on_exception: []
or set as break_on_exception: false
.
How can I customize/disable the debugging layout?
Re-adjust the layout in Sublime Text to your liking and then in console (Ctrl+`) you type window.get_layout()
and set that value as your debug_layout
.
Further customizing can be done by assigning the Xdebug views to a group/index with the breakpoint_group
, breakpoint_index
, context_group
, context_index
, stack_group
, stack_index
, watch_group
, watch_index
settings.
Or you can disable the debugging layout by setting disable_layout: true
, which will open all Xdebug views in current active group/window on session start and does not change your layout.
How to solve ImportError
?
Older versions of Sublime Text do not come with Python bundled and rely on your Python system installation.
Some systems do not include specific modules which are required by this package, such as pyexpat.
Configure the python_path
setting to the path of your Python installation on your system which is either newer or has all required modules. For example: 'python_path' : '/usr/lib/python2.7'
.
What to do when you experience any issues?
First check following possible solutions that could resolve any issues:
- Use absolute paths in your
path_mapping
setting, Xdebug does not return symbolic links. - Breakpoint is on an empty line, Xdebug does not stop on empty lines.
- Set
port
and xdebug.remote_port to different port (9001), default port 9000 might already be used by an other application. - Add an exception for Sublime Text (plugin_host.exe) to your firewall, response from Xdebug could be blocked by firewall.
- Lower the
max_data
/max_depth
/max_children
settings to increase response speed or prevent crashing, Xdebug could return to much data to process. - Change permissions for Sublime Text and it's packages on your filesystem, Sublime Text or package might not have valid rights.
Do you still experience any issues, then create an issue including the following data:
- What operating system(s) and version of Sublime Text are you using?
- How did you install SublimeTextXdebug, Package Control, git clone or download?
- Are you trying to debug the script remotely or locally, through browser or command line?
- Which version of Xdebug extension do you have?
- Can you post your project/settings file and Xdebug configuration from the *.ini located on your server.
- Does the console window (Ctrl+`) show any more information regarding the error?
License
SublimeTextXdebug is released under the MIT License.