Jouke has asked for the wisdom of the Perl Monks concerning the following question:

Let me be explicit on this one: I don't want to start another 'using a debugger is good or bad'-flamewar here again, I just have a question regarding the use of Devel::ptkdb...

I regularely use Devel::ptkdb to debug my programs. A colleague of mine came up with a question last week, to which I didn't have the answer. That's because I never used multithreading and forked processes before.

He tested Devel::ptkdb on a program that used fork(). The debugger just hang with an error saying
Xlib: unexpected async reply (sequence 0x5f1)! X Error of failed request: BadIDChoice (invalid resource ID chosen fo +r this connection) Major opcode of failed request: 53 (X_CreatePixmap) Resource id in failed request: 0x4000078 Serial number of failed request: 1564 Current serial number in output stream: 1480


Does anyone know how to prevent this behaviour or how to debug multithreading perlscripts with a graphical debugger?

Jouke Visser, Perl 'Adept'

Replies are listed 'Best First'.
Re: Forked processes && Perl TK Debugger (ptkdb)
by physi (Friar) on Apr 17, 2001 at 15:40 UTC
    AFAIK there's unfortunately no chance to debug a forked process. Cause this is a new process, you get no contact to it with your debugger.
    If there is a chance, I would also be very happy to know how.
    ----------------------------------- --the good, the bad and the physi-- -----------------------------------

      You can debug Perl scripts that fork() using the default Perl debugger. It gets a bit confusing because you end up with competing prompts from the two resulting copies of the Perl debugger, though.

      This sounds like a limitation in the particular debugger being used.

              - tye (but my friends call me "Tye")
      Which would be strange, since, AFAIK, it is possible in other languages...

      Jouke Visser, Perl 'Adept'
Re: Forked processes && Perl TK Debugger (ptkdb)
by mpersico (Monk) on Apr 24, 2019 at 17:48 UTC
    I would like to try and resurrect this conversation. I have found this X11 limitation to be very frustrating. I am going to do a bit of investigation myself. Given that the standard Perl debugger has a hardcoded path for xterms (see https://metacpan.org/source/SHAY/perl-5.28.1/lib/perl5db.pl#L1335), there should be a way to integrate another X program, namely Devel::ptkdb.
      From what I remember are GUIs connected via a socket connection to the normal Perl debugger.

      The actions are just translated into normal debugger commands.

      That's at least how IDEs like Emacs connect to the debugging process and like tye already said debugging threaded programs should be supported by normal debugging.

      So If I were you I'd try to replicate the problem with the plain debugger ( perl -d ) and then an IDE like Komodo or Emacs.

      If these work, then the problem is most likely on the client side.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice