in reply to Re^2: Analyze a C Call-Stack sequence trace and get call sequence from given Function name onwards.
in thread Analyze a C Call-Stack sequence trace and get call sequence from given Function name onwards.

Hello tobias_hofer,

I notice that in sub new, $self->{stack} is assigned [], a reference to an anonymous array; but in sub _AnalyzeTraceFile you have:

... my @stack = $self->{stack}; ($self->{stacktraces}{join('->',@{$self->{stack}})} = \@stack ) && ...

which treats $self->{stack} as an array, not a reference. I think you meant to write this:

... my @stack = @{ $self->{stack} }; ($self->{stacktraces}{ join('->', @{$self->{stack}}) } = \@stack) && ...

Incidentally, while looking at the code I found it useful to add another method to the CallStackAnalyzer package:

sub print { use Data::Dump; my $self = shift; dd $self; }

and to call it in sub Main:

... $CSA->TraceFile(\@tracecontent); $CSA->print; ...

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

  • Comment on Re^3: Analyze a C Call-Stack sequence trace and get call sequence from given Function name onwards.
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: Analyze a C Call-Stack sequence trace and get call sequence from given Function name onwards.
by tobias_hofer (Friar) on Aug 27, 2014 at 06:47 UTC
    oh.. yes :-D Thanks a lot!