Wow!! That is amazing! :)

I was thinking the other day while trying to debug node_teaser that a tree graph of the functions would make it much easier to understand when and how node_teaser() is called.

I'm running;

  • Mac OS X 10.4.10 (I have leopard on my desk though)
  • XDEBUG 2.0.0 RC4-dev (as distributed with Komodo IDE 4.something (a few months old))
  • MAMP 1.6.1
    • apache 2.something
    • php 5.2.1
  • the most recent versions of zgrviewer and GraphViz.app for mac
  • drupal 5.3 (no other modules)
  • visualize_backtrace 5.x-1.1

(Wow!! Isn't floss great!)

I got everything working, thanks to your detailed instructions, except for opening the .dot files in zgrviewer. I copied the command line on the page with the table into terminal and got this;

Bevans-MacBook:~ bevan$ /usr/local/bin/zgrviewer/run.sh --Pdot /Users/bevan/Sites/drupal5/files/1193373030_section0.dot
Exception in thread "main" java.lang.NoClassDefFoundError: net/claribole/zgrviewer/ZGRViewer

Any ideas?

CommentFileSizeAuthor
#2 screenshot_46.png16.66 KBBevan

Comments

KentBye’s picture

Well unfortunately I'm not a java expert, and I'm not sure if I ever ran across this error.
You can try reading here: http://www.nabble.com/help-needed-t4558833.html

Another thing you might want to try is to cd to /usr/local/bin/zgrviewer -- and then try to do a ./run.sh to see if you can even open up the ZGRViewer.
There may be something you need to initialize.

One final thought is that you may want to try plotting section 1 -- section 0 is the full trace and sometimes it has trouble loading if it is too big and so it's better to start smaller.

Good to hear you've got it mostly set up tho. Follow up here if you got it working. Thanks.

Bevan’s picture

StatusFileSize
new16.66 KB

> You can try reading here: http://www.nabble.com/help-needed-t4558833.html

Don't have time right now. Thanks for the reference though.

> Another thing you might want to try is to cd to /usr/local/bin/zgrviewer -- and then try to do a ./run.sh to see if you can even open up the ZGRViewer.
> There may be something you need to initialize.

I did that already as per your INSTALL.txt. ZGRviewer starts fine but with a blank page -- see the screenshot.

> One final thought is that you may want to try plotting section 1 -- section 0 is the full trace and sometimes it has trouble loading if it is too big and so it's better to start smaller.
Same issue.

KentBye’s picture

Well, the ZGRViewer defaults to a blank screen when you open it with ./run.sh

I guess I should've been more clear with how to actually open one of the *.dot files that is generated.

After you open up ZGRViewer and see the white screen, then try going to:
File -> Open -> Open with dot... -> DOT pipeline (experimental)...

And then browse to your /files location -- in your case /Users/bevan/Sites/drupal5/files/
and then select 1193373030_section1.dot

You will have already needed to have entered in the location of the GraphViz libraries as described in the INSTALL.txt.

Let me know if you can view it this way.

A less desirable alternative is to use PixelGlow's GraphViz to open up the *.dot files, but it is a lot more difficult to pan and zoom and doesn't link back to the line of source code like the ZGRViewer can.

Bevan’s picture

After you open up ZGRViewer and see the white screen, then try going to:
File -> Open -> Open with dot... -> DOT pipeline (experimental)...

And then browse to your /files location -- in your case /Users/bevan/Sites/drupal5/files/
and then select 1193373030_section1.dot

That worked! :)

Great! That means I have everything working except automatic opening of tree graphs in ZGRviewer from drupal. However as it's rare that I want to do that, this is a working alternative. The table in drupal provies all this information already just in a less human-friendly form -- right?

Thanks!

KentBye’s picture

Yes, the table format contains all of the same information, but yeah, it is more difficult to quickly mentally parse it.
You can however search it if you know the function or filename of interest.
Glad to hear that you got it working, and I'll have to update the INSTALL.txt with this additional info on the workaround.

KentBye’s picture

Component: Code » Documentation
Status: Active » Closed (fixed)

In future versions, I'll recommend people just copy and paste the command line code or open it up from the ZGRViewer.
I'm going to go ahead and close out this issue.

Bevan’s picture

I wonder why opening it on command line doesn't work for me. It's awfully convenient to be able to open these files from drupal directly...

teshager’s picture

Title: Wow!!! (one issue) » xtparsed and dot are both empty
Component: Documentation » Code
Priority: Minor » Normal
Status: Closed (fixed) » Active

Hi there,

I've installed this package over the weekend and been trying to get it to work to no avail. Despite the creation of the xt file xtparsed turns out to be empty which in turn creates an empty .dot file :(

xtparsed only contains the following string
"Version: 2.1.0-dev"

I'm wondering if this information points out to xdebug being the 2.1 dev and cannot be parsed correctly by the latest Visualize Backtrace?

