| 1 | #!/usr/bin/env perl | ||
| 2 | # Copyright (C) 2013-2015, 2019 Rocky Bernstein <rocky@cpan.org> | ||
| 3 | # Documentation is at the __END__ | ||
| 4 | eval "use feature ':5.10';"; | ||
| 5 | use strict; use warnings; | ||
| 6 | |||
| 7 | use rlib '..'; | ||
| 8 | use Devel::Trepan::Version; | ||
| 9 | use Devel::Trepan::Core; | ||
| 10 | |||
| 11 | package Devel::Trepan; | ||
| 12 | |||
| 13 | use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION $TREPAN_CMDPROC $PROGRAM); | ||
| 14 | use Exporter; | ||
| 15 | |||
| 16 | @EXPORT = qw(debugger); | ||
| 17 | @ISA = qw(Exporter); | ||
| 18 | |||
| 19 | |||
| 20 | use constant PROGRAM => 'trepan.pl'; | ||
| 21 | our $VERSION='1.0.1'; # | ||
| 22 | $VERSION = $Devel::Trepan::Version::VERSION; | ||
| 23 | $PROGRAM = PROGRAM; | ||
| 24 | |||
| 25 | sub show_version() { | ||
| 26 | 0 | ▶ | PROGRAM . ", version $Devel::Trepan::VERSION"; |
|
Subroutine
show_version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 27 | } | ||
| 28 | |||
| 29 | # Access to stopping point as an integer. | ||
| 30 | 0 | ▶ | sub addr() { $DB::OP_addr }; |
|
Subroutine
addr: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 31 | |||
| 32 | # Access to stopping point as a hex string. | ||
| 33 | 0 | ▶ | sub haddr() { sprintf "0x%x", $DB::OP_addr } |
|
Subroutine
haddr: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 34 | |||
| 35 | # =head2 debugger | ||
| 36 | # Allows program to make an explicit call to the debugger. | ||
| 37 | # B<Example:> | ||
| 38 | # | ||
| 39 | # In your Perl program I<foo.pl>: | ||
| 40 | # | ||
| 41 | # my $x = 1; | ||
| 42 | # Devel::Trepan::debugger; | ||
| 43 | # my $y = 2; # Above line causes a stop here. | ||
| 44 | # | ||
| 45 | # Invoke as: | ||
| 46 | # | ||
| 47 | # $ trepan.pl foo.pl | ||
| 48 | # -- main::(foo.pl:1) | ||
| 49 | # (trepanpl): continue | ||
| 50 | # (trepanpl): c | ||
| 51 | # :o main::(foo.pl:3) | ||
| 52 | # my $y = 2; | ||
| 53 | # | ||
| 54 | # This is like C<Enbugger-E<gt>stop> but without L<Enbugger>. However in | ||
| 55 | # contrast to Enbugger, in order for this to work you must have | ||
| 56 | # previously set up for debugging previously by running trepan.pl. | ||
| 57 | # | ||
| 58 | # =cut | ||
| 59 | |||
| 60 | sub debugger { | ||
| 61 | 0 | ▶ | $DB::in_debugger = 0; |
|
Subroutine
debugger: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 62 | 0 | $DB::event = 'debugger-call'; | |
| 63 | 0 | $DB::signal = 2; | |
| 64 | } | ||
| 65 | |||
| 66 | if (__FILE__ eq $0 ) { | ||
| 67 | print show_version(), "\n"; | ||
| 68 | } | ||
| 69 | |||
| 70 | unless (caller) { | ||
| 71 | print show_version, "\n"; | ||
| 72 | print "Pssst... this is a module. See trepan.pl to invoke.\n" | ||
| 73 | } | ||
| 74 | no warnings; | ||
| 75 | "Just another Perl Debugger"; | ||
| 76 | __END__ | ||