Skip to content

Commit

Permalink
i#2062 non-module offline: add workaround for vdso
Browse files Browse the repository at this point in the history
Adds a temporary workaround for vdso code where we just drop the ifetch
entries, to avoid a fatal error up front mapping modules.

Review-URL: https://codereview.appspot.com/307690043
  • Loading branch information
derekbruening committed Nov 9, 2016
1 parent b82601b commit 9ff87ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/drcachesim/tracer/instru_offline.cpp
Expand Up @@ -248,7 +248,7 @@ offline_instru_t::instrument_instr(void *drcontext, void *tag, void **bb_field,

pc = dr_fragment_app_pc(tag);
if (drmodtrack_lookup(drcontext, pc, &modidx, &modbase) != DRCOVLIB_SUCCESS) {
// FIXME i#1729: add non-module support. The plan for instrs is to have
// FIXME i#2062: add non-module support. The plan for instrs is to have
// one entry w/ the start abs pc, and subsequent entries that pack the instr
// length for 10 instrs, 4 bits each, into a pc.modoffs field. We will
// also need to store the type (read/write/prefetch*) and size for the
Expand Down
8 changes: 6 additions & 2 deletions clients/drcachesim/tracer/raw2trace.cpp
Expand Up @@ -118,7 +118,11 @@ raw2trace_t::read_and_map_modules(void)
if (drmodtrack_offline_lookup(modhandle, i, &modbase, &modsize, &path) !=
DRCOVLIB_SUCCESS)
FATAL_ERROR("Failed to query module file");
if (strcmp(path, "<unknown>") == 0) {
if (strcmp(path, "<unknown>") == 0 ||
// i#2062: VDSO is hard to decode so for now we treat is as non-module.
// FIXME: currently we're dropping the ifetch data: we need the tracer
// to identify it instead of us, which requires drmodtrack changes.
strcmp(path, "[vdso]") == 0) {
// We won't be able to decode.
modvec.push_back(module_t(path, modbase, NULL, 0));
} else {
Expand Down Expand Up @@ -297,7 +301,7 @@ raw2trace_t::append_bb_entries(uint tidx, offline_entry_t *in_entry)
app_pc pc, decode_pc = start_pc;
if ((in_entry->pc.modidx == 0 && in_entry->pc.modoffs == 0) ||
modvec[in_entry->pc.modidx].map_base == NULL) {
// FIXME i#1729: add support for code not in a module (vsyscall, JIT, etc.).
// FIXME i#2062: add support for code not in a module (vsyscall, JIT, etc.).
// Once that support is in we can remove the bool return value and handle
// the memrefs up here.
VPRINT(3, "Skipping ifetch for %u instrs not in a module\n", instr_count);
Expand Down

0 comments on commit 9ff87ae

Please sign in to comment.