My package is the standard, Drupal 5.3, Komodo 4.2 with the most recent xdebug.so from activestate. I'm running all this locally on a Mac 10.5 release.

Before I venture out trying to debug the complex awk script inside the parser, was wondering if anyone has seen this? Also, anyone successful in building Xdebug 2.0 from source file on OSX 10.5 yet using gcc4.0.1?

Thanks much
/c4rider

KentBye’s picture

Title: xtparsed and dot are both empty » Troubles getting the ZGRViewer to autolaunch *.dot files
Component: Code » Documentation
Priority: Normal » Minor
Status: Active » Closed (fixed)

Hey c4rider,
Thanks for downloading and trying out the module, and sorry that it's giving you troubles.

I created a specific issue and task for your problem as described here:
http://drupal.org/node/193709

Would you be willing to upload an unparsed trace file in that issue queue?
I'll take a look at it.

The awk command is also related to this Windows issue with more details there:
http://drupal.org/node/192391

Thanks again.

Bevan’s picture

I just upgraded to Komodo 4.2 and it still works fine, however I'm still using 4.1's XDEBUG (XDEBUG 2.0.0 RC4-dev). Maybe try that one and see if it works...

KentBye’s picture

Consolidating my response by pasting an excerpt from nadavoid from a duplicate issue so that I can answer it here:

Do you have any tips on what I should try in order to get the .dot files to go ahead and launch into ZGRViewer?

note: when I run this type of command:
/usr/local/bin/zgrviewer/run.sh --Pdot /Users/david/Sites/drupal-5.2_2/files/16071_section0.dot
I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: net/claribole/zgrviewer/ZGRViewer

could that be why?

Yes, that's one reason why it's not autolaunching from the browser. Launching from the terminal needs to work first.

It's good to know that you can manually open up the *.dot files after doing:

cd /usr/local/bin/zgrviewer; ./run.sh;

And I agree that it is annoying to not be able autolaunch it from either the command line or from the browser. Getting from the browser is an apache headache, but you should be able to do it from the terminal.

However, I'm no java expert, and I'm going to have to point you to the ZGRViewer mailing list for more help as to what is wrong:
http://sourceforge.net/mailarchive/forum.php?forum_name=zvtm-devel

You can search there. Search with google. And please report back here if you get it to autolaunch from the terminal to make it easier for others reading this thread in the future. :)

nadavoid’s picture

Kent: thank you for the tips/links/suggestions. That got me on the right track. I can launch .dot files from the command line now. The only thing I had to change was...

edit /usr/local/bin/zgrviewer/run.sh
change this line:
ZGRV_HOME=.
to this:
ZGRV_HOME=/usr/local/bin/zgrviewer

Now, running this:
/usr/local/bin/zgrviewer/run.sh --Pdot /Users/david/Sites/drupal-5.2_2/files/16071_section0.dot
results in the ZGRViewer being launched with the .dot file loaded into it. woo hoo! I think I'm hot stuff now. But that opinion is not open for votes.

Now I'll see if I can get it to launch directly from drupal. Then I'll feel like a rock star. At least until I leave the office.

nadavoid’s picture

I set the user/group in httpd.conf to david/david and restarted apache. I've confirmed that PHP really is executing as david/david, in a phpinfo().

/usr/local/bin/zgrviewer and everything it contains is owned by david/david. (If you can't tell yet, my username on my computer is "david")

Launching from the command-line works, it's just not loading from drupal, when I click the links such as "Graph Main Section 3"

Is there a configuration inside drupal that I'm missing? Any other tips or tutorials that I just haven't found yet?

KentBye’s picture

nadavoid,
yay! Great to hear that you at least go it to autolaunch from the terminal window.
Now unfortunately I myself am out of my league for getting it set up myself, but I was able to finally do it.

Well, it's an absolute must that you run it on localhost since it's a forked execute command, and so it's not going to work remotely.

I read through these links when I was setting it up, and tried enough suggestions that eventually one combination worked.
Read through these two threads:
http://us3.php.net/manual/en/function.shell-exec.php#37971
http://www.webhostingtalk.com/archive/index.php/t-386461.html

Some keywords to try are some combination of "shell_exec()" "php" "fork" "drupal" "java" -- maybe even drop a note to the ZGRViewer list serve, or ask on someon IRC channel -- possibly #ubuntu or #php

But I'm afraid that I can't be of much more help beyond that, but please report any success or failure for others.
I'll be updating the INSTALL.txt with FAQs down the road.

KentBye’s picture

@nadavoid: Try this first -- do a ls -l in the terminal window on all of the /usr/local/bin/zgrviewer/ files and confirm that they are both owned and in the same group.

I was reminded of this after reading through this thread again: http://www.webhostingtalk.com/archive/index.php/t-386461.html

$ls -l /usr/local/bin/
...
-rwxr-xr-x     1 root  wheel     57516 Aug 15 13:54 xmlwf
drwxr-xr-x    14 kent  kent        476 Aug 15 00:46 zgrviewer
drwxrwxrwx    64 kent  kent       2176 Aug 30 13:11 zlib-1.2.3

It should say in your case david david and not david wheel.

I believe you can change all of the zgrviewer files with: $ sudo chown david:david *.* -- and then you may need to do it for each top-level directory.

And it'd probably be smart to do a restart if that doesn't work off the bat.

So again, I believe the zgrviewer file permissions should look like this

$ls -l /usr/local/bin/zgrviewer
-rw-r--r--   1 kent  kent     38 Oct 17  2005 antlr.license.txt
-rw-r--r--   1 kent  kent   4584 Mar 14  2007 build.xml
drwxr-xr-x   4 kent  kent    136 Aug 15 00:46 doc
drwxr-xr-x   3 kent  kent    102 Dec  6  2006 images
drwxr-xr-x   9 kent  kent    306 Aug 17 02:12 lib
drwxr-xr-x   2 kent  kent     68 Jun  6  2005 plugins
-rwxr-xr-x   1 kent  kent    411 Jul 14 08:31 run.bat
-rwxr-xr-x   1 kent  kent    437 Aug 31 15:28 run.sh
drwxr-xr-x   4 kent  kent    136 Aug 15 00:47 src
-rwxr-xr-x   1 kent  kent   2749 May 18  2005 xerces.license.txt
-rwxr-xr-x   1 kent  kent  25049 May 18  2005 zvtm.license.txt
Bevan’s picture

I wondered if you have considered using drush for the command-line integration? It might make some of these 'launch from drupal/php' headaches easier...

http://drupal.org/project/drush

nadavoid’s picture

I do have the zrgviewer file permissions correct: owner is david, group is david, on /usr/local/bin/zgrviewer and everything recursively inside it.

I just looked at the apache error log (can you believe I did that BEFORE someone suggested it!) and it shows this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libawt.jnilib: 
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1723)
	at java.lang.Runtime.loadLibrary0(Runtime.java:822)
	at java.lang.System.loadLibrary(System.java:993)
	at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Toolkit.loadLibraries(Toolkit.java:1509)
	at java.awt.Toolkit.<clinit>(Toolkit.java:1530)
	at java.awt.Font.<clinit>(Font.java:141)
	at net.claribole.zgrviewer.Utils.<clinit>(Utils.java:39)
	at net.claribole.zgrviewer.ZGRViewer.main(ZGRViewer.java:463)

So, it looks to me like my particular problem is Java-related. I think apache/php is trying to execute the java app, but the java app is complaining.

KentBye: I'll do some searches using the keywords you suggested, and focus on the Java side. I'm on Leopard, so maybe that has something to do with it.

Thanks for all the help so far. I'll let you know if I get anything more worked out.

nadavoid’s picture

I finally found the answer. The short answer is:
in /usr/local/bin/zgrviewer/run.sh
add this line after ZRGV_HOME
DYLD_LIBRARY_PATH=

The problem was in fact an environment variable issue. PHP/Apache was setting DYLD_LIBRARY_PATH to a directory inside my MAMP installation. I read on another post that someone had this variable set in their system settings and it was causing the same sort of problem. so I tried unsetting it in run.sh, and it worked!

I was then bothered by the fact that the web page wouldn't load until I quit zgrviewer. a further tweak to run.sh fixed that...
before "java -cp ......" add "nohup" and at the end of that line add "&"
Here's my final run.sh

ZGRV_HOME=/usr/local/bin/zgrviewer
DYLD_LIBRARY_PATH=

nohup java -cp $ZGRV_HOME/lib/zvtm.jar:$ZGRV_HOME/lib/zgrviewer.jar:$ZGRV_HOME/lib/xercesImpl.jar:$ZGRV_HOME/lib/xml-apis.jar:$ZGRV_HOME/lib/antlr-2.7.5.jar:$ZGRV_HOME/lib/statemachine.jar net.claribole.zgrviewer.ZGRViewer "$@" &

I'm really pumped about being able to dig around in the inner processes of Drupal now! Thanks so much for putting together this tool.

KentBye’s picture

Nadavoid,
That's Great!
Some incredible debugging work there.
I'll have to point to this thread in the next INSTALL.txt

But I should need to put a USE IN THIS CONFIGURATION AT YOUR OWN RISK since you may be putting your localhost data at risk if there is a malicious or inadvertant shell_exec() command that tries to delete some of your data. So be cautious.

Also there are a couple of known bugs regarding the timing info and the full display of forwardtrace trees, and I'm working on some of them this weekend: http://drupal.org/project/issues/visualize_backtrace?categories=bug

I hope to get at least a dev release out after squashing some more bugs