DynamoRIO / DynamoRIO/dynamorio
[drmemtrace] Support single-window-traces in trim_filter
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
Currently `trim_filter` in `record_filter` does not allow trimming of window-traces (i.e., traces with `TRACE_MARKER_TYPE_WINDOW_ID` markers: https://github.com/DynamoRIO/dynamorio/blob/master/clients/drcachesim/tools/filter/trim_filter.h#L100).
Since `trim_filter` only allows trimming the beginning or end of a trace (and nothing in between), trimming a single-window-trace is not a problem.
However, we do need to keep the initial `TRACE_MARKER_TYPE_WINDOW_ID` marker just before the region we want to preserve in order to have the beginning of the trace still starting with the window marker like the original trace.
Trimming multiple-window-traces is problematic because we cannot make any assumptions on the order of `TRACE_MARKER_TYPE_TIMESTAMP` and `TRACE_MARKER_TYPE_WINDOW_ID`, which can cause having the wrong window ID just before the portion of the trace we want to keep.
To support multiple windows in the same trace we can either live with an imprecise initial window ID, or we need a mechanism to add records (i.e., in this case: the last seen window ID record before the trace region we want to keep) in `record_filter` (note: we cannot leverage `write_trace_entry()` because `trim_filter` does not remove the header records).
Contributor guide
Assessment
This issue has not been assessed yet.