Skip to content

Commit

Permalink
Enbugger patch for trepan support
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocky Bernstein committed Oct 9, 2011
1 parent f5dab5a commit 9047db3
Showing 1 changed file with 150 additions and 0 deletions.
150 changes: 150 additions & 0 deletions data/Enbugger-trepan.patch
@@ -0,0 +1,150 @@
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:

0 comments on commit 9047db3

Please sign in to comment.