Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core.pm: Don't trace into SelfLoader now that we know it works. selfl…
…oadertest.pl: this really works now. Add "set substitute command". SelfLoader.pm: protoype->prototype.
- Loading branch information
Rocky Bernstein
committed
Jun 9, 2013
1 parent
911b244
commit 263c7bf
Showing
5 changed files
with
133 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Substitute.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2013 Rocky Bernstein <rocky@cpan.org> | ||
use warnings; no warnings 'redefine'; no warnings 'once'; | ||
use rlib '../../../../..'; | ||
use strict; | ||
use vars qw(@ISA @SUBCMD_VARS); | ||
|
||
package Devel::Trepan::CmdProcessor::Command::Set::Substitute; | ||
|
||
use Devel::Trepan::CmdProcessor::Command::Subcmd::Core; | ||
use Devel::Trepan::CmdProcessor::Command::Subcmd::SubsubMgr; | ||
use vars qw(@ISA @SUBCMD_VARS); | ||
our $MIN_ABBREV = length('sub'); | ||
our $HELP = <<"HELP"; | ||
=pod | ||
Set filename remapping. | ||
Sometimes the filename or line ranges reported inside the debugger | ||
might not match the filenames or line ranges where you can find the | ||
source in the OS filesystem. This may happen because of pathnames do | ||
not match or program text comes from evaluated lines in code. | ||
=cut | ||
HELP | ||
|
||
our $SHORT_HELP = "Set filename remapping"; | ||
|
||
@ISA = qw(Devel::Trepan::CmdProcessor::Command::SubsubcmdMgr); | ||
|
||
unless (caller) { | ||
# Demo it. | ||
require Devel::Trepan; | ||
# require_relative '../../mock' | ||
# dbgr, parent_cmd = MockDebugger::setup('set', false) | ||
# cmd = Trepan::SubSubcommand::SetMax.new(dbgr.core.processor, | ||
# parent_cmd) | ||
# cmd.run(cmd.prefix + ['string', '30']) | ||
|
||
# %w(s lis foo).each do |prefix| | ||
# p [prefix, cmd.complete(prefix)] | ||
# end | ||
} | ||
|
||
1; |
65 changes: 65 additions & 0 deletions
65
lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Substitute_Subcmd/Path.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2013 Rocky Bernstein <rocky@cpan.org> | ||
use warnings; no warnings 'redefine'; no warnings 'once'; | ||
use rlib '../../../../../..'; | ||
|
||
package Devel::Trepan::CmdProcessor::Command::Set::Substitute::Path; | ||
use Devel::Trepan::DB::LineCache; | ||
|
||
use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd; | ||
use strict; | ||
use vars qw(@ISA @SUBCMD_VARS); | ||
@ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd); | ||
|
||
# Values inherited from parent | ||
|
||
use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS; | ||
our $CMD = 'set display eval'; | ||
my @DISPLAY_TYPES = @Devel::Trepan::CmdProcessor::DISPLAY_TYPES; | ||
my $param = join('|', @DISPLAY_TYPES); | ||
our $HELP = <<"HELP"; | ||
=pod | ||
B<set substitute path> [I<from-path>] I<to-path> | ||
Add a substitution rule replacing I<from-path> into I<to-path> in | ||
source file names. If a substitution rule was previously set for | ||
I<from-path>, the old rule is replaced by the new one. If I<from_path> | ||
is not given use the current filename. | ||
=cut | ||
HELP | ||
|
||
our $MIN_ABBREV = length('pa'); | ||
use constant MIN_ARGS => 1; | ||
use constant MAX_ARGS => 2; | ||
our $SHORT_HELP = 'Use PATH in place of a filename'; | ||
|
||
sub run($$) | ||
{ | ||
my ($self, $args) = @_; | ||
my ($from_path, $to_path); | ||
my $proc = $self->{proc}; | ||
if (scalar(@$args) == 5) { | ||
$from_path = $args->[3]; | ||
$to_path = $args->[4]; | ||
} else { | ||
$from_path = $proc->{frame}{file}; | ||
$to_path = $args->[3]; | ||
} | ||
# FIXME: Check from_path name to see if it is loaded | ||
if (-f $to_path) { | ||
remap_file($from_path, $to_path); | ||
} else { | ||
$proc->errmsg("File ${to_path} doesn't exist"); | ||
} | ||
} | ||
|
||
unless(caller) { | ||
# requre File::Basename; | ||
# Demo it. | ||
# my $name = basename(__FILE__, '.pm') | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters