|php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login|
Unix | Windows
Generating a backtrace, with a compiler, on Windows
You'll need to install MS Visual Studio 2008, 2012 or later. You'll also need to
If you downloaded the debug-pack from the snaps site, extract it into your PHP directory and be sure to put the PDB files that belong to the extensions into your extension directory.
If you compile PHP by your own, you can also use a newer version of MSVC.
When PHP crashes, click Cancel to debug the process. Now MSVC starts up in Debug View. If you don't already see the call stack, go into the View menu and choose Debug Windows → Call Stack.
You'll now see something similar to the following lines, this is the backtrace:
Generating backtrace, without compiler, on Windows
For the sake of this example, we will simply use PHP in the shell. The same method can be used for IIS or any other process or services.
Once you have installed the Debug diagnostic tools and uncompressed PHP and its debug pack (they can be kept in two separate folders), the first step is to configure the diagnostic tools. Select the tools menu and click on "Options and settings". The first tab contains the path to the symbols files, add the "debug folder" to the existing list using the "browse" button:
Now we are ready to generate our backtrace.
We will use the wizard, click the "Add a rule" button and choose "Crash" as the rule type:
In the next window, select "a specific process":
Add a "sleep(10);" for the first run (from the cmd: "php.exe crashme.php"), it will let you enough time to click "next" and select the php process. If you are debugging the Apache module, start Apache with -X option and choose httpd.exe instead of php.exe from the process list. Then proceed further:
Click again next and let it crash. If everything went well, you should see your new rule as shown in the image below:
It also detected that "php.exe" was used. A rule has been created for all instance of "php.exe". It will save you the sleep and process selection.
Now you can click the "Analyze data" button:
Et voila, the complete report will show up in your internet explorer (compressed html):
What we need is the backtrace itself which can be found under "Thread X - System ID XXX".
Copyright © 2001-2020 The PHP Group
All rights reserved.
|Last updated: Sun Jun 07 10:01:24 2020 UTC|