DynamoRIO
|
#include <reader_base.h>

Public Member Functions | |
virtual bool | init ()=0 |
uint64_t | get_next_trace_pc () const override |
![]() | |
virtual | ~memtrace_stream_t () |
virtual uint64_t | get_record_ordinal () const =0 |
virtual uint64_t | get_instruction_ordinal () const =0 |
virtual std::string | get_stream_name () const =0 |
virtual uint64_t | get_last_timestamp () const =0 |
virtual uint64_t | get_first_timestamp () const =0 |
virtual uint64_t | get_version () const =0 |
virtual uint64_t | get_filetype () const =0 |
virtual uint64_t | get_cache_line_size () const =0 |
virtual uint64_t | get_chunk_instr_count () const =0 |
virtual uint64_t | get_page_size () const =0 |
virtual bool | is_record_synthetic () const |
virtual int | get_shard_index () const |
virtual int64_t | get_output_cpuid () const |
virtual int64_t | get_workload_id () const |
virtual int64_t | get_input_id () const |
virtual int64_t | get_tid () const |
virtual memtrace_stream_t * | get_input_interface () const |
virtual bool | is_record_kernel () const |
virtual double | get_schedule_statistic (schedule_statistic_t stat) const |
Protected Member Functions | |
trace_entry_t * | get_next_entry () |
bool | is_online () |
void | clear_entry_queue () |
void | queue_to_return_next (std::queue< trace_entry_t > &queue) |
void | queue_to_return_next (trace_entry_t &entry) |
Protected Attributes | |
bool | at_eof_ = true |
trace_entry_t | entry_copy_ |
uint64_t | next_trace_pc_ = 0 |
Private Member Functions | |
virtual trace_entry_t * | read_next_entry ()=0 |
Private Attributes | |
entry_queue_t | queue_ |
Detailed Description
Base class for dynamorio::drmemtrace:reader_t and dynamorio::drmemtrace::record_reader_t. This contains some interfaces and implementations that are shared between the two types of readers.
This base class is intended for logic close to reading the entries, and the reader interface common to the two types of readers; not so much for reader-specific logic for what to do with the entries.
This subclasses dynamorio::drmemtrace::memtrace_stream_t because all readers derived from it are expected to implement that interface, but it leaves the implementation of most of the stream APIs to each derived class.
XXX i#5727: Can we potentially move other logic or interface definitions here?
Member Function Documentation
◆ clear_entry_queue()
|
protected |
Clears all dynamorio::drmemtrace::trace_entry_t that are buffered in the dynamorio::drmemtrace::entry_queue_t, either for read-ahead or deliberately using dynamorio::drmemtrace::reader_base_t::queue_to_return_next().
◆ get_next_entry()
|
protected |
Returns the next entry for this reader.
If it returns nullptr, it will set the at_eof_ field to distinguish end-of-file from an error.
Also sets the next continuous pc in the trace at the next_trace_pc_ data member.
An invocation of this API may or may not cause an actual read from the underlying source using the derived class implementation of dynamorio::drmemtrace::reader_base_t::read_next_entry().
◆ get_next_trace_pc()
|
overridevirtual |
Returns the value of the next continuous PC in the trace after the current trace record. This PC is from the next instruction or the next TRACE_MARKER_TYPE_KERNEL_EVENT, whichever comes first.
This is not supported during online analysis, and for i-filtered traces. i-filtered traces have a zero-sized instr entry before memrefs, which is not presented to the tools. Reading ahead past them to provide the actual next trace pc complicates read-ahead logic especially for zipfile readers.
Reimplemented from dynamorio::drmemtrace::memtrace_stream_t.
◆ init()
|
pure virtual |
Initializes various state for the reader. E.g., subclasses should remember to set at_eof_ to false here. Also reads the first entry by invoking operator++() so that operator*() is ready to provide one after init().
May block for reading the first entry.
Implemented in dynamorio::drmemtrace::record_reader_t, dynamorio::drmemtrace::noise_generator_t, and dynamorio::drmemtrace::file_reader_t< T >.
◆ is_online()
|
protected |
Returns whether the reader is operating in the online mode, which involves reading trace entries from an IPC pipe, as opposed to reading them from a more persistent media like a file on a disk.
◆ queue_to_return_next() [1/2]
|
protected |
Adds the given entries to the dynamorio::drmemtrace::entry_queue_t to be returned from the next call to dynamorio::drmemtrace::reader_base_t::get_next_entry() in the same order as the provided queue.
If this routine (or its overload) is used another time, before all records from the prior invocation are passed on to the user, the records queued in the later call will be returned first.
◆ queue_to_return_next() [2/2]
|
protected |
Adds the given entry to the dynamorio::drmemtrace::entry_queue_t to be returned from the next call to dynamorio::drmemtrace::reader_base_t::get_next_entry().
If this routine (or its overload) is used another time, before all records from the prior invocation are passed on to the user, the records queued in the later call will be returned first.
◆ read_next_entry()
|
privatepure virtual |
This reads the next single entry from the underlying single stream of entries.
If it returns nullptr, it will set the EOF bit to distinguish end-of-file from an error.
This is used only by dynamorio::drmemtrace::reader_base_t::get_next_entry() when needed to access the underlying source of entries. Subclasses that need the next entry should use dynamorio::drmemtrace::reader_base_t::get_next_entry() instead.
Implemented in dynamorio::drmemtrace::record_file_reader_t< T >, dynamorio::drmemtrace::noise_generator_t, and dynamorio::drmemtrace::file_reader_t< T >.
Field Documentation
◆ at_eof_
|
protected |
Denotes whether the reader is at EOF.
This should be set to false by subclasses in init() and set back to true when actual EOF is hit.
Following typical stream iterator convention, the default constructor produces an EOF object.
◆ entry_copy_
|
protected |
Used to hold the memory corresponding to dynamorio::drmemtrace::trace_entry_t* returned by dynamorio::drmemtrace::reader_base_t::get_next_entry() and dynamorio::drmemtrace::reader_base_t::read_next_entry() in some cases.
◆ next_trace_pc_
|
protected |
Holds the next continuous pc in the trace, which may either be the pc of the next instruction or the value of the next TRACE_MARKER_TYPE_KERNEL_EVENT marker.
This is set to its proper value when the dynamorio::drmemtrace::reader_base_t::get_next_entry() API returns.
◆ queue_
|
private |
We store into this queue records already read from the input but not yet returned to the iterator. E.g., dynamorio::drmemtrace::reader_t needs to read ahead when skipping to include the post-instr records, and dynamorio::drmemtrace::reader_base_t may read-ahead records from the input source to discover the next continuous pc in the trace.
dynamorio::drmemtrace::reader_base_t::get_next_entry() automatically returns entries from this queue when it's non-empty.
The documentation for this class was generated from the following file:
- /home/runner/work/dynamorio/dynamorio/build_release-64/clients/include/drmemtrace/reader_base.h