Greetings wise brothers.

I have been asked to do some maintenance on a perl program that makes substantial use of threads. I have attempted to debug it using the perl command line debugger, and I am finding the process difficult because more than one thread is active at once and they are not separate. If there are multiple breakpoints active, and multiple threads that could hit then I find that while stepping over code, my next prompt could at any time be in a different thread from the one I was debugging a moment before.

I know the obvious suggestion is to turn of the multi threading, but the design of the program is such that to do so would be a substantial undertaking, and I don't want to risk breaking parts of the program that I don't need to.

In the past when debugging perl programs that make use of multiple processes via fork(), I have been able to keep the processes separate by running the debug session under linux in an xterm window, then if a child process hits a breakpoint, then another xterm window is created for that process so I can debug it separately from the parent and any other children.

Is there a similar technique for debugging Perl that uses threads? Any other tips?


In reply to How to debug perl code that uses threads by chrestomanci

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.