Skip Menu |

This queue is for tickets about the Enbugger CPAN distribution.

Report information
The Basics
Id: 70738
Status: resolved
Priority: 0/
Queue: Enbugger

People
Owner: Nobody in particular
Requestors: Rocky Bernstein (no email address)
rocky [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Add support for Trepan debugger
Hi - Great package! I'm in the process of porting my Ruby debugger to Perl and would like to add Enbugger support for that package. Attached should be a patch to add support. The code is at https://github.com/rocky/Perl-Devel-Trepan. It is far from finished, but even at this early stage it has some features that other debuggers don't have such as syntax highlighted via Syntax::Highlight::Perl::Improved, GNU Readline completion of debugger commands, extensive on-line help, support for inspecting and changing a return value of a function and is use extensible, modular, and testable. The package use Array::Columnize which I've just uploaded to CPAN. It too can be found on github at https://github.com/rocky/Perl-Array- Columnize.
Subject: Enbugger+trepan.patch
diff --git a/MANIFEST b/MANIFEST index cdece97..dd45847 100644 --- a/MANIFEST +++ b/MANIFEST @@ -19,6 +19,7 @@ lib/Enbugger/NYTProf.pm lib/Enbugger/perl5db.pm lib/Enbugger/ptkdb.pm lib/Enbugger/sdb.pm +lib/Enbugger/trepan.pm Makefile.PL MANIFEST This list of files META.yml diff --git a/lib/Enbugger.pm b/lib/Enbugger.pm index 43d667d..d2fb939 100644 --- a/lib/Enbugger.pm +++ b/lib/Enbugger.pm @@ -471,6 +471,7 @@ sub import { BEGIN { __PACKAGE__->register_debugger( 'perl5db' ); + __PACKAGE__->register_debugger( 'trepan' ); __PACKAGE__->register_debugger( 'NYTProf' ); } # TODO: __PACKAGE__->register_debugger( 'ebug' ); diff --git a/lib/Enbugger/trepan.pm b/lib/Enbugger/trepan.pm new file mode 100644 index 0000000..cb5e508 --- /dev/null +++ b/lib/Enbugger/trepan.pm @@ -0,0 +1,120 @@ +package Enbugger::trepan; + +# COPYRIGHT AND LICENCE +# +# Copyright (C) 2007,2008 WhitePages.com, Inc. with primary +# development by Joshua ben Jore. +# +# This program is distributed WITHOUT ANY WARRANTY, including but not +# limited to the implied warranties of merchantability or fitness for +# a particular purpose. +# +# The program is free software. You may distribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation (either version 2 or any later version) +# and the Perl Artistic License as published by O’Reilly Media, Inc. +# Please open the files named gpl-2.0.txt and Artistic for a copy of +# these licenses. + + +=head1 NAME + +Enbugger::trepan - subclass for the extraordinary trepanning debugger +=cut + + +use strict; +use vars qw( @ISA @Symbols ); +BEGIN { @ISA = 'Enbugger' } + + + + +=head1 OVERRIDEN METHODS + +=over + +=item CLASS-E<gt>_load_debugger + +=cut + +sub _load_debugger { + my ( $class ) = @_; + + $class->_compile_with_nextstate(); + require Devel::Trepan::Core; + $class->_compile_with_dbstate(); + + $class->init_debugger; + + return; +} + + + + + +=item CLASS-E<gt>_stop + +=cut + +1 if $DB::signal; +sub _stop { + + # trepan looks for these to stop. + $DB::signal = 1; + $DB::in_debugger = 0; + # tell trepan why we stopped here. + $DB::event = 'debugger-call'; + + # Use at least the default debug flags. + $^P |= 0x33f; + + return; +} + + + + + +=item CLASS-E<gt>_write( TEXT ) + +=cut + +1 if $DB::OUT; +sub _write { + my $class = shift @_; + + print { $DB::OUT } @_; + + return; +} + + + + + +=back + +=cut + + + + +# Load up a list of symbols known to be associated with this +# debugger. Enbugger, the base class will use this to guess at which +# debugger has been loaded if it was loaded prior to Enbugger being +# around. +1 if %Enbugger::RegisteredDebuggers; +$Enbugger::RegisteredDebuggers{trepan}{symbols} = [qw[ + DB + sub + eval_with_return + save +]]; + +## Local Variables: +## mode: cperl +## mode: auto-fill +## cperl-indent-level: 4 +## End:
Thanks for adding. (I have an update but I'll do that via github.)