File Coverage

blib/lib/Parse/StackTrace/Frame.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package Parse::StackTrace::Frame;
2 1     1   1761 use Moose;
  0            
  0            
3              
4             has 'function' => (is => 'ro', isa => 'Str', required => 1);
5             has 'args' => (is => 'ro', isa => 'Str');
6             has 'number' => (is => 'ro', isa => 'Int');
7             has 'file' => (is => 'ro', isa => 'Str');
8             has 'line' => (is => 'ro', isa => 'Int');
9             has 'code' => (is => 'ro', isa => 'Str');
10             has 'is_crash' => (is => 'ro', isa => 'Bool');
11              
12             __PACKAGE__->meta->make_immutable;
13              
14             1;
15              
16             __END__
17              
18             =head1 NAME
19              
20             Parse::StackTrace::Frame - A single frame (containing a single function)
21             from a stack trace.
22              
23             =head1 SYNOPSIS
24              
25             my $frame = $thread->frame_number(0);
26            
27             my $function = $frame->function;
28             my $arguments = $frame->args;
29             my $number = $frame->number;
30             my $file_name = $frame->file;
31             my $file_line = $frame->line;
32              
33             =head1 DESCRIPTION
34              
35             Represents a single frame in a stack trace. A frame represents a single
36             function call in a stack trace. A frame can also contains other
37             information, like what arguments were passed to the function, or what
38             code file the frame's function is in.
39              
40             Usually you get a frame by accessing L<Parse::StackTrace::Thread/frames>
41             or calling L<Parse::StackTrace::Thread/frame_number>, or using one
42             of the other methods in L<Parse::StackTrace::Thread> that returns a frame.
43              
44             =head1 ACCESSORS
45              
46             These are methods that take no arguments and just return information.
47              
48             Only L</function> will always have a value. The other attributes are
49             all optional and may return C<undef> if they have not been specified.
50              
51             =head2 C<function>
52              
53             The name of the function that was called in this trace. We return it just
54             as its written in the stack trace, so we can't guarantee anything about
55             the format.
56              
57             =head2 C<args>
58              
59             A string representing the arguments that were passed to the function.
60              
61             =head2 C<number>
62              
63             What number frame this was in the stack trace.
64              
65             =head2 C<file>
66              
67             The name of the file that the code of this function lives in. (This
68             will be the source file, not the binary file, for languages that
69             differentiate between those two things.) This may be the full path
70             to the file, or just the file name.
71              
72             =head2 C<line>
73              
74             The line number in L</file> where this function was called.
75              
76             =head2 C<code>
77              
78             The actual code on L<that line|/line> of L<that file|/file>.
79              
80             =head2 C<is_crash>
81              
82             True if this is the frame where we crashed. For example, in a GDB trace,
83             C<is_crash> true if this is the frame where the signal handler was called.
84              
85             =head1 SEE ALSO
86              
87             You may also want to read the documentation for the specific
88             implementations of Frame for the various types of stack traces that
89             we parse, because they might have more methods that aren't available
90             in the generic Frame:
91              
92             =over
93              
94             =item L<Parse::StackTrace::Type::GDB::Frame>
95              
96             =item L<Parse::StackTrace::Type::Python::Frame>
97              
98             =back