Debugging GCstar

| Top |

Using Eclipse IDE

It is possible to debug GCstar using Eclipse IDE.

Here the instructions to configure Eclipse under Ubuntu and Windows XP/Vista/7:

For Ubuntu

1. Install Eclipse IDE with the following command:

sudo apt-get install eclipse

2. Install EPIC plugin for eclipse by doing the following: Open Eclipse, and go to Help→Install New Software... window; insert this link in the ‘Work with:’ field: http://e-p-i-c.sf.net/updates/testing ; select all EPIC components, click on Next, and then Finish.

3. Install PAD-Walker perl module with the following command:

sudo apt-get install libpadwalker-perl

4. Integrates GCStar project in Eclipse: Open Eclipse, select [i]File→New→Project...[/i]; select Perl Project and click Next; set project name and click Finish. Now right click on the project just created and select Import...; Select import from Filesystem and click Next; choose the local folder of the GCStar version you want to develop/debug on, check the folder and click Finish. Now go to Project→Properties→Perl Include Path and add the path to the lib/gcstar/ or lib/ folder of the project (depends on GCStar version). Now, GCStar project should compile without error, and run in debug mode like any other eclipse project.

Note: to run the project from eclipse it is needed to rename the gcstar file in the bin folder of the project, to gcstar.pl; after this it is possible to create a Run configuration for the project.

For Windows

1. Download and install ActiveState Perl 5.10 version (32-bit) from here: http://downloads.activestate.com/ActivePerl/releases/5.10.1.1008/ActivePerl-5.10.1.1008-MSWin32-x86-294165.msi

2. Go to Control Panel → System → Advanced System Settings → Environment Variables: verify all the following path exist in the PATH variable (if any is missed, insert it):

  • C:\Perl\bin
  • C:\Perl\site\bin
  • C:\Perl\lib

3. Open command prompt and install trouchelle repository for perl modules with the following command:

ppm repo add http://trouchelle.com/ppm10/
4. Open Perl Package Manager (ppm) (through command prompt or start menù) and install the following perl modules:

  • Module-ScanDeps
  • Getopt-ArgvFile
  • GLib
  • MP3-Info
  • MP3-Tag
  • CDDB-File
  • DateTime-Format-StrpTime
  • Ogg-Vorbis-Header-PurePerl
  • Gtk2
  • Gtk2-Ex-Entry-Pango
  • Cairo
  • Pango
  • Libxml-Perl
  • XML-XSLT
  • XML-XSLT-Wrapper
  • Padwalker

5. Download and install latest Gtk2-Runtime from here: http://sourceforge.net/userapps/mediawiki/alex-sh/index.php?title=Downloads

6. Go to Control Panel → System → Advanced System Settings → Environment Variables: in the PATH variable you should see “C:\Program Files (x86)\GTK2-Runtime\bin” among the others; replace this string with the following:

  • %ProgramFiles(x86)%\GTK2-Runtime\bin\;

and move it at the beginning. Click OK, close all windows and restart system.

7. Download and install Eclipse from here: http://www.eclipse.org/downloads/packages/eclipse-classic-360/heliosr

8. Install EPIC plugin for eclipse by doing the following: Open Eclipse, and go to Help→Install New Software... window; insert this link in the ‘Work with:’ field: http://e-p-i-c.sf.net/updates/testing ; select all EPIC components, click on Next, and then Finish.

9. Integrates GCStar project in Eclipse: Open Eclipse, select File→New→Project...; select Perl Project and click Next; set project name and click Finish.

Now right click on the project just created and select Import...; Select import from Filesystem and click Next; choose the local folder of the GCStar version you want to develop/debug on, check the folder and click Finish. Now go to Project→Properties→Perl Include Path and add the path to the lib/gcstar/ or lib/ folder of the project (depends on GCStar version); add also the path to the root folder of the project.

An example of the two path could be:

  • C:\users\myname\workspace\GCstar\lib\gcstar
  • C:\users\myname\workspace\GCstar

Now, GCStar project should compile well and run in debug mode like any other eclipse project.

Important: There is a known bug related to debug. At the moment an error is returned if we try to debug. A workaround for this is described at http://sourceforge.net/tracker/index.php?func=detail&aid=2907155&group_id=75859&atid=545274; It consists in modifying the file Cwd.pm in the Perl\lib folder: modify the following

sub _win32_cwd {
if (eval 'defined &DynaLoader::boot_DynaLoader') {

with

sub _win32_cwd {
if (defined &DynaLoader::boot_DynaLoader) {

Note 1: there are some errors due to arabic and russian words and sentences in the code. THey are not critical. Anyhow to fix most of them, go to Project→Properties→Resources; in the Text Encoding section choose Other and select “UTF-8” encoding.

Note 2: to run the project from eclipse it is needed to rename the gcstar file in the bin folder of the project, to gcstar.pl; after this it is possible to create a Run configuration for the project.

Note 3: after all may be some errors will remain (this is in my case); don’t worry; as I’ve said they are not critical and the project run fine.

See also these discussions on forum: GCstar Forum - Topic 1 GCstar Forum - Topic 2

print statements

A quick alternative to debug is done the old school way using print statements throughout the code. The Data::Dumper module is really useful here. On debugging plugins this Code:

use Data::Dumper
print Dumper($variable)

is a good way to find out where things are.

using a local website cache

There’s also some command lines options that help when writing new plugins. Here Tian’s instruction on using them:

I just added something in the SVN repository. It may help you when you want to debug plugins that fetch information. Sometimes, the website I really long for answering. And when we want to fix some problems, we have to do a lot of requests. So it may take time for each test.

Now, you can just add a variable to your environment before launching. It will be in 1 phases. First, launch GCstar like that :

GCS_DEBUG_PLUGIN_PHASE=1 perl ./gcstar

(if you don’t launch it from the bin directory, you’ll obviously have to adjust the path).

It will behave as usually. But it will store the downloaded pages in /tmp (or whatever is the temporary directory on your system, as returned by File::Spec→tmpdir).

Then for all the tests, you may launch it with the value 2 for this variable.

GCS_DEBUG_PLUGIN_PHASE=2 perl ./gcstar

It will reuse the previous files. You may easily find them in your temporary directory as they begin with http. Actually, the file name is the url of the page with special characters replaced with underscores.

You also have to know that these files will never be removed by GCstar. So if you don’t have some automatic cleanup of your temporary directory, you’ll have to remove them manually.

Hope this helps - if you’ve any more questions, just ask!

 
en/debugging.txt · Last modified: 02/03/2011 07:32 by unclepetros



Should you have a problem using GCstar, you can open a bug report or request some support on GCstar forums.