Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Zend debugger not stopping at brakepoints + bugfix ?
Zend debugger not stopping at brakepoints + bugfix ? [message #22841] Tue, 22 May 2007 10:38 Go to next message
Eclipse UserFriend
Originally posted by: bobbymihalca.yahoo.com

While xdebug is great and fast i still need zend debugger sometimes (
more peoples working on the same project)

The Problem:
As probably everyone knows zend debugger has a problem respecting
brakepoints for a setup like this:
project
public_html
framework
code
and since the problem is there for a while and no signs of things
changing i took a look into the sources and this is what i found:
1 - In this case in PHPDebugTarget constructor contextRoot is garbage (
a part of the site name)
2 - when it sends the brakepoint to php the file name is something like
this c:\xampp\htdocs\project\public_html\te.dev.com\code\dispache r.php
witch of course zend can't find and brakepoint is not actually set.

The Solution:
First thing was to put in PHPDebugTarget's constructor contextRoot="";
so now brakepoint file was like this:
c:\xampp\htdocs\project\public_html\code\dispacher.php
2nd thing i needed to do is get rid of \public_html\ ( and eventually
other upper dirs if project on more than 2 levels)
For this i noticed that ServerDebugHandler a method named getHTDocs
witch returns the path for htdocs in apache. I modified this method to
remove \public_html\ and VOILA it works.

The Diff:
Index: PHPDebugTarget.java
============================================================ =======
RCS file:
/cvsroot/tools/org.eclipse.php.debug.core/src/org/eclipse/ph p/internal/debug/core/model/PHPDebugTarget.java,v
retrieving revision 1.4
diff -r1.4 PHPDebugTarget.java
112c112,113
<
---
> contextRoot="";
>
Index: ServerDebugHandler.java
============================================================ =======
RCS file:
/cvsroot/tools/org.eclipse.php.debug.core/src/org/eclipse/ph p/internal/debug/core/model/ServerDebugHandler.java,v
retrieving revision 1.5
diff -r1.5 ServerDebugHandler.java
31a32
>
103a105,112
> if (!fDebugTarget.isPHPCGI())
> {
> try {
> String projectLocation =
ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( new
Path(fileName)).getProject().getLocation().toOSString();
> String fileLocation = fileName.substring(0,index);
> if(fileLocation.length()>projectLocation.length()) index-=
fileLocation.length()-projectLocation.length();
> } catch (Exception e) { }
> }


Note:
I used last nightly build and sources from cvs to rebuild
org.eclipse.php.debug.core
Re: Zend debugger not stopping at brakepoints + bugfix ? [message #22971 is a reply to message #22841] Tue, 22 May 2007 13:10 Go to previous message
Eclipse UserFriend
Originally posted by: bobbymihalca.yahoo.com

well that didn't work as expected :( it turns out that it only works
when the project is on the same path and machine with apache and don't
work on different/remote machine. So i cocked up something else that
looks it does the job.
For this to work one must set in debug lunch File/Project to
project/public_html or project/public_html/index.php.
The patch will look for this and will try to take out public_html from
server file name so will not dup anymore.

The Diff:
Index: PHPDebugTarget.java
============================================================ =======
RCS file:
/cvsroot/tools/org.eclipse.php.debug.core/src/org/eclipse/ph p/internal/debug/core/model/PHPDebugTarget.java,v
retrieving revision 1.4
diff -r1.4 PHPDebugTarget.java
112c112,113
<
---
> contextRoot="";
>
Index: ServerDebugHandler.java
============================================================ =======
RCS file:
/cvsroot/tools/org.eclipse.php.debug.core/src/org/eclipse/ph p/internal/debug/core/model/ServerDebugHandler.java,v
retrieving revision 1.5
diff -r1.5 ServerDebugHandler.java
13a14
> import org.eclipse.core.resources.IProject;
103a105,129
> if (!fDebugTarget.isPHPCGI())
> {
> try {
> String debuggedFileName =
fDebugTarget.getLaunch().getLaunchConfiguration().getAttribu te( "file_name",
"");
> int iUPrjEnd = -1;
> if(debuggedFileName.startsWith("/")) iUPrjEnd =
debuggedFileName.indexOf('/',1);
> else iUPrjEnd = debuggedFileName.indexOf('/');
> if(iUPrjEnd>=0)
> {
> String debuggedProject = debuggedFileName.substring(0,iUPrjEnd);
> debuggedFileName = debuggedFileName.substring(iUPrjEnd);
> IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(debugged Project);
> if(project.getFile(new Path(debuggedFileName)).exists())
> {
> debuggedFileName =
debuggedFileName.substring(0,debuggedFileName.lastIndexOf("/ "));
> }
> String htdocs = systemFileName.substring(0, index);
> if(htdocs.length()>=debuggedFileName.length() &&
htdocs.substring(htdocs.length()-debuggedFileName.length()). equals(debuggedFileName))
> {
> htdocs =
htdocs.substring(0,htdocs.length()-debuggedFileName.length() );
> return htdocs;
> }
> }
> } catch (Exception e) { }
> }
Previous Topic:wrong syntax error
Next Topic:Multiple matching resource when focusing on class/function name
Goto Forum:
  


Current Time: Tue Apr 16 09:41:52 GMT 2024

Powered by FUDForum. Page generated in 0.88589 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top