Browse files

Give op locations for call stack using Devel::Callsite 0.08's call-le…

…vel parameter.
  • Loading branch information...
1 parent 01cb83c commit 8a3b198143df8ab9ce08c1755b10a56471c4a4ee Rocky Bernstein committed Mar 14, 2014
Showing with 60 additions and 22 deletions.
  1. +1 −1 Build.PL
  2. +6 −2 ChangeLog
  3. +11 −3 META.json
  4. +9 −3 META.yml
  5. +1 −1 lib/Devel/Trepan.pm
  6. +12 −5 lib/Devel/Trepan/CmdProcessor/Location.pm
  7. +9 −2 lib/Devel/Trepan/DB.pm
  8. +10 −4 lib/Devel/Trepan/DB/Eval.pm
  9. +1 −1 lib/Devel/Trepan/Version.pm
View
2 Build.PL
@@ -63,7 +63,7 @@ my $builder = Module::Build->new(
recommends => {
'B::CodeLines' => 1.1,
'Data::Printer' => 0,
- 'Devel::Callsite' => 0.06,
+ 'Devel::Callsite' => 0.08,
'Eval::WithLexicals' => 0,
'Pod::Text::Color' => 2.06,
'Term::ReadLine::Perl5' => 1.21,
View
8 ChangeLog
@@ -1,6 +1,10 @@
-2014-03-11 R. Bernstein <rocky@users.noreply.github.com>
+2014-03-12 Rocky Bernstein <rocky@cpan.org>
- * : Merge pull request #27 from rocky/Perl-Bug-RT-115742 Attempt to address issue #26 and perl bug RT 115742.
+ * t/20test-eval.t: Canonical output for eval3
+
+2014-03-12 Rocky Bernstein <rocky@cpan.org>
+
+ * : Get ready for release 0.52
2014-03-10 Rocky Bernstein <rocky@cpan.org>
View
14 META.json
@@ -50,6 +50,10 @@
}
},
"provides" : {
+ "Carp" : {
+ "file" : "lib/Devel/Trepan/DB/Sig.pm",
+ "version" : 0
+ },
"DBBreak" : {
"file" : "lib/Devel/Trepan/DB/Breakpoint.pm",
"version" : 0
@@ -60,7 +64,7 @@
},
"Devel::Trepan" : {
"file" : "lib/Devel/Trepan.pm",
- "version" : "0.51"
+ "version" : "0.52"
},
"Devel::Trepan::BrkptMgr" : {
"file" : "lib/Devel/Trepan/BrkptMgr.pm",
@@ -586,6 +590,10 @@
"file" : "lib/Devel/Trepan/DB/LineCache.pm",
"version" : "1.0"
},
+ "Devel::Trepan::DB::Sig" : {
+ "file" : "lib/Devel/Trepan/DB/Sig.pm",
+ "version" : 0
+ },
"Devel::Trepan::DB::Use" : {
"file" : "lib/Devel/Trepan/DB/Use.pm",
"version" : 0
@@ -684,7 +692,7 @@
},
"Devel::Trepan::Version" : {
"file" : "lib/Devel/Trepan/Version.pm",
- "version" : "0.51"
+ "version" : "0.52"
},
"Devel::Trepan::WatchMgr" : {
"file" : "lib/Devel/Trepan/WatchMgr.pm",
@@ -715,7 +723,7 @@
"url" : "http://github.com/rocky/Perl-Devel-Trepan"
}
},
- "version" : "0.51",
+ "version" : "0.52",
"x_test_requires" : {
"Test::More" : "0.81",
"Time::HiRes" : "1.9721",
View
12 META.yml
@@ -14,6 +14,9 @@ meta-spec:
version: 1.4
name: Devel-Trepan
provides:
+ Carp:
+ file: lib/Devel/Trepan/DB/Sig.pm
+ version: 0
DBBreak:
file: lib/Devel/Trepan/DB/Breakpoint.pm
version: 0
@@ -22,7 +25,7 @@ provides:
version: 0
Devel::Trepan:
file: lib/Devel/Trepan.pm
- version: 0.51
+ version: 0.52
Devel::Trepan::BrkptMgr:
file: lib/Devel/Trepan/BrkptMgr.pm
version: 0
@@ -416,6 +419,9 @@ provides:
Devel::Trepan::DB::LineCache:
file: lib/Devel/Trepan/DB/LineCache.pm
version: 1.0
+ Devel::Trepan::DB::Sig:
+ file: lib/Devel/Trepan/DB/Sig.pm
+ version: 0
Devel::Trepan::DB::Use:
file: lib/Devel/Trepan/DB/Use.pm
version: 0
@@ -490,7 +496,7 @@ provides:
version: 0
Devel::Trepan::Version:
file: lib/Devel/Trepan/Version.pm
- version: 0.51
+ version: 0.52
Devel::Trepan::WatchMgr:
file: lib/Devel/Trepan/WatchMgr.pm
version: 0
@@ -527,7 +533,7 @@ resources:
bugtracker: https://github.com/rocky/Perl-Devel-Trepan/issues
license: http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt
repository: http://github.com/rocky/Perl-Devel-Trepan
-version: 0.51
+version: 0.52
x_test_requires:
Test::More: 0.81
Time::HiRes: 1.9721
View
2 lib/Devel/Trepan.pm
@@ -18,7 +18,7 @@ use Exporter;
use constant PROGRAM => 'trepan.pl';
use version;
-$VERSION='0.52'; # To fool CPAN indexer. Is <= real version
+$VERSION='0.52_01'; # To fool CPAN indexer. Is <= real version
$VERSION = $Devel::Trepan::Version::VERSION;
$PROGRAM = PROGRAM;
View
17 lib/Devel/Trepan/CmdProcessor/Location.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2013 Rocky Bernstein <rocky@cpan.org>
+# Copyright (C) 2011-2014 Rocky Bernstein <rocky@cpan.org>
use strict;
use Exporter;
use warnings;
@@ -179,10 +179,17 @@ sub source_location_info($)
my $line_number = $self->line() || 0;
my $op_addr = '';
- if ($self->{settings}{displayop}
- && $DB::OP_addr
- && $self->{frame_index}== 0) {
- $op_addr = sprintf " \@0x%x", $DB::OP_addr;
+ if ($self->{settings}{displayop}) {
+ my $frame_index = $self->{frame_index};
+ if ($DB::OP_addr && $frame_index == 0) {
+ $op_addr = sprintf " \@0x%x", $DB::OP_addr;
+ } elsif ($DB::HAVE_MODULE{'Devel::Callsite'} eq 'call_level_param') {
+ ## print "++++ WOOHOO\n";
+ my $skip = DB::caller_levels_skip();
+ $op_addr =
+ sprintf(" \@0x%x",
+ Devel::Callsite::callsite($frame_index + $skip));
+ }
}
if (filename_is_eval($filename)) {
### FIXME: put this all into DB::LineCache
View
11 lib/Devel/Trepan/DB.pm
@@ -142,8 +142,15 @@ BEGIN {
# No extry/exit tracing.
$frame = 0;
- $HAVE_MODULE{'Devel::Callsite'} = eval("use Devel::Callsite; 1") ? 1 : 0;
-
+ if (eval("use Devel::Callsite; 1")) {
+ if ($Devel::Callsite::VERSION >= 0.08) {
+ $HAVE_MODULE{'Devel::Callsite'} = 'call_level_param';
+ } else {
+ $HAVE_MODULE{'Devel::Callsite'} = 'single_level';
+ }
+ } else {
+ $HAVE_MODULE{'Devel::Callsite'} = '';
+ }
}
END {
View
14 lib/Devel/Trepan/DB/Eval.pm
@@ -28,10 +28,7 @@ BEGIN {
# no critic
-# Provide a replacement for built-in CORE::caller
-sub caller_sans_DB(;$) {
- my $levels = shift;
- $levels = 0 unless defined($levels);
+sub caller_levels_skip() {
my $skip=0;
my $db_fn = ($DB::event eq 'post-mortem') ? 'catch' : 'DB';
@@ -46,6 +43,15 @@ sub caller_sans_DB(;$) {
last ;
}
}
+ $skip-- if $skip > 0;
+ return $skip;
+}
+
+# Provide a replacement for built-in CORE::caller
+sub caller_sans_DB(;$) {
+ my $levels = shift;
+ $levels = 0 unless defined($levels);
+ my $skip = caller_levels_skip();
my @caller = CORE::caller($skip+$levels);
return if ! @caller; # empty
View
2 lib/Devel/Trepan/Version.pm
@@ -1,3 +1,3 @@
package Devel::Trepan::Version;
-use version; $VERSION = '0.52';
+use version; $VERSION = '0.52_01';
1;

0 comments on commit 8a3b198

Please sign in to comment.