-
Notifications
You must be signed in to change notification settings - Fork 576
Setting breakpoint on AUTOLOAD causes segmentation fault #19198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The core file points to this line: https://github.com/Perl/perl5/blob/blead/dump.c#L2588 It's hard to debug any further because setting a breakpoint in this loop makes it hard to even get to the point where you can actually run a Perl program. |
-Dtol output:
|
-Dm output
|
I tried this about 10 times and never got a segfault. I was building on FreeBSD-12 at v5.35.4-143-g7ab72683be. |
Perhaps it depends on the platform. I only tested on Linux. |
The problem is intermittent for me:
I haven't been able to reproduce it with perl running under the debugger, the backtrace from the core file for me:
Running with Under valgrind:
which is suspicious. |
Yeah, it's intermittent for me as well, and I can't reproduce under Valgrind. It must be a timing thing, and Valgrind sufficiently slows everything down to prevent it from happening. |
I think the valgrind report above indicates the base cause of the problem. The debugger breaks on subroutines by breaking on the first line in a subroutine, which works by modifying the DBSTATE op found for the first breakable line in the sub. When that first line is a This had two consequences;
I have a working patch that clears the stored op address, and it seems to fix the problem (both valgrind, and the breakpoint working), but I'll need to test it some more and add a regression test. |
This could cause a bad read and write when the debugger tried to set a breakpoint on the line. Fixed Perl#19198
These are meant to be IOK even when non-breakable, and I broke that when fixing Perl#19198. Fixes Perl#21564
These are meant to be IOK even when non-breakable, and I broke that when fixing Perl#19198. Fixes Perl#21564
Description
Setting a breakpoint on an AUTOLOAD under certain circumstances causes a segmentation fault. It's unclear what is the minimum amount of code required to reproduce the issue, but at the very least it seems to require:
I was able to reproduce this on both 5.32 and 5.34.
Steps to Reproduce
I was able to get this code to segfault, but it didn't happen every time.
Start the perl debugger with this code, then set a breakpoint on Test::AUTOLOAD, and continue. You should get this error message:
Expected behavior
It should break on the first line of the AUTOLOAD subroutine and not segfault.
Perl configuration
The text was updated successfully, but these errors were encountered: