Magento Code Debugging Through Eclipse PDT - eclipse

I am trying to debug Magento Code through Eclipse PDT. I configured X-Debugger properly and apply breakpoints in index.php file and launch the debugging session. I started debugging the code line by line but it get stop at last line of index.php file.
Actually i just want to debug the one-page checkout process of Magento. I have applied breakpoints in OnepageController.php file and gone through Onepage Checkout process but Eclipse does not stops at break points. Please help me.

I was busy for many days to find an installation (in 2012) for debugging Magento. Eclipse, Netbeans and PhpDeveloper all failed for XDebug (stopped only at first breakpoint) in a Xamp installation (my experience) and I could not load a ZendDebugger.dll as well. You find indeed a lot of outdated articles about this subject.
But finally I can debug Magento without problems (you need a debugger as a professional for Magento). I downloaded Zend Server CE and if you have a latest Eclipse PDT version downloaded (take the one from Zend) debugging works like a charm (all settings are done already by Zend, so no mistakes and wasting of time anymore). You should see when a webpage had finished that the php program had terminated (no error, is normal, for a next page php programs are started again). One problem yet Connect Manager does not install extensions anymore, BUT while debugging admin it works too (yes funny, but that’s Magento, it takes all your time). You can debug admin by adding /admin to the url in the debug browser window (just that simple).

Now the debugger is working fine, i think the problem was occurring due to wrong configuration of eclipse PDT. To know how to configure eclipse PDT and X-debugger
please visit
http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/
http://subesh.com.np/2010/01/debugging-magento-eclipse-pdt-zend-debugger/

Related

How can I debug why eclipse won't start?

I've been having trouble getting a weblogic server to run in eclipse, which have resulted in me not being able to open eclipse ni my current workspace at all. It is not my first attempt to work with weblogic servers in eclipse, and I do not know why it suddenly decided to stop working. I have had multiple errors, which all seem to be related to an abnormal high memory consumption.
One of my last errors, before eclipse quit on me for good, was an out of memory exception, on PermGenSpace. I set variables to 1024m, but it still complained it wasn't enough. After a lot of restarts, Eclipse suddenly wouldn't open my current workspace. I have tried others, and they work fine, but with my current one, the splash/loading screen disappears after about 10% of the loading bar is complete, and nothing happens at all. Except the fact that eclipse.exe shows up in the running processes tab on Windows task list. It does not show in the running programs list.
My attempts to start weblogic servers had the exact same symptoms. They showed in the process list, but did not respond when I tried to open the console in my browser.
Both eclipse and the weblogic tasks (shown as java.exe) has had over 400.000KB of memory consumption each, which I find very high.
I do not expect anyone to be able to find a complete solution here, but I am absolutely stuck. I cannot access any of my previous error messages. I have no experience debugging an error like this. Does anyone have any idea on how to find the error in a case like this?
My Weblogic version is 10.3.2, which is a company standard for now.
My Eclipse version is:
Eclipse Java EE IDE for Web Developers.
Version: Kepler Service Release 2
Build id: 20140224-0627
Adding the comment as an answer since it provided some help.
Try starting up to a new empty workspace; If you dont get to select workspace at startup use the argument "-data " If you still get issues, look at the log in /.metadata/.log

JSP project in RAD + Websphere, javascript changes lost

I'm working on JSP project in RAD 8.5.5 (when I tried to switch to Eclipse Kepler I've had the same issue) and WebSphere 8.0
When I change something in external JavaScript files which contain my own JavaScript functions I begin to get an error - 'function non defined' or even I lost part of code of this *.js page when I try to debug it in Chrome.
When I publish it to the server or rebuild it doesn't help. When I try to work without javascript cache in Chrome it doesn't work. Only after certain amount of time it begins to work. When I make changes in embedded JavaScript code on JSP page I haven't any problem, only I use my own function in external files.
What can it be? I lost a lot of time on this issue and it's annoying.
Thank you!
To overcome this issue you should do as following:
1.Prevent from browser to cache pages, in Chrome you can do it only developer tools are open : Disabling Chrome cache for website development
2.Perform 'Build project' from Eclipse(RAD). In some difficult case you have to do 'clean' on the server.
3.If you encounter unexpected delay while publishing try to delete all Breakpoints and Expressions from debug perspective.
4.Sometimes your server turning off and on every minutes by itself. To stop such behavior restart it in usual mode and then restart in debug mode.
Hope it will helpful to somebody.

Eclipse PDT + XDEBUG - source lookup not working entirely

I'm having trouble with a PHP project using Yii framework.
My setup is the following: Win7 + Eclipse4.2 + PDT 3.1 + Yiiclipse PDT extension + WAMP Server with XDEBUG enabled.
Pretty much everything works ok. The debug session starts, it's going through project's index.php source, but when it has to jump to framework's files, it doesn't open them up. I edited source lookup and added framework's local path but it simply cannot find them.
Here is a screenshot: http://img607.imageshack.us/img607/3687/eclipsepdt.png
This isn't necessarily an answer - but your question isn't necessarily a question either, so I feel like this is fair game :D
I've had so many problems with Eclipse PDT + xdebug in the past with debugging, code completion, etc., that I gave up on it a while ago and switched to Netbeans for PHP Debugging. It's now the defacto standard on my development team for debugging PHP; even though we all still have our own favorite editors, when we need to debug we'll still use Netbeans.
Code completion, phpdoc 'tooltips' on completion, and debugging all work flawlessly for me regardless of what platform I'm developing on (Windows, OS X, Linux) and I cannot say the same about Eclipse PDT (code completion would often miss, I'd run into problems or crashes debugging,etc.) in my personal experience.
So, I apologize in advance if this is a non-answer to a non-question - but maybe try out Netbeans?
Are you sure, you can use Xdebug to debug Yii (or any other framework-based) applications at all? Since Yii introduces URL-rewriting based on MVC pattern, I think you can't.
I don't have much experience with Xdebug, but from what I have found I clearly see, that it (along with Eclipse PDT) strongly depends on URL shown in Eclipse's internal browser, when debugging.
So, taking for example an URL from your screenshot:
http://localhost/testdrive/index.php?r=dispozitive
As you mentioned, Eclipse has correctly opened index.php, which is normal, as it is directly referenced in URL and you problably pointed it out as start file in debug configuration window.
Buth going further. How would you like Eclipse to understand, that route dispozitive (where route itself is a completely Yii concept (or similar framework) and Eclipse / Xdebug / PHP knows nothing about it) or that ?r=dispozitive URL parts corresponds to executing protected/SiteController.php file in your file system and calling default actionIndex() from it? So it could know it should open it in IDE and possibly stop execution on there defined breakpoints.
This process and concept (routing) is 100% authored by Yii and done by it internally, so how would you like Eclipse or Xdebug to know anything about it?
As I wrote, I don't have much experience in debugging Yii applications, but from what I have found until know, I clearly see, that you can't debug PHP applications with Xdebug, if they are using any kind of URL-rewriting methods. This technique (debugging with Xdebug) works IMHO only in case of applications, where URL changes directly reflects files in filesystem in your application contents.
EDIT: Additionally, check which version (package) of Eclipse you have? It turns out, that Helios package has some bugs and doesn't stops on breakpoints. Which makes it pretty useless for debugging process. You should consider using Galileo Package Eclipse for PHP Developers instead.

Service code debugging question with GWT 2.1

I recently attempted to set new breakpoints in eclipse to debug service side code in GWT. For some reason eclipse refused to see the breakpoints or the new code changes I had made. In the debugger it would open up what appeared to be an ear file from somewhere. Even though I had deleted the old ears, compiled and redeployed the new ear files. We are using GWT 2.1, JBoss 4.3, java 1.6 and Eclipse Helios. Finally, when I created a new environment with the code from scratch it started working. Any ideas as to what was holding on to the old code? BTW, I had rebooted my machine and restarted eclipse, but it also didn't make any difference.
Thanks,
James
Current state of debugging GWT apps is ... well not really good. Sometimes it's incredibly slow (development mode), sometimes lot of rubbish stays at webserver.
This might not solve your problem directly, but here are some advices from me:
Writing new client code (/client) at GWT means refreshing browser
Writing new server code means "Reloading web server". You have little yellow "refresh" button in Eclipse in "Development Mode" tab. This should reflect all the changes done at server side.
Embedded Jetty works usually well with GWT debugging. If you are not doing something jboss-server-specific, it should also work fine at production server. Just make sure your unit tests pass ;-)
You can ofcourse debug GWT application on external server, see this section of documentation (I guess you do on JBoss)
Be sure to remove all old files when reloading web server. It happened to me, that sometimes there were some weird old mixed up files (I was using Tomcat though). So you might want to write own clean script.
You must be absolutely sure that your serever code even launched! Use lot of GWT.log() at client side, that will ensure you in this. Don't worry, GWT.log are ommitted in production mode.
Be sure to inspect client-side page, it sometimes help to find out that your server code didn't manage to launch.
Log every public void onFailure(final Throwable caught) { of your AsyncCallbacks to get more info.
Don't use Google Chrome in development mode. It's MUCH slower than Firefox.
Otherwise, if you're using most recent version of your application, Eclipse must stop at breakpoint correctly.
I think JBoss was somehow caching things in it's temporary files and then I had forgotten about adding source in. This may be a JBoss thing as I don't recall seeing it with other application servers before.
So after I cleared out the cache, what got me thinking about the source was the fact that eclipse would stop on the breakpoints in the debugger that I had just set, but I couldn't see the source files.
Prior to this I was apparently hitting the breakpoints in the cached files and I couldn't alter them by setting new breakpoints. That was the root cause of the issue. Then by adding in the source from the ear, I got the debugger in sync with the code and it started working fine.

Symfony, netbeans 6.8 and debugging a web page

I am using Symfony (1.31) - with Propel ORM to build a website. I have recently moved from using a text editor, to Netbeans (6.8) as my dev environment.
Coming from a compiled language (C++) background, I am used to setting break points in code etc as part of debugging. Web development I have encountered (atleast with PHP), has been largely hit and miss - well debugging has been messy to say the least, using echo statements, logging stuff to file etc. Well I hear that it is possible to debug PHP (i.e. set breakpoints etc).
I have scoured the net for documentation to show how to set breakpoints (say in one of the MVC layesrs) so that when the relevant page(s) is opened via a browser, the breakpoint will get hit and I can step through the code (ideally, watching the program variables).
Is this possible using Symfony and Netbeans 6.8?.
There seems to be support for XDebug: http://netbeans.org/kb/docs/php/debugging.html
If you have specific questions about configuring XDebug: http://wiki.netbeans.org/HowToConfigureXDebug.
More useful articles on PHP development in NetBeans: http://netbeans.org/kb/trails/php.html.
Hope that helps.
UPDATE: Just installed NetBeans 6.8 and ran through the configuration and was able to get breakpoints to work successfully with XDebug. NetBeans' integration with Symfony is pretty slick too, +1 to question for getting me to check this out.
Here is what has helped me debug my Symfony apps:
Enable logging and the web debug toolbar via apps/appname/config/settings.yml. Note: Any changes will require clearing the cache.
dev:
.settings:
web_debug: true
logging_enabled: true
Use var_dump() or print_r() with pre tags to dump data from anywhere. Adding exit; will allow you to dump variables from the controller or anywhere else.
echo '<pre>';
vardump($something);
echo '</pre>';
exit;
Enable logging and log messages. You can access the logger anywhere as well, but make sure you enable logging for your environment:
sfContext::getInstance()->getLogger()->info($message);
I've used Gubed with Quanta+ as a stepping debugger with PHP, don't know if you can get that to work with Netbeans but I thought it was more hassle that it was worth. I found that I could for(i=0;i<~6;i++){dump stuff to screen/log; make changes; reload;} and solve an issue in less time than it took me to step through it once with the debugger.
Xdebug is a very useful PHP extension which features a remote debugger with support for some editors, though Neatbeans isn't listed. I've not used the remote debugging element of Xdebug (see above) but the profiling, code coverage and - in particular - improved browser error messages I find helpful.
Generally with Symfony I find I can get most of what I need from stack traces or by dropping items into the logger and picking them up with either the debug toolbar or firesymfony.
Netbeans 7+ has trouble with xdebug breakpoints in the model/action. You have to use the manual function to set breakpoints.
xdebug_break();