如何将调试器与 mod_perl 一起使用

发布于 2024-10-31 08:08:42 字数 708 浏览 1 评论 0原文

我正在尝试将 Perl 调试器附加到 Apache 和 mod_perl。我们的 环境相当复杂(很多额外的东西(例如催化剂) 配置了 Apache)并且配置它的工程师没有 与公司相处的时间更长。我已按照 Apache 上的说明进行操作 网站,设置“PerlFixupHandler Apache::DB”等。 但到目前为止,我得到的只是之后进入调试器 该页面已交付。我猜我已经突破了 调度进程,而不是工作进程。我正在运行 prefork MPM 阿帕奇的版本。调试说明说在以下情况下传递 -X 参数 启动httpd。但我正在运行的 httpd 不接受 -X 参数。 我假设 -X 参数实际上会导致某些版本的 httpd 不分叉?

任何和所有指导表示赞赏。

$ ./httpd -v
Server version: Apache/2.2.17 (Unix)
Server built:   Nov 16 2010 20:13:24

-X isn't listed when I do httpd -?    
Usage: ./httpd [-D name] [-d directory] [-f file]
           [-C "directive"] [-c "directive"]
           [-k start|restart|graceful|graceful-stop|stop]
           [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]

I'm trying to attach the Perl debugger to Apache and mod_perl. Our
environment is quite complex (lots of additional stuff (eg Catalyst)
configured with Apache) and the engineers who configured it are no
longer with the company. I've followed the instructions on the Apache
web site, setting 'PerlFixupHandler Apache::DB', etc.
but so far all I get is a break into the debugger after
the page has been delivered. I'm guessing that I get the break in
the dispatch process, not the worker process. I'm running the prefork MPM
version of Apache. The instructions for debugging say pass the -X parameter when
starting httpd. But the httpd I'm running doesn't accept a -X parameter.
I'm assuming the -X param would actually cause some versions of httpd to NOT fork?

Any and all guidance appreciated.

$ ./httpd -v
Server version: Apache/2.2.17 (Unix)
Server built:   Nov 16 2010 20:13:24

-X isn't listed when I do httpd -?    
Usage: ./httpd [-D name] [-d directory] [-f file]
           [-C "directive"] [-c "directive"]
           [-k start|restart|graceful|graceful-stop|stop]
           [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

很酷又爱笑 2024-11-07 08:08:42

'Pro Perl 调试' 有一章关于“调试 CGI 程序” ' 和标题为“配置 mod_perl”的小节。

抱歉,我现在无法访问该书。

The book 'Pro Perl Debugging' has a chapter on 'Debugging a CGI Program' and a subsection titled 'Configuring mod_perl'.

Sorry, I don't have access to the book right now.

披肩女神 2024-11-07 08:08:42

我已经成功运行了 Eclipse 的史诗 Perl 模块附带的调试器以及 komodo 调试器。

对于 Komodo,您可以在 apache2.conf 中添加类似以下内容,

<IfDefine DEBUG>
<Perl>
  use ModPerl::Registry;
  use lib qw(/usr/local/lib/perl/Komodo-PerlRemoteDebugging-6.0.3-59641-linux-x86);
  $ENV{PERLDB_OPTS} = "RemotePort=127.0.0.1:9000 LogFile=stderr";
  $ENV{DBGP_IDEKEY} = "yourkey";
  use Apache::DB ();
  Apache::DB->init;
</Perl>
</IfDefine>

请按照此处的说明进行操作: http:// /docs.activestate.com/komodo/4.4/debugperl.html

对于 Epic

<IfDefine DEBUG>
    PerlModule ModPerl::Registry
    PerlSetEnv PERLDB_OPTS "RemotePort=192.168.x.x:9500 DumpReused ReadLine=0 PrintRet=0"
    PerlSetEnv PERL5DB "BEGIN { $DB::CreateTTY=0; require /path_to_epic_db_scripts/perl5db.pl'; }"
    PerlRequire /path_to_epic_db_scripts/db.pl
    PerlPostConfigRequire /etc/apache2/perl/whatever.pl
</IfDefine>

请参阅此处的文档:http://www.epic-ide.org/guide/ch06.php

当然,Epic 是免费的,而 Komodo 不是,而且它表明,它仍然相当不错。
我不得不说,自从我打电话使用它以来,已经过去了大约 18 个月,所以这就是我能记得的一切。祝你好运....

I have successfully run the debugger that comes with the epic perl module for eclipse and also the komodo debugger.

For Komodo, you add something like the following to apache2.conf

<IfDefine DEBUG>
<Perl>
  use ModPerl::Registry;
  use lib qw(/usr/local/lib/perl/Komodo-PerlRemoteDebugging-6.0.3-59641-linux-x86);
  $ENV{PERLDB_OPTS} = "RemotePort=127.0.0.1:9000 LogFile=stderr";
  $ENV{DBGP_IDEKEY} = "yourkey";
  use Apache::DB ();
  Apache::DB->init;
</Perl>
</IfDefine>

Follow the instructions here : http://docs.activestate.com/komodo/4.4/debugperl.html

For Epic

<IfDefine DEBUG>
    PerlModule ModPerl::Registry
    PerlSetEnv PERLDB_OPTS "RemotePort=192.168.x.x:9500 DumpReused ReadLine=0 PrintRet=0"
    PerlSetEnv PERL5DB "BEGIN { $DB::CreateTTY=0; require /path_to_epic_db_scripts/perl5db.pl'; }"
    PerlRequire /path_to_epic_db_scripts/db.pl
    PerlPostConfigRequire /etc/apache2/perl/whatever.pl
</IfDefine>

See documentation here: http://www.epic-ide.org/guide/ch06.php

Of course, Epic is free and Komodo isn't, and it shows, it's still quite ok though.
I have to say it's been about 18 months since I had call to use it, so that's about as much as I can remember. Good luck....

坏尐絯℡ 2024-11-07 08:08:42

多年来,我和公司的其他几个人一直在尝试将调试器附加到 mod_perl。在实际到达 ASP 页面中的代码之前,我们已经成功地在 mod_perl 进程中的多个点进行了中断,但我们从未能够在 ASP 页面内部进行中断。即使我们在代码运行之前中断,然后在我们感兴趣的代码中对 $DB::single = 1 语句进行“c”,页面也会运行到终止并且不会中断(它似乎跳过了 $DB ::单身的)。

我们所有人都认为我们的 perl 版本、我们的 perl5db 版本或我们的 mod_perl 版本存在错误,这使得我们的版本无法执行此操作。我们使用的是 perl 5.8.9 和 apache 2 的某个版本,目前我还没有注意到。

我知道这不是一个答案,但我只是想告诉你这一点,这样如果你最终放弃了,你就不会因为放弃而感到难过。

mod_perl 遇到的这个问题是我插入 Plack 我们的网络服务器和应用程序之间的层。有了这个抽象层,我可以在开发中运行不同的 Web 服务器,并且可以在其中附加调试器。我并不是建议您这样做,而是建议您这样做,只是让您知道我真的很认真地进行交互式调试。

我认为在 mod_perl 中进行交互式调试的史诗般的战斗中,下一个合乎逻辑的步骤是构建最新版本并看看它是否有效。然后升级我们的 perl 版本,看看是否有效。

I and several others at my company have been trying to attach a debugger to mod_perl for years. We have managed to break at several points in the mod_perl process before we actually reach the code in our ASP pages, but we have never been able to break inside of our ASP pages. Even if we break before our code is run, and then 'c' to our $DB::single = 1 statement inside of our interesting code, the page runs to termination and doesn't break (it appears to skip over the $DB::single).

All of us believe that there is a bug in our version of perl, our version of perl5db, or our version of mod_perl, which makes this impossible to do for our version. We are on perl 5.8.9, and some version of apache 2 which escapes me at the moment.

I know this isn't an answer, but I just wanted to tell you this so that you wouldn't feel bad about giving up if you eventually do give up.

This problem we're having with mod_perl is one of the main reasons that I am in the process of inserting a Plack layer between our webserver and our application. With this abstraction layer, I can run a different web server in development - and one in which I can attach a debugger. I am not linking to this so much as a suggestion that you do it but just so you know that I am really serious about having interactive debugging.

I think the next logical step in the epic battle for interactive debugging in mod_perl would be to build the latest version and see if that works. Then upgrade our perl version and see if that works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文