I'm trying to debug some ithreaded apps/modules on WinXP using trusty old perl -dt. I've found the new e/E commands, tho they are of limited help (just display the current threadid). The problem is that all threads are hooked to the same TTY (er, "Command Prompt"), so even simple threaded apps get pretty confusing to debug (one thread controls the command prompt, the other sits around waiting to get a 'c', 'n', or 's' command).

Ideally, I'd be able to use something akin to $DB::fork_TTY/get_fork_TTY(). I've been casting about on Google, MailArchives, perldoc, and here, for a couple hours now, and can't find anything explicit.

And FWIW I can't even remember how to apply $DB::fork_TTY to fork()'ing on Win32, tho I'm certain I've used it somehow a year or so ago (middle age and homebrew beer is apparently taking a toll on my synapses).

So I guess I've got multiple questions:

  1. Is there a $DB::fork_TTY equivalent for ithreads (regardless of the OS) ?
  2. How can I use $DB::fork_TTY on Win32 ?
  3. Is there a decent alternative debugger that handles threads in a user-friendly way ? (e.g., does Komodo handle threads nicely ?)
Any assistance much appreciated.

Update: After some more study (mostly of perl5db), I've answered most of my own questions (tho most were not the answers I wanted...<sigh/>):

1) Nope, no DB::fork_TTY/get_fork_TTY() for threads

2) Sorry, can't. (I must've been running on cygwin or SFU before)

3) Sorry, no. I tried Komodo and it was actually worse (in some respects) at handling threads than regular command line debugging.

I also learned that the e/E commands were just introduced in 5.8.6.

So...since my only options are to move the entire project to Java or (god forbid) C++, or to solve this sticky issue, I guess I'll be spending the next few days hacking up perl5db.pl to try to solve some of these issues.

I'm likely to try to permit Win32 support via Win32::Process opening a new command prompt window ala xterm_get_fork_TTY().

As to opening a new window, I'm thinking of keeping a shared hash mapping tid's to IN/OUT handles, tho the threading issue may be more challenging than that, as perl5db indicates that once a thread is running, it runs to completion without permitting another thread to run. (However, I've noticed that when I omit -dt, and just use -d, it does switch between threads, tho unpredictably, similar to the behavior when fork()'ed processes use the same TTY.

I'm also hoping to figger out the Perl/Tk hooks so this might be applied to ptkdb, but thats probably wishful thinking at this point.

Anyhow, if any monks (saints?) can shed light on the right way to do this, and exactly where in perl5db to make the incisions, I'd be much obliged.


In reply to Win32, $DB::fork_TTY, and a threads equivalent by renodino

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.