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#7113 instr decode cache: move module mapper into raw2trace_shared #7123

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions clients/drcachesim/tracer/instru.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,14 @@
#include "dr_allocator.h"
#include "dr_api.h"
#include "drvector.h"
#include "raw2trace_shared.h"
#include "trace_entry.h"

namespace dynamorio {
namespace drmemtrace {

#define MINSERT instrlist_meta_preinsert

// Versioning for our drmodtrack custom module fields.
#define CUSTOM_MODULE_VERSION 1

// A std::unordered_set, even using dr_allocator_t, raises transparency risks when
// statically linked on Windows (from lock functions and other non-allocator
// resources). We thus create our own resource-isolated class to track GPR register
Expand Down Expand Up @@ -499,11 +497,6 @@ class offline_instru_t : public instru_t {
label_marks_elidable(instr_t *instr, DR_PARAM_OUT int *opnd_index,
DR_PARAM_OUT int *memopnd_index, DR_PARAM_OUT bool *is_write,
DR_PARAM_OUT bool *needs_base);
static int
print_module_data_fields(char *dst, size_t max_len, const void *custom_data,
size_t custom_size,
int (*user_print_cb)(void *data, char *dst, size_t max_len),
void *user_cb_data);

private:
struct custom_module_data_t {
Expand Down
26 changes: 1 addition & 25 deletions clients/drcachesim/tracer/instru_offline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "drreg.h"
#include "drutil.h"
#include "drvector.h"
#include "raw2trace_shared.h"
#include "trace_entry.h"
#include "utils.h"
#include "instru.h"
Expand Down Expand Up @@ -186,31 +187,6 @@ offline_instru_t::load_custom_module_data(module_data_t *module, int seg_idx)
return nullptr;
}

int
offline_instru_t::print_module_data_fields(
char *dst, size_t max_len, const void *custom_data, size_t custom_size,
int (*user_print_cb)(void *data, char *dst, size_t max_len), void *user_cb_data)
{
char *cur = dst;
int len = dr_snprintf(dst, max_len, "v#%d,%zu,", CUSTOM_MODULE_VERSION, custom_size);
if (len < 0)
return -1;
cur += len;
if (cur - dst + custom_size > max_len)
return -1;
if (custom_size > 0) {
memcpy(cur, custom_data, custom_size);
cur += custom_size;
}
if (user_print_cb != nullptr) {
int res = (*user_print_cb)(user_cb_data, cur, max_len - (cur - dst));
if (res == -1)
return -1;
cur += res;
}
return (int)(cur - dst);
}

int
offline_instru_t::print_custom_module_data(void *data, char *dst, size_t max_len)
{
Expand Down
Loading
Loading