Skip to content
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

hide private functions breaks Enbugger #22643

Open
midenok opened this issue Oct 7, 2024 · 8 comments
Open

hide private functions breaks Enbugger #22643

midenok opened this issue Oct 7, 2024 · 8 comments
Labels
BBC Blead Breaks CPAN - changes in blead broke a cpan module(s) type-debugger

Comments

@midenok
Copy link

midenok commented Oct 7, 2024

0351a62 causes mgruberman/Enbugger#13

Enbugger is important module which allows to run perl debugger from inside GDB. That enforces me to sit on 5.36.

@Leont
Copy link
Contributor

Leont commented Oct 7, 2024

CPANTesters suggests this never even worked on perls above 5.18 anyway, which may make it hard to look at what's going on here. It hasn't seen an update in more than a decade.

Private symbols have been hidden on some platforms forever (in particular on Windows). This module really should not be doing what it's doing. The author really should have been talking with us instead.

@midenok
Copy link
Author

midenok commented Oct 7, 2024

I'm still using it. It works just fine except when attaching to running process 'b' and 'r' don't work well. Still a huge help to look at the stack trace of a hung script and examine variables.

AFAICS there are only 2 symbols used, so not very big intrusion. Would there be a solution of keeping the functionality of what Enbugger can do?

@Leont
Copy link
Contributor

Leont commented Oct 8, 2024

It's hooking into the debugger all wrong as far as I can tell. A proper debugging module (loaded with `perl -d:Enbugger) would set the right bits automatically and wouldn't need to fiddle with these perl internals.

Actually, setting $^P to 0x02 should be enough to initialize the debugger and generate Perl_pp_dbstate instead of Perl_pp_nextstate, though 0x73f is a more customary value (that actually activates the debugger for example).

@mauke
Copy link
Contributor

mauke commented Oct 8, 2024

Wasn't the whole point of Enbugger that it could enable debugging at runtime even if perl hadn't been started with perl -d?

@midenok
Copy link
Author

midenok commented Oct 8, 2024

Wasn't the whole point of Enbugger that it could enable debugging at runtime even if perl hadn't been started with perl -d?

True, that is the point. When the script accidentally hung, which is hard to reproduce, you just attach and check what's going on.

@jkeenan jkeenan added type-debugger BBC Blead Breaks CPAN - changes in blead broke a cpan module(s) and removed Needs Triage labels Oct 9, 2024
@jkeenan
Copy link
Contributor

jkeenan commented Oct 9, 2024

I attempted to bisect the core distro in the hope that locating the exact commit at which Enbugger began to fail would help us in developing a better analysis of the problem reported in this ticket. However, www.cpantesters.org's "backend" is giving 503 and other errors, while the metabase is failing to receive uploaded reports. See: https://www.nntp.perl.org/group/perl.cpan.testers.discuss/2024/10/msg4648.html.

@jkeenan
Copy link
Contributor

jkeenan commented Oct 10, 2024

I attempted to bisect the core distro in the hope that locating the exact commit at which Enbugger began to fail would help us in developing a better analysis of the problem reported in this ticket. However, www.cpantesters.org's "backend" is giving 503 and other errors, while the metabase is failing to receive uploaded reports. See: https://www.nntp.perl.org/group/perl.cpan.testers.discuss/2024/10/msg4648.html.

For what it's worth, the first commit at which Enbugger no longer PASSed on CPANtesters (unthreaded build on Linux) was 43e4250 (v5.19.5-83-g43e4250a61).

43e4250a611bbded7aab070226e8d756638cd569 is the first bad commit
commit 43e4250a611bbded7aab070226e8d756638cd569
Author: Father Chrysostomos <[email protected]>
Date:   Mon Oct 28 16:14:35 2013 -0700
Commit:     Father Chrysostomos <[email protected]>
CommitDate: Mon Oct 28 16:15:11 2013 -0700

    [perl #119799] Set breakpoints without *DB::dbline
    
    The elements of the %{"_<..."} hashes (where ‘...’ is the filename),
    whose keys are line numbers, are used to set breakpoints on the given
    lines.  The corresponding @{"_<..."} array contains the actual lines
    of source code.
    
    %{"_<..."} actually acts on the array of lines that @DB::dbline is
    aliased to.  The assumption is that *DB::dbline = *{"_<..."} will have
    taken place first.  Hence, all %{"_<..."} hashes are the same, when it
    comes to writing to keys.
    
    It is more useful for each %{"_<..."} hash to set breakpoints on its
    corresponding file’s lines regardless of whether @DB::dbline has been
    aliased, so that is what this commit does.
    
    Each hash’s mg_obj pointer in its dbfile magic now points to the
    array, and magic_setdbline uses it instead of PL_DBline.

 gv.c            |  2 +-
 mg.c            |  3 ++-
 t/run/switchd.t | 23 ++++++++++++++++++++++-
 3 files changed, 25 insertions(+), 3 deletions(-)
bisect found first bad commitThat took 1573 seconds.

@bulk88
Copy link
Contributor

bulk88 commented Oct 14, 2024

I posted an ugly fix/unsupported solution in mgruberman/Enbugger#13

This ticket should stay open though to debate if extra documented public XS API for CPAN is needed. I have no opinion/don't know enough to say anything on API design topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BBC Blead Breaks CPAN - changes in blead broke a cpan module(s) type-debugger
Projects
None yet
Development

No branches or pull requests

5 participants