Page 1 of 1

Breakpoints within functions of non *.php files not hit

PostPosted: September 6th, 2013, 8:04 pm
by srwebb
Hello,

I'm using PHP Tools and trying to debug the code for a Drupal site. I'm having an issue with the debugger in functions that are within files with extensions other than .php.

In .inc and .module files breakpoints placed on the line where a function is declared are being hit, but any breakpoints within the function are skipped. The Step Into (F11) debugger command doesn't step into the current function, it just jumps to the next one.

If the function is within a .php file breakpoints within functions are working fine.

Is there any way I can get this to work? PHP Tools is the easiest way I've found so far to debug a Drupal multisite configuration on a Windows box. If I could just resolve this one issue it would be darn near perfect!

Thanks,
Steven

Re: Breakpoints within functions of non *.php files not hit

PostPosted: September 7th, 2013, 4:05 pm
by Miloslav Beno
Hello Steven,

Thanks for writing us!

Have you registered the other extensions in Visual Studio for PHP Editor? (http://www.devsense.com/doc/phptools/options#extensions)

If you have registered them, I have couple more questions:

What versions of VS, PHP Tools, PHP and XDebug do you have?
What other visual studio extensions do you have?
What server do you use?

Thanks,

Re: Breakpoints within functions of non *.php files not hit

PostPosted: September 11th, 2013, 2:31 pm
by srwebb
Thanks for the response.

After some more testing it looks like the issue only comes up in projects using Drupal code. I created a simple test project with functions in .inc and .module files, and those breakpoints were hit.

Specifically I'm trying to hit breakpoints within custom Drupal modules I'm developing. If I set any breakpoints on a function definition line in a module, the breakpoint is hit only when Drupal loads the module using include_once(), which is strange because the functions aren't actually being called at this point. If I perform an action on the site that actually calls a module function, the breakpoints are not hit. And breakpoints within functions are never hit either way.

I have registered the inc and module extensions with the PHP Editor in VS. I am getting code highlighting and intellisense for these files.

For the server I've tried both using the IIS Express option and connecting to a separate Apache server running locally. The behavior is the same in both cases.

I'm using:
  • VS Ultimate 2012
  • PHP Tools 1.8.4504
  • PHP 5.3.13
  • XDebug php_xdebug-2.2.3-5.3-vc9-nts.dll (IIS Express), php_xdebug-2.2.3-5.3-vc9.dll (Apache)

The extensions I have installed are:
  • AnkhSVN
  • Microsoft Web Developer Tools
  • NuGet Package Manager
  • PHP Tools
  • Visual Studio Extensions for Windows Library for JavaScript

Re: Breakpoints within functions of non *.php files not hit

PostPosted: September 13th, 2013, 5:05 pm
by Miloslav Beno
Thank you for detailed description.

If you set a breakpoint on the function definition line, PHP debugging actually breaks on it once the function is declared. So you get breakpoint hit once include_once is called and the file is parsed. And no code doesn't have be called, but functions are declared. This is different than e.g. in .NET language.

About breaking inside the actual function definition body.... Could you please provide me example when it doesn't break? I've installed newest release of drupal so I can try it out. Is it possible that drupal somehow cache their function output so they don't get called more than once in some cases?

Thank you,