Mailing List Archive

Debugging Catalyst with Komodo
I'm running Catalyst 5.7006 on RHEL AS 4 and want to debug remotely
with Komodo 4.0.0-beta4 on a Windows box. The problem is Komodo can
only step through the initialization pars of the app, and execution
never reaches breakpoints in controllers.

I made sure first that debugging worked. On the RHEL box, I ran:
catalyst.pl myapp
myapp/script/myapp_create.pl controller Test

Then I edited Test.pm and inserted a $DB::single = 1; before the
"Matched myapp::Controller::Test" lines. Debugging with "perl -d
script/myapp_server.pl" , 'c' works okay: execution stops just before
$c->response->body('Matched myapp::Controller::Test in Test.');

Next, I set per Komodo's documentation, the following environment variables:
export PERL5LIB=/<absolute_path_to>/KomodoPerlRemoteDebugging
export PERLDB_OPTS=RemotePort=<IP of Windows box>:9000

"perl -d script/myapp_server.pl" also works, in the sense that Komodo
fires up and lets me single-step through the code.

The issue is that if I put a breakpoint in Test.pm on the "Matched..."
line, and press F5 to continue running the script, myapp_server.pl
exists.

I single-stepped through the code in Komodo until I found the exit
point. It's in Catalyst::Engine::HTTP.pm, in the run() sub. The loop

while ( accept( Remote, $daemon ) )
{ # TODO: get while ( my $remote = $daemon->accept ) to work

is never entered. Execution skips to $daemon->close; and that's it.


At this point, I'm afraid I'm out of ideas... Kieren suggested that I
ask on both mailing lists.

Is this an issue with Catalyst, or Komodo?
Does anyone know of a work-around?
As a last resort, another IDE debugger?

Any help is much appreciated. Thanks,
Dan

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/
RE: Debugging Catalyst with Komodo [ In reply to ]
> -----Message d'origine-----
> De : Dan Dascalescu [mailto:ddascalescu+catalyst@gmail.com]
> Envoyé : vendredi, 2. février 2007 05:29
> À : The elegant MVC web framework; Development of the elegant
> MVC web framework
> Objet : [Catalyst] Debugging Catalyst with Komodo
>
> I'm running Catalyst 5.7006 on RHEL AS 4 and want to debug
> remotely with Komodo 4.0.0-beta4 on a Windows box. The
> problem is Komodo can only step through the initialization
> pars of the app, and execution never reaches breakpoints in
> controllers.
>

I think this is not due to Komodo, but to the fact that modules in a Catalyst app are loaded dynamically (after compile-time) by the Catalyst initialization code. So at the time you want to set your breakpoints, the modules are not loaded yet.

I don't know the proper solution to this, but I know a workaround : you can put the statement

$DB::single = 1;

somewhere in your code. This will force a breakpoint if running in -d mode (cf L<perldebug>). And then, since your modules are now loaded, you can add all your other breakpoints as usual.

Good luck, L. Dami

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/
Re: Debugging Catalyst with Komodo [ In reply to ]
> I don't know the proper solution to this, but I know a workaround :
> you can put the statement
>
> $DB::single = 1;
>
> somewhere in your code. This will force a breakpoint if running in -d mode (cf
> L<perldebug>). And then, since your modules are now loaded, you can add all your other
> breakpoints as usual.

I tried that and Komodo never stops at that breakpoint because
execution does not reach it. The Catalyst app exits before that
because it can't listen for connections.

Any other ideas? Why does this loop in HTTP.pm fail under Komodo?

while ( accept( Remote, $daemon ) )
{ # TODO: get while ( my $remote = $daemon->accept ) to work

--
Dan

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/