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

Monks, I have spent the morning trying to upgrade some working code from 5.8.9 to the latest version of perl (5.22/5.24) and I've hit a mini brick wall. The code is mainly for windows, but it also works under Linux.

The code turns on the perl debugger in a separate thread at the XS level, this allows the debugger to be used to step through running perl code in that separate thread. It's hard to explain, but works well:)

It seems (given my limited understanding) that the correct way to do this in later perl's is to use the Perl_init_debugger function, but it doesn't seem to be available? Using the raw source code for this function works well but that would mean that my code would only works on that specific version of perl, something that I want to avoid...

An example of a module that uses this function is Enbugger:

https://metacpan.org/source/JJORE/Enbugger-2.016/Enbugger.xs

However, this module doesn't actually compile under ActiveState 5.22 or Stawberry 5.24

Enbugger.o:Enbugger.c:(.text+0x852): undefined reference to `__imp_Perl_init_debugger'

Does anyone know the 'correct' way to use this function?

Any hints would be gratefully appreciated.

  • Comment on How to use Perl_init_debugger in XS code?

Replies are listed 'Best First'.
Re: How to use Perl_init_debugger in XS code?
by Anonymous Monk on Jan 09, 2017 at 12:38 UTC
      Thanks for the reply.

      I may have not explained very well.

      From the various docs, the function Perl_init_debugger should exist for XS modules to call, but it doesn't. Using the raw source code for Perl_init_debugger solves my problem.

        The wisdom from the link is

        to use objdump to confirm the symbol exists, since it should exist

        and to make sure you're not having conflicting/old mingw/gcc...something in your %PATH%, which might be causing the error