microsoft / php-sdk-binary-tools

Tool kit for building PHP under Windows
BSD 2-Clause "Simplified" License
271 stars 78 forks source link

Php and extension debugging under windows #43

Closed kratosok closed 6 years ago

kratosok commented 6 years ago

Hi!

Im compiling and building an extension for php. It works but there are some scenarios (php scripts) where it crashes with no information logged. I've loved this repo for easily giving the ability to build. I was also able to include debugging symbols for php and the extension. I haven't been able to find any material on how to debug php and extensions on Windows under visual studio or visual studio code.

Would you have any insight or resources you could share?

weltling commented 6 years ago

Could you please tell more about how you build and load your extension? Usually there's nothing different from debugging any other program.

Thanks.

kratosok commented 6 years ago

Sorry for the open ended question, I'm just not familiar with Visual studio this is my first brush with it. I'm trying to compile 7.1.10 from source with a modified version of vld. I'd like to debug php-cgi and the modified vld extension. Most of the tutorials I've seen just show creating a new project and it will automatically setup the debugging configuration for you.

Using the php-sdk2, I've been able to run buildconf, configure --disable-zts, --enable-cgi --enable-vld=shared and then nmake. There's also an option for enabling debug symbols, I enabled that as well. Some scripts will run properly with php.exe -dvld.active=1 testscript.php. where as some will quietly fail despite verbose logging. Debugging with Visual studio seems to be the way forward.

The buildconf/configure/nmake doesn't seem to create a project/workspace that visual studio 2015 gui will read to setup debugging automatically.

I found brief instruction on attaching to a running generic process with visual studio for debugging, but It seemed to freeze.

I'm looking for either some way to create a visual studio importable workspace/project with debugging configured, or documentation on how to manually setup debugging with visual studio 2015 and any suggestions on how to debug php-cgi.exe on windows with iis.

kratosok commented 6 years ago

oh yea, VLD is also set to load in the php.ini btw.

weltling commented 6 years ago

Thanks for the further info. It looks like you put your extension into the PHP source tree. In that case, the following workflow were thinkable

The PHP build system doesn't generate any IDE projects, it only works with makefiles. To create a Visual Studio project, check a plugin named "PDB project".

That's in general it. As you're new to Visual Studio, going through the official documentation and some tutorials is strongly recommended. That also regards to some more advanced topics like debugging under IIS.

Thanks.

weltling commented 6 years ago

As there's no more activity here, i assume your issue is fixed.

Thanks.