On Wed, Oct 13, 2004 at 08:57:15AM +0200, [EMAIL PROTECTED] wrote:
> >Random thoughts:
> >
> >If a commandline option would do it, that sounds good.
> >Otherwise, perhaps
> >skip the use threads (and complain if there's a later attempt) unless
> >$ENV{PERL5DB_THREADED} is true (and have perl.c set PERL5DB_THREADED if
> >you say -dt).
> >
> Hmmm, sounds ok, a quick workaround would be to 'require threads' at the correct
> position instead of 'useing' it (i agree), and to use $ENV{PERL5DB_THREADED}.
>
> I can quickly supply a patch to do that.
>
> The perl.c bit will have to come a bit later, when I get to it, but sounds like a
> good long term solution to me.
Here's a completely untested (even uncompiled) patch, if it helps you at all.
I made it not specific to perl5db.pl, in case there are Devel:: modules
that would benefit from this information.
--- perl.c.orig 2004-09-28 08:49:47.000000000 -0700
+++ perl.c 2004-10-13 02:41:40.126563200 -0700
@@ -2504,6 +2504,13 @@ Perl_moreswitches(pTHX_ char *s)
case 'd':
forbid_setid("-d");
s++;
+
+ /* -dt indicates to the debugger that threads will be used */
+ if (*s == 't' && !isALNUM(s[1])) {
+ ++s;
+ my_setenv("PERL5DB_THREADED", "1");
+ }
+
/* The following permits -d:Mod to accepts arguments following an =
in the fashion that -MSome::Mod does. */
if (*s == ':' || *s == '=') {
--- pod/perlrun.pod.orig 2004-09-06 03:39:51.000000000 -0700
+++ pod/perlrun.pod 2004-10-13 02:45:07.484729600 -0700
@@ -6,7 +6,7 @@ perlrun - how to execute the Perl interp
B<perl> S<[ B<-sTtuUWX> ]>
S<[ B<-hv> ] [ B<-V>[:I<configvar>] ]>
- S<[ B<-cw> ] [ B<-d>[:I<debugger>] ] [ B<-D>[I<number/list>] ]>
+ S<[ B<-cw> ] [ B<-d>[B<t>][:I<debugger>] ] [ B<-D>[I<number/list>] ]>
S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [
B<-0>[I<octal/hexadecimal>] ]>
S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> ]>
S<[ B<-P> ]>
@@ -342,16 +342,24 @@ be skipped.
=item B<-d>
+=item B<-dt>
+
runs the program under the Perl debugger. See L<perldebug>.
+If B<t> is specified, it indicates to the debugger that threads
+will be used in the code being debugged.
=item B<-d:>I<foo[=bar,baz]>
+=item B<-dt:>I<foo[=bar,baz]>
+
runs the program under the control of a debugging, profiling, or
tracing module installed as Devel::foo. E.g., B<-d:DProf> executes
the program using the Devel::DProf profiler. As with the B<-M>
flag, options may be passed to the Devel::foo package where they
will be received and interpreted by the Devel::foo::import routine.
The comma-separated list of options must follow a C<=> character.
+If B<t> is specified, it indicates to the debugger that threads
+will be used in the code being debugged.
See L<perldebug>.
=item B<-D>I<letters>
@@ -1096,6 +1104,11 @@ The command used to load the debugger co
BEGIN { require 'perl5db.pl' }
+=item PERL5DB_THREADED
+
+If set to a true value, indicates to the debugger that the code being
+debugged uses threads.
+
=item PERL5SHELL (specific to the Win32 port)
May be set to an alternative shell that perl must use internally for