New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
threads and the debugger bug #7505
Comments
From richard.foley@ubs.comHi, I've been trying to run the debugger against a simple (demo) threaded Perl program. What appears to happen is that every time I enter a command, to print a At first I thought this was a interesting quantum-type behaviour (each time you Any chance we could fix this, so that it behaved as one might expect? Perhaps This is a quick listing so you can see what I mean: $ > /opt/perlthreads/bin/perl -d threads-bug Loading DB routines from perl5db.pl version 1.27 Spooky, huh ?-) The full code listings are attached: threads-bug-prog # the program Ciao Richard.Foley@rfi.net http://www.oreilly.com/catalog/perldebugpr/ |
From richard.foley@ubs.comVisit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From richard.foley@ubs.comHere is a patch for the debugger to allow it to debug threaded Perl programs using ithreads. It also fixes perl bug: #31666 Ciao http://www.oreilly.com/catalog/perldebugpr/ |
From richard.foley@ubs.comVisit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From @ysthOn Wed, Oct 13, 2004 at 08:04:36AM +0200, richard.foley@ubs.com wrote:
Needs to be a way to run the debugger without using threads, even if |
The RT System itself - Status changed from 'new' to 'open' |
From richard.foley@ubs.comAha. I thought someone might want this... It doesn't 'use threads' (or rather require), of course, unless ithreads has been configured. The issue I see, where you have a choice, is that someone might wish to use threads further down the line, and the debugger simply needs to have this setup right early on. Just like using Term::ReadLine or IO::Socket or Term::Rendezvous, etc. , these need to be setup on at the start, and imho (very small o ;), doing this later will be a real bucket of worms. Or do you think it might be ok to just complain if there is an attempt to use threads, when it has been explicitly turned off? Perhaps it could be a runtime (commandline) option to turn it on in the first place? Thoughts? Ciao http://www.oreilly.com/catalog/perldebugpr/
|
From richard.foley@ubs.comVisit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From @ysthOn Wed, Oct 13, 2004 at 08:30:39AM +0200, richard.foley@ubs.com wrote:
Random thoughts: If a commandline option would do it, that sounds good. Otherwise, perhaps |
From richard.foley@ubs.com
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. Ciao http://www.oreilly.com/catalog/perldebugpr/
Visit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From richard.foley@ubs.comHere's a similar patch with PERL5DB_THREADED enabled - a much better implementation, thanks Yitzchak! Threads are now only used, (require'd in the debugger), if asked for explicitly via this environment variable. I'll take a look at perl.c and -dt soon as per your suggestion. In the meantime you can use this with: PERL5DB_THREADED=1 threadedperl -d threadedprog ... Ciao http://www.oreilly.com/catalog/perldebugpr/
|
From richard.foley@ubs.comVisit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From @rgsrichard.foley@ubs.com wrote:
Sounds good to me. BTW, what's "-dt" ? |
From richard.foley@ubs.com'-dt' was Yitzchak's sensible suggestion for enabling threads under the debugger: perl -dt prog args Instead of using the clunky manually set invironment variable. PERL5DB_THREADED=true is in, but -dt is not yet - am currently waiting for more noise first ;-) Ciao http://www.oreilly.com/catalog/perldebugpr/
|
From richard.foley@ubs.comVisit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From @ysthOn Wed, Oct 13, 2004 at 08:57:15AM +0200, richard.foley@ubs.com wrote:
Here's a completely untested (even uncompiled) patch, if it helps you at all. Inline Patch--- 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 |
From richard.foley@ubs.comWhoa - cool :-) I'll give it a shot - cheers! Ciao http://www.oreilly.com/catalog/perldebugpr/
Visit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From @ysthOn Wed, Oct 13, 2004 at 10:06:16AM +0200, richard.foley@ubs.com wrote:
Note that -dt currently means bundled -d -t, but since that is likely |
From richard.foley@ubs.comYitzchak, That works just fine - thanks muchly :-) I just had to swap the line (in MY patch) which read: if ($Config{useithreads} && $ENV{PERL5DB_THREADED}) { to read: if ($ENV{PERL5DB_THREADED}) { I attach the improved (third try) patch FYI. Ciao http://www.oreilly.com/catalog/perldebugpr/
|
From richard.foley@ubs.comVisit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From @rgsrichard.foley@ubs.com wrote:
Thanks, both patches applied to bleadperl as #23372. |
From richard.foley@ubs.comCool - cheers :-) Ciao http://www.oreilly.com/catalog/perldebugpr/
|
From richard.foley@ubs.comVisit our website at http://www.ubs.com This message contains confidential information and is intended only E-mail transmission cannot be guaranteed to be secure or error-free |
From @richardfoleyFixed via supplied Patch |
@richardfoley - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#31666 (status was 'resolved')
Searchable as RT31666$
The text was updated successfully, but these errors were encountered: