在netbeans的项目中的xdebug [英] xdebug across projects in netbeans

查看:103
本文介绍了在netbeans的项目中的xdebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是情况..我有一些类在一个项目...我的主要代码是在另一个项目...我拆分了,因为我使用GIT作为我的SCM ...所以当我调试我的主要代码...我想进入课程并调试它们,但是xdebug不会让我进入他们...我认为它是因为类在另一个项目...任何想法? / p>

提前感谢...

解决方案

这也是。我将假设您的项目部署时的方式是将单独项目中的类复制到主代码中的某个目录。



让我们假设单独的项目只包含一个类, Foo ,为了简单起见。让我们假设, Foo 存在于目录中的部署主要代码中,文件 /maincode/external/lib/Foo.php 。最后,假设 / maincode / external / lib 作为版本控制的主代码项目中的目录,并且只包含一个占位符文件,否则为空。



首先,使用git提供的许多方法之一来忽略 / maincode / external / lib 目录在该项目的NetBeans项目目录中。我们要让它看起来像它包含一些东西,我们不希望这个目录,否则应该是空的,以便错误地提交变更。



现在忽略它,在另一个项目中,在该目录中创建一个符号链接到 Foo.php 。在Unix中,您需要 ln 命令,例如

  ln -s /path/to/project/files/MyFooProject/Foo.php Foo.php 

在Windows中,您正在寻找 mklink 命令,例如



  mklink Foo.php C:\path\to\project\files\MyFooProject\Foo.php 

让NetBeans等待一两个时间来考虑它(或者通过调用扫描外部更改来强制该问题 命令在源菜单中),你应该看到 Foo.php 显示在你所做的符号链接的maincode项目中。



现在,当您通过执行跟踪,需要进入Foo.php以查看Foo类正在做什么时,您将进入maincode项目中的一个。然而,由于它是MyFooProject项目中的文件的象征性链接,所以您所做的任何改变都将被反映在那里。



只需确定取消链接所有内容(Unix中正常的 rm commmand,Windows中通常的 del 命令,但在符号链接的目录中是!)当你通过另外,如果目录中存在您想要提交的目录中的某些内容,请忽略该目录。



如果您需要这样做不止一个文件,那么可以链接整个目录。如果,而不是上述,您通常将MyFooProject的内容复制到部署版本中的目录 / maincode / external / lib / myfoo / 中,然后链接像你这样做的文件就像你这样做的。例如,在Windows中,

  cd \path\to\project\files\maincode\external\\ \\lib 
mklink / D myfoo C:\path\to\project\files\MyFooProject

这将创建一个符号目录链接。已经有一段时间了,因为我在Unix上做过类似的操作,所以我不记得那个操作系统上同样的东西的确切命令(或者Unix上甚至是符号目录链接)。一旦目录被链接,你应该看到新的目录加上所有的文件和子目录显示在你的NetBeansmaincode项目中,准备执行跟踪的乐趣。



<再一次,一旦你完成了,请记住取消链接并忽略所有内容,以免第二天早上醒来,发现自己感到困惑。 :)要解除Windows中的目录...

  cd \path\to\project\files\ maincode\external\lib 
rmdir myfoo

它应该取消链接。 (只需要小心,当你删除和rmdir'ing你正在做它的符号链接!)


Here is the situation.. I have some classes that are in one project... My main code is in another project... and i split this up because i am using GIT as my SCM... So when i debug my main code... i would like to step into the classes and debug them, but xdebug won't let me step into them... and i assume its because the classes are in another project... any ideas?

Thanks in advance...

解决方案

I've run into this as well. I am going to assume that the way your projects look when they are deployed is that the classes in the separate project are copied into some directory somewhere in the main code.

Let's assume the separate project contains only one class, Foo, for simplicity's sake. Let's assume, too, that Foo is present in the deployed "main code" in the directory and file /maincode/external/lib/Foo.php. Finally, let's assume that /maincode/external/lib exists as a directory in your version-controlled "main code" project, and that it contains only a place-holder file and is otherwise empty.

First, use one of the many methods git provides to ignore the contents of the /maincode/external/lib directory in your NetBeans project directory for that project. We're going to make it look like it contains some stuff, and we don't want this directory, that is otherwise supposed to be empty, to get changes committed to it by mistake.

Now that it is ignored, make a symbolic link in that directory to Foo.php over in the other project. In Unix, you want the ln command, e.g.

ln -s /path/to/project/files/MyFooProject/Foo.php Foo.php

In Windows, you are looking for the mklink command, e.g.

mklink Foo.php C:\path\to\project\files\MyFooProject\Foo.php

Give NetBeans a moment or two to think about it (or force the issue by invoking the "Scan for external changes" command in the "Source" menu), and you should see Foo.php show up in the "maincode" project where you made the symbolic link.

Now, when you are tracing through execution and need to step into Foo.php to see what the Foo class is doing, you will step into the one that is in the "maincode" project. Since it is a symbolic link over to the file in the "MyFooProject" project, however, any chanes you make will be reflected over there.

Just be sure to unlink everything (the normal rm commmand in Unix, and the usual del command in Windows, but in the directory where the symbolic link is!) when you are through. Also, if there were things in the directory that you ignored that you want to be able to commit, then un-ignore that directory.

If you need to do this for more than just one file, then you can link whole directories. If, instead of the above, you normally copy the contents of "MyFooProject" into the directory /maincode/external/lib/myfoo/ in the deployed version, then just link the appropriate directory like you did the file above. In Windows, for example,

cd \path\to\project\files\maincode\external\lib
mklink /D myfoo C:\path\to\project\files\MyFooProject

That will make a symbolic directory link. It has been a while since I did anything like that on Unix, so I don't remember the exact command for the same thing on that OS (or if symbolic directory links are even possible on Unix). Once the directory is linked, you should see the new directory plus all of the files and subdirectories show up in your NetBeans "maincode" project, ready for your execution-tracing pleasure.

Again, remember to unlink and un-ignore everything once you are done, lest you wake up the next morning to find yourself confused. :) To unlink the directory in windows...

cd \path\to\project\files\maincode\external\lib
rmdir myfoo

and it should unlink. (Just be careful when you are deleteing and rmdir'ing that you are doing it to the symbolic link!)

这篇关于在netbeans的项目中的xdebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