Callstack filters are filters operating over allocation properties that are sequences of strings (potentially with some other data). Currently, this means allocation callstacks, where the strings are file names with line/column information.
A string filter can have three shapes: an actual string value, a regex, or a match anything /
wildcard filter represented by the string
"...". This wildcard filter is discussed in its own
A string value is simply given as a value. To match precisely the string
"file_name", one only
needs to write
file_name. So, a filter that matches precisely the list of strings
[ "file_name_1", "file_name_2" ] will be written
A regex on the other hand has to be written between
"#. If we want the same filter as
above, but want to relax the first string description to be
<i> is a single
digit, we write the filter as
The wildcard filter, written
..., lazily (in general, see below) matches a repetition of any
string-like element of the list. To break this definition down, let us separate two cases: the first
one is when
... is not followed by another string-like filter, and second one is when it is
followed by another filter.
In the first case,
... simply matches everything. Consider for instance the filter
This filter matches any list of strings that starts with a string accepted by the first regex filter. The following lists of strings are all accepted by the filter above.
Now, there is one case when
... is not actually lazy: when the
n string-filters after it are
.... In this case, all elements of the list but the
n last ones will be skipped, leaving them for the
n last string filters.
For this reason
does work as expected. For example, on the string list
[ "some_file_name" "file_name_7" "another_file_name" "file_name_0" ]
a lazy behavior would not match. First,
... would match anything up to and excluding a string
... would match
some_file_name, but that's it since
file_name_7 is a match for
#"file_name_[0-9]"#. Hence the filter would reject this list of
strings, because there should be nothing left after the match for
#"file_name_[0-9]"#. But there
Instead, the filter works as expected.
... discards all elements but the last one
which is accepted by
Allocation callstack information is a list of tuples containing:
- the name of the file,
- the line in the file,
- a column range.
Currently, the range information is ignored. The line in the file is not, and one can specify a line constraint while writing a callstack filter. The normal syntax is
Now, a line filter has two basic shapes
<number>: an actual value.
It can also be a range:
[<basic-line-filter>, <basic-line-filter>]: a potentially open range.
|matches any line at all|
|matches line 7|
|matches any line between |
|matches any line greater than |
|matches any line less than |
|same as |
Whitespaces are inserted for readability but are not needed:
|matches any line of |
|matches line 107 of any |