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

i#5520: Add instruction encodings to offline drmemtraces #5662

Merged
merged 9 commits into from
Sep 29, 2022

Conversation

derekbruening
Copy link
Contributor

Adds a new trace_entry_t type TRACE_TYPE_ENCODING. Encodings are stored in one or more consecutive such entries by raw2trace for the first occurrence of each instruction or modified instruction, with encodings repeated in new chunks. The trace version is bumped for this new type.

Adds a new encoding field to the end of memref_instr_t. The reader_t class caches the trace_entry_t encodings and uses them to fill in this field. A new file type OFFLINE_FILE_TYPE_ENCODINGS indicates whether encodings are present (to support stripping them out).

Augments the opcode_mix and view tools to use the new encoding records and only need the module_mapper for legacy traces.

Updates the documentation and unit tests.

Still remaining is adding markers when code changes, joint with #2062.

Fixes #5520

Adds a new trace_entry_t type TRACE_TYPE_ENCODING.  Encodings are
stored in one or more consecutive such entries by raw2trace for the
first occurrence of each instruction or modified instruction, with
encodings repeated in new chunks.  The trace version is bumped for
this new type.

Adds a new encoding field to the end of memref_instr_t.  The reader_t
class caches the trace_entry_t encodings and uses them to fill in this
field.  A new file type OFFLINE_FILE_TYPE_ENCODINGS indicates whether
encodings are present (to support stripping them out).

Augments the opcode_mix and view tools to use the new encoding records
and only need the module_mapper for legacy traces.

Updates the documentation and unit tests.

Still remaining is adding markers when code changes, joint with #2062.

Fixes #5520
…tra encoding; fix another Windows build warning
clients/drcachesim/common/trace_entry.h Show resolved Hide resolved
clients/drcachesim/common/trace_entry.h Show resolved Hide resolved
clients/drcachesim/common/trace_entry.h Show resolved Hide resolved
clients/drcachesim/common/trace_entry.h Show resolved Hide resolved
clients/drcachesim/common/trace_entry.h Show resolved Hide resolved
clients/drcachesim/reader/reader.cpp Outdated Show resolved Hide resolved
clients/drcachesim/tools/opcode_mix.h Show resolved Hide resolved
clients/drcachesim/tools/opcode_mix.h Show resolved Hide resolved
clients/drcachesim/tracer/raw2trace.cpp Show resolved Hide resolved
clients/drcachesim/tracer/raw2trace.h Show resolved Hide resolved
clients/drcachesim/common/trace_entry.h Outdated Show resolved Hide resolved
@derekbruening
Copy link
Contributor Author

x64 failure is detach_state vmareas.c assert #5123

@derekbruening derekbruening merged commit 74ff44c into master Sep 29, 2022
@derekbruening derekbruening deleted the i5520-memref-encodings branch September 29, 2022 03:11
derekbruening added a commit that referenced this pull request Sep 30, 2022
Adds a new field to memref_instr_t: encoding_is_new.
This indicates whether the encoding bytes for an instruction
fetch are new, either due to changed application code or
just the start of a new chunk.  This lets tools know when to
invalidate any cached decoding information.

Updates the opcode_mix and view tools to use this to invalidate their
caches.

Adds a test of modified code to the tool.drcacheoff.gencode test.
Changes the test to use opcode_mix to test its cache invalidation.
Adds a new icache_sync() routine to tools.h for help modifying code
on AArchXX.

I verified that with the bug pointed out at
#5662 (comment)
the test catches the stale opcodes used by opcode_mix.

Issue: #5520
derekbruening added a commit that referenced this pull request Oct 3, 2022
Adds a new field to memref_instr_t: encoding_is_new.
This indicates whether the encoding bytes for an instruction
fetch are new, either due to changed application code or
just the start of a new chunk.  This lets tools know when to
invalidate any cached decoding information.

Updates the opcode_mix and view tools to use this to invalidate their
caches.

Adds a test of modified code to the tool.drcacheoff.gencode test.
Changes the test to use opcode_mix to test its cache invalidation.
Adds a new icache_sync() routine to tools.h for help modifying code
on AArchXX.

I verified that with the bug pointed out at
#5662 (comment)
the test catches the stale opcodes used by opcode_mix.

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

Successfully merging this pull request may close these issues.

Add instruction encoding entries to drmemtrace
2 participants