[padb-devel] [padb] r206 committed - Move the code to strip stack traces (remove functions above main) from...
codesite-noreply at google.com
codesite-noreply at google.com
Mon Sep 7 22:58:14 BST 2009
Revision: 206
Author: apittman
Date: Mon Sep 7 14:57:54 2009
Log: Move the code to strip stack traces (remove functions above main) from
the outer
process to the node-agent, this should both help performance (code run on
the nodes is
run in parallel, in the outer process is serial) and is a necessairy
per-curser to
output reduction in the network.
http://code.google.com/p/padb/source/detail?r=206
Modified:
/branches/cleanup/src/padb
=======================================
--- /branches/cleanup/src/padb Mon Sep 7 14:11:38 2009
+++ /branches/cleanup/src/padb Mon Sep 7 14:57:54 2009
@@ -2826,6 +2826,8 @@
#
###############################################################################
+# This function isn't called but I've kept it for now in case it becomes
+# needed when dealing with files.
sub strip_stack_traces {
my ( $cargs, $lines ) = @_;
@@ -3133,11 +3135,12 @@
my $lines = $d->{target_output};
my $mode = $req->{mode};
- if ( $mode eq 'stack' or $input_file ) {
- if ( $cargs->{strip_below_main} or $cargs->{strip_above_wait} ) {
- strip_stack_traces( $cargs, $lines );
- }
- }
+ # This is done internally by the node-agent now.
+ #if ( $mode eq 'stack' or $input_file ) {
+ # if ( $cargs->{strip_below_main} or $cargs->{strip_above_wait} ) {
+ # strip_stack_traces( $cargs, $lines );
+ # }
+ #}
if ( defined $req->{out_format} ) {
complex_output_handler( $req->{out_format}, $lines );
@@ -6187,6 +6190,17 @@
my ( $carg, $list ) = @_;
my @all;
+
+ my %above;
+ my %below;
+
+ if ( $carg->{strip_above_wait} ) {
+ map { $above{$_} = 1 } split qr{,}, $carg->{stack_strip_above};
+ }
+
+ if ( $carg->{strip_below_main} ) {
+ map { $below{$_} = 1 } split qr{,}, $carg->{stack_strip_below};
+ }
foreach my $proc ( @{$list} ) {
my $vp = $proc->{vp};
@@ -6265,12 +6279,13 @@
and ( $tries < $carg->{gdb_retry_count} ) );
if ( not defined $threads[0]{id} ) {
- output( $vp, 'Could not extract stack trace from application'
);
+ target_error( $vp,
+ 'Could not extract stack trace from application' );
return;
}
if ( defined $threads[0]{error} ) {
- output( $vp, $threads[0]{error} );
+ target_error( $vp, $threads[0]{error} );
return;
}
@@ -6279,21 +6294,43 @@
my @frames = @{ $thread->{frames} };
output( $vp, "ThreadId: $thread->{id}" ) if ( $#threads != 0 );
+
+ my $strip_below;
+
+ # Find a funtion to strip above. Only actually enable
+ # this if there is a function present which we are targeting
+ # or else no output will be generated!
+ if ( $carg->{strip_below_main} ) {
+ foreach my $frame (@frames) {
+ next unless exists $frame->{func};
+ if ( defined $below{ $frame->{func} } ) {
+ $strip_below = $frame->{func};
+ }
+ }
+ }
for ( my $i = $#frames ; $i >= 0 ; $i-- ) {
my $frame = $frames[$i];
- output( $vp, "ERROR: $$frame{error}" )
- if exists $$frame{error};
-
- next unless exists $$frame{level};
- next unless exists $$frame{func};
+ target_error( $vp, "error from gdb: $frame->{error}" )
+ if exists $frame->{error};
+
+ next unless exists $frame->{level};
+ next unless exists $frame->{func};
+
+ # This seemingly always gets set by gdb even if it is
+ # sometimes set to '??'
+ my $function = $frame->{func};
+
+ next if ( defined $strip_below and $strip_below ne
$function );
+
+ $strip_below = undef;
output( $vp,
- ( $$frame{func} || '?' )
+ $function
. '() at '
- . ( $$frame{file} || '?' ) . ':'
- . ( $$frame{line} || '?' ) );
+ . ( $frame->{file} || '?' ) . ':'
+ . ( $frame->{line} || '?' ) );
if ( $carg->{stack_shows_params} ) {
show_stack_vars( $vp, $frame, 'params' );
}
@@ -6301,6 +6338,10 @@
show_stack_vars( $vp, $frame, 'locals' );
}
+ # Strip below this function if we need to.
+ if ( defined $above{$function} ) {
+ last;
+ }
}
}
}
More information about the padb-devel
mailing list