Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add library to cache decode instr info in analysis tools #7113

Open
abhinav92003 opened this issue Dec 9, 2024 · 0 comments
Open

Add library to cache decode instr info in analysis tools #7113

abhinav92003 opened this issue Dec 9, 2024 · 0 comments
Assignees

Comments

@abhinav92003
Copy link
Contributor

Various analyzers require decoding instr encodings, e.g. opcode_mix and invariant_checker. Some want to remember the full decoded instr_t, whereas others want to record only specific information about the decoded instr. It would be nice to have a shared library to obviate the need for new analysis tools to re-implement the logic.

@abhinav92003 abhinav92003 self-assigned this Dec 9, 2024
abhinav92003 added a commit that referenced this issue Dec 9, 2024
Adds a new library to cache information about decoded instructions. This can be
used by analysis tools that need to decode the instr encodings in the trace.

The library allows the tools to specify what information they need to cache.

Refactors the invariant checker tool to use this library.

Issue: #7113
abhinav92003 added a commit that referenced this issue Dec 11, 2024
Moves the module mapper and related functionality into raw2trace_shared. This is in preparation
for further changes that include the module mapper logic in a new instr_decode_cache_t. To avoid
having to pull in the whole drmemtrace_raw2trace implementation into the instr decode cache
library, which will end up including it in the invariant checker and everything that depends on,
we separate out the module mapper into raw2trace_shared which is intended for such cases.

Issue: #7113
abhinav92003 added a commit that referenced this issue Dec 11, 2024
This is in preparation for further changes that include the module mapper logic in a new library (drmemtrace_instr_decode_cache) that provides an instr decode cache (instr_decode_cache_t). To avoid having to pull in the whole drmemtrace_raw2trace implementation into drmemtrace_instr_decode_cache, which will end up including it in the invariant checker and everything that depends on, we separate out the module mapper into raw2trace_shared which is intended for such cases.

Issue: #7113
abhinav92003 added a commit that referenced this issue Dec 12, 2024
…7123)

Moves the module mapper and related functionality into raw2trace_shared.

This is in preparation for further changes that include the module
mapper logic in a new library (drmemtrace_instr_decode_cache) that
provides an instr decode cache (instr_decode_cache_t). To avoid having
to pull in the whole drmemtrace_raw2trace implementation into
drmemtrace_instr_decode_cache, which will end up including it in the
invariant checker and everything that depends on, we separate out the
module mapper into raw2trace_shared which is intended for such cases.

This is a pure code move, no changes were made to logic or style.

Issue: #7113
abhinav92003 added a commit that referenced this issue Dec 15, 2024
Moves the module read functionality into raw2trace_shared.

Refactors opcode_mix and view to use the new function instead of
creating a raw2trace_directory_t.

This is in preparation for further changes that include the module read
logic in a new library (drmemtrace_decode_cache) that provides an instr
decode cache (decode_cache_t). To avoid having to pull in the whole
drmemtrace_raw2trace implementation into drmemtrace_decode_cache, which
will end up including it in the invariant checker and everything that
depends on, we separate out the module read logic into raw2trace_shared
which is intended for such cases.

While the raw2trace and raw2trace_shared implementation usually is made
to deal with only file streams, we make an exception here for
read_module_file() which uses DR file APIs instead. This is likely fine
because this function is not intended for use with code that wants file
streams, and it is better than other alternatives: moving
raw2trace-using functionality out of raw2trace_directory_t so we can use
raw2trace_directory_t in decode_cache_t (this would still add zlib/lz4
etc unnecessary file libs to drmemtrace_decode_cache), create yet
another raw2trace_shared_non_stream.cpp for shared code that uses DR
file APIs, or duplicating the read_module_file impl in decode_cache_t.

This also removes raw2trace_directory_t::initialize_module_file() as
that functionality is now provided by read_module_file in
raw2trace_shared.


Issue: #7113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant