Honor $^P subroutine tracing when populating %DB::sub
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 31/100
Línea de trabajo
Start in BytecodeCompiler and SubroutineParser where named-sub source registration is gated on DebugState.isDebugMode(), and find where Perl's $^P is stored and mutated so the 0x10 bit can feed that gate. Then check that %DB::sub entries are written with the defining filename, and validate against system Perl with a new focused test before running the unchanged Module-Refresh t/1api.t and t/clear_symtable.t on both the JVM and interpreter backends. Done means those two tests pass and -d debugger tracing still behaves as before.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
PerlOnJava does not populate %DB::sub when Perl code enables subroutine source tracing with $^P |= 0x10. Pure-Perl modules such as Module::Refresh rely on this documented Perl behavior to locate and unload subs defined by a changed file. As a result, refreshed modules retain old methods after reload.
Reproduction and evidence
The unchanged Module-Refresh 0.18 test suite passes under system Perl 5.34.1 (4 files, 16 tests). In CPAN random tester run 20261119-133823-51077, PerlOnJava failed 2 of 16 assertions:
t/1api.t, test 8:We cleaned out the 'foo' methodt/clear_symtable.t, test 4:!Foo->can('bar')
Both failures reproduce on the JVM and interpreter backends in the PerlOnJava checkout at 75525a5dc (2026-11-20), after the symbol-table/method-lookup changes integrated by #1773. The test demonstrates that the old Foo::bar remains callable after Foo.pm is refreshed with a replacement Foo::baz.
A focused diagnostic also sets $^P |= 0x10, loads a file declaring Foo::bar, then inspects %DB::sub: PerlOnJava reports no Foo:: entries while Foo->can('bar') is true. The normal system-Perl run of the complete distribution suite passes.
Environment: macOS 26.7.3, Temurin OpenJDK 24.0.2, system Perl 5.34.1.
Root cause
Module::Refresh sets $^P |= 0x10 in its BEGIN block. Its unload_subs method finds candidate routines by matching each %DB::sub source-location value against the module filename; if no entries match, it cannot remove those routines before require reloads the file.
PerlOnJava currently gates named-sub location registration in BytecodeCompiler and SubroutineParser on DebugState.isDebugMode(). That internal state is enabled by the command-line debugger path, but setting Perl's $^P bit from Perl code does not enable the corresponding subroutine-tracing behavior. Consequently, dynamically loaded modules can compile named subs without registering their source locations in %DB::sub, and Module::Refresh silently leaves old subs installed.
This is related to #1610, which covered stale method lookup after deleting a CODE slot and was integrated in #1773. The current report tracks the separate missing $^P/%DB::sub behavior; the Module::Refresh failures recorded on #1610 still reproduce after that integration.
Expected behavior
When Perl code enables the 0x10 subroutine source-tracing bit in $^P, named subs compiled afterward should appear in %DB::sub with source locations that identify their defining file. Module::Refresh must then be able to remove the previous file's subs, and the refreshed package should expose only the replacement methods.
Acceptance criteria
- Add a focused project-owned Perl test for enabling
$^Pbit0x10and observing source entries for subsequently compiled named subs; validate its expected behavior with system Perl first. - Pass that regression on both JVM and interpreter backends.
- Pass the unchanged
Module-Refresh0.18 suite on both backends, includingt/1api.tandt/clear_symtable.t. - Preserve command-line debugger behavior and verify
%DB::subremains consistent when tracing is enabled through$^Prather than-d.
- Lenguaje dominante
- Perl
- Estrellas
- 67
- Forks
- 8
- Merge medio
- 5 h 12 min
- PR fusionados (30 d)
- 131
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de fglock/PerlOnJava
-
area:cpan-port bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
fglock/PerlOnJava#2153 ·
Los mantenedores suelen responder en 1 día
-
area:cpan-port area:parser bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
fglock/PerlOnJava#2137 ·
Los mantenedores suelen responder en 1 día
-
area:backend area:cpan-port area:runtime bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
fglock/PerlOnJava#2071 ·
Los mantenedores suelen responder en 1 día
-
area:runtime documentation enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
fglock/PerlOnJava#1579 ·
Los mantenedores suelen responder en 1 día
-
area:cpan-port bug
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
fglock/PerlOnJava#2157 ·
Los mantenedores suelen responder en 1 día
Todos los issues de fglock/PerlOnJava
Issues similares
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling linksAbiertoteam-cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 93/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
inverse-inc/packetfence#9728 ·
Los mantenedores suelen responder en 1 día
-
fix(char-create): show the real reason a character is refusedPosiblemente ocupada @baphomello la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día