Skip to content

Commit

Permalink
allowing unknown functions
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzcpan committed Oct 29, 2011
1 parent 916b1d1 commit d9dc4e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README
Expand Up @@ -69,6 +69,8 @@ OPTIONS
-f PATTERN
print calls if filename matches pattern

-u show addresses of unknown functions

EXAMPLES
Show all calls within src/http and src/event modules:

Expand Down
16 changes: 10 additions & 6 deletions tracerx.pl
Expand Up @@ -11,10 +11,8 @@

$| = 1;

my $show_line = 0;
my $file_filter = '';
my $func_filter = '';
my $func_ignore = '';
my $ignore_unknown = 1;
my ($show_line, $file_filter, $func_filter, $func_ignore);

while ($ARGV[0] =~ /^-/) {
local $_ = shift;
Expand All @@ -23,6 +21,8 @@
pod2usage(0);
} elsif (/^-l/) {
$show_line = 1;
} elsif (/^-u/) {
$ignore_unknown = 0;
} elsif (/^-f/) {
$file_filter = shift;
} elsif (/^-s/) {
Expand Down Expand Up @@ -83,15 +83,15 @@
\s+
( [0-9]+ ) /x or print && next;

next unless $SYM{ hex($addr) }->{name}; # ignoring unknown functions
next if $ignore_unknown && !$SYM{ hex($addr) }->{name};

$prevtime = $curtime;
$curtime = $sec + $usec/1000000;

if ($action eq 'enter') {
$indent .= ' ';

my $buf = $indent. $SYM{ hex($addr) }->{name};
my $buf = $indent . ( $SYM{ hex($addr) }->{name} || "0x$addr" );

if ($show_line) {
$buf = sprintf("+%010.6fs ", $curtime - $prevtime) . $buf;
Expand Down Expand Up @@ -197,6 +197,10 @@ =head1 OPTIONS
print calls if filename matches pattern
=item B<-u>
show addresses of unknown functions
=back
=head1 EXAMPLES
Expand Down

0 comments on commit d9dc4e1

Please sign in to comment.