[DynamoRIO]向Application中插入对Application的调用代码样例

· · 个人记录

全汇编模拟代码样例

笔者环境

Application

#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

class A {
public:
  virtual string getName() const {
    return "A::getName called";
  }
};

class B : public A {
public:
  B(const string& name)
    : name(name) {}

  string getName() const override {
    return "B::getName called: " + name;
  }

  static A* getInstance(string name) {
    static A* instance = new B(name);
    return instance;
  }

private:
  string name;
};

// 防止编译器优化代码
int testSumLength(const string& a, const string& b) {
  B do_not_opt("123");
  B::getInstance("do not opt this function");
  return a.size() + b.size();
}

int main() {
  // char x[] = "Single";
  // A* instance = B::getInstance(x);
  // instance->A::getName();
  // cout << "total length: " << testSumLength(instance->getName(), instance->A::getName()) << endl;
  cout << "main finished" << endl;
  return 0;
}

Client

#include "dr_api.h"
#include "drmgr.h"
#include "drsyms.h"
#include "drwrap.h"
#include "drreg.h"
#include <cstdio>
#include <cstring>
#include <cstdarg>
#include <string>
#include <sstream>
#include <iostream>
#include <stack>
#include <vector>
#include <unordered_map>
#include <algorithm>

using std::string;
using std::vector;
using std::unordered_map;

struct traced_function_info {
  string name;
  app_pc pc;
  app_pc start;
  app_pc end;
};

struct trace_module_info {
  string name;
  app_pc start;
  unordered_map<string, traced_function_info*> traced_function;
};

unordered_map<string, trace_module_info*> trace_module = {
  {
    "Application.out", {
      new trace_module_info {
        "Application.out", nullptr, {
          { "B::getInstance", new traced_function_info {"B::getInstance"} },
          { "_ZNK1B7getNameB5cxx11Ev", new traced_function_info {"B::getName"} },
          { "main", new traced_function_info {"main"} },
        }
      }
    }
  },
  {
    "libstdc++.so.6", {
      new trace_module_info {
        "libstdc++.so", nullptr, {
          { "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", 
            new traced_function_info {"std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)"} },
          { "_ZNSaIcEC1Ev", new traced_function_info {"_ZNSaIcEC1Ev"} }
        }
      }
    }
  }
};

static void 
func_pre_hook(void* wrapcxt, void** user_data) {
  dr_fprintf(STDERR, "pre hook function: [%s]\n", *(char**)user_data);
}

static void
func_post_hook(void* wrapcxt, void* user_data) {
  dr_fprintf(STDERR, "post hook function: [%s]\n", (char*)user_data);
  dr_fprintf(STDERR, "ret string: %s\n", ((string*)drwrap_get_retval(wrapcxt))->c_str());
}

static bool
enumerate_symbols(drsym_info_t *info, drsym_error_t status, void *data) {
  if (info->name == nullptr) return true;
  trace_module_info* curModule = (trace_module_info*)data;

  // mangle name
  auto iter = curModule->traced_function.find(info->name);
  // dr_fprintf(STDERR, "mangle name: %s\n", info->name);
  if (iter != curModule->traced_function.end()) {
    iter->second->pc = curModule->start + info->start_offs;
    iter->second->start = curModule->start + info->start_offs;
    iter->second->end = curModule->start + info->end_offs;
    return true;
  }

  // demangle name without template type
  char newName[200];
  drsym_demangle_symbol(newName, 200, info->name, DRSYM_DEMANGLE);
  iter = curModule->traced_function.find(newName);
  // dr_fprintf(STDERR, "demangle name: %s\n", newName);
  if (curModule->traced_function.find(newName) != curModule->traced_function.end()) {
    iter->second->pc = curModule->start + info->start_offs;
    iter->second->start = curModule->start + info->start_offs;
    iter->second->end = curModule->start + info->end_offs;
    return true;
  }

  // full demangle name
  drsym_demangle_symbol(newName, 200, info->name, DRSYM_DEMANGLE_FULL);
  iter = curModule->traced_function.find(newName);
  // dr_fprintf(STDERR, "full demangle name: %s\n", newName);
  if (curModule->traced_function.find(newName) != curModule->traced_function.end()) {
    iter->second->pc = curModule->start + info->start_offs;
    iter->second->start = curModule->start + info->start_offs;
    iter->second->end = curModule->start + info->end_offs;
    return true;
  }

  return true;
}

static void
module_load(void* drcontext, const module_data_t* info, bool loaded) {
  // dr_fprintf(STDERR, "file name: [%s] module name: [%s]\n", info->names.file_name, info->names.module_name ? info->names.module_name : "");

  trace_module_info* curModule = nullptr;
  if (info->names.module_name != nullptr && trace_module.find(info->names.module_name) != trace_module.end()) {
    curModule = trace_module.find(info->names.module_name)->second;
  } else if (info->names.file_name != nullptr && trace_module.find(info->names.file_name) != trace_module.end()) {
    curModule = trace_module.find(info->names.file_name)->second;
  }
  if (curModule == nullptr) {
    return;
  }
  // dr_fprintf(STDERR, "module name: [%s]\n", curModule->name.c_str());
  curModule->start = info->start;
  drsym_enumerate_symbols_ex(info->full_path, enumerate_symbols, sizeof(drsym_info_t), (void*)curModule, DRSYM_LEAVE_MANGLED);
  if (curModule->name == "Application.out") {
    if (curModule->traced_function["_ZNK1B7getNameB5cxx11Ev"]->pc) {
      drwrap_wrap_ex(curModule->traced_function["_ZNK1B7getNameB5cxx11Ev"]->pc, func_pre_hook, func_post_hook, (void*)curModule->traced_function["_ZNK1B7getNameB5cxx11Ev"]->name.c_str(), DRWRAP_FLAGS_NONE | DRWRAP_CALLCONV_AMD64);
    }
  }

  // DEBUG
  // if (curModule->name == "Application.out") {
  //   dr_fprintf(STDERR, "Application.out:\n");
  //   for (auto func : curModule->traced_function) {
  //     dr_fprintf(STDERR, "funcname: %s addr: %p\n", func.second->name.c_str(), func.second->pc);
  //   }
  // }
  // if (curModule->name == "libstdc++.so") {
  //   dr_fprintf(STDERR, "libstdc++.so.6:\n");
  //   for (auto func : curModule->traced_function) {
  //     dr_fprintf(STDERR, "funcname: %s addr: %p\n", func.second->name.c_str(), func.second->pc);
  //   }
  // }
}

static void
print_instrlist(void* drcontext, instrlist_t* bb) {
  for (auto instr = instrlist_first(bb); instr != nullptr; instr = instr_get_next(instr)) {
    dr_print_instr(drcontext, STDERR, instr, "");
  }
  dr_fprintf(STDERR, "\n");
}

static instr_t*
set_app_instr(instr_t* &instr, app_pc pc) {
  instr_set_app(instr);
  instr_set_translation(instr, pc);
  return instr;
}

static void
insert_instr_before_where(IN instrlist_t* bb, IN instr_t* where, IN instr_t* instr) {
  if (where == nullptr) {
    instrlist_append(bb, instr);
  } else {
    instrlist_preinsert(bb, where, instr);
  }
}

static void
insert_instr_after_where(IN instrlist_t* bb, IN instr_t* where, IN instr_t* instr) {
  if (where == nullptr) {
    instrlist_prepend(bb, instr);
  } else {
    instrlist_postinsert(bb, where, instr);
  }
}

static void 
save_all_register(IN void* drcontext, IN instrlist_t* bb, IN instr_t* where, IN app_pc pc) {
  instr_t* instr = nullptr;
#ifdef X86
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_RAX));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_RCX));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_RDX));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_RBX));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  // instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_RSP));
  // insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  // instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_RBP));
  // insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_RSI));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_RDI));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_R8));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_R9));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_R10));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_R11));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_R12));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_R13));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_R14));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_push(drcontext, opnd_create_reg(DR_REG_R15));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
#elif defined(AARCHXX)

#endif
}

static void 
reset_all_register(IN void* drcontext, IN instrlist_t* bb, IN instr_t* where, IN app_pc pc) {
  instr_t* instr = nullptr;
#ifdef X86
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_R15));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_R14));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_R13));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_R12));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_R11));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_R10));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_R9));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_R8));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_RDI));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_RSI));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  // instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_RBP));
  // insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  // instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_RSP));
  // insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_RBX));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_RDX));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_RCX));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
  instr = INSTR_CREATE_pop(drcontext, opnd_create_reg(DR_REG_RAX));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
#elif defined(AARCHXX)

#endif
}

static void 
clear_instr_from(IN void *drcontext, IN instrlist_t *bb, IN instr_t *where) {
  if (where == nullptr) {
    instrlist_clear(drcontext, bb);
  } else {
    for (auto del = instr_get_next(where); del != nullptr; del = instr_get_next(where)) {
      instrlist_remove(bb, del);
      instr_destroy(drcontext, del);
    }
  }
}

dr_emit_flags_t basic_block_app2app_callback(void *drcontext, void *tag, instrlist_t *bb, bool for_trace, bool translating) {
  static app_pc where_pc = nullptr;
  static app_pc next_pc = nullptr;
  static unsigned status = 0;
  instr_t *call = nullptr;

  if (status > 3) {
    return DR_EMIT_DEFAULT;
  }

  if (dr_fragment_app_pc(tag) == trace_module["Application.out"]->traced_function["main"]->pc) {

    instr_t *first = instrlist_first(bb);
    instr_t *where = instr_get_next(instr_get_next(first)); 
    where_pc = instr_get_app_pc(where);
    next_pc = instr_get_app_pc(instr_get_next(where));

    clear_instr_from(drcontext, bb, where);

    save_all_register(drcontext, bb, nullptr, where_pc);

    call = XINST_CREATE_sub(drcontext, opnd_create_reg(DR_REG_RSP), OPND_CREATE_INT32(200)); // subq $200, %rsp
    instrlist_append(bb, set_app_instr(call, where_pc));
    call = INSTR_CREATE_mov_st(drcontext, opnd_create_base_disp(DR_REG_RBP, DR_REG_NULL, 0, -200, OPSZ_4), OPND_CREATE_INT32(1735289171)); // movb %1735289171, -200(%rbp)
    instrlist_append(bb, set_app_instr(call, where_pc));
    call = INSTR_CREATE_mov_st(drcontext, opnd_create_base_disp(DR_REG_RBP, DR_REG_NULL, 0, -197, OPSZ_4), OPND_CREATE_INT32(6646887)); // movb %6646887, -117(%rbp)
    instrlist_append(bb, set_app_instr(call, where_pc));
    // call = INSTR_CREATE_lea(drcontext, opnd_create_reg(DR_REG_RDI), OPND_CREATE_MEM_lea(DR_REG_RBP, DR_REG_NULL, 0, -100)); // leaq -100(%rbp), %rdi
    // instrlist_append(bb, set_app_instr(call, where_pc));
    // call = INSTR_CREATE_call(drcontext, opnd_create_pc(trace_module["libstdc++.so.6"]->traced_function["_ZNSaIcEC1Ev"]->pc)); // call std::allocator<char>::allocator()
    // instrlist_append(bb, set_app_instr(call, where_pc));

    // print_instrlist(drcontext, bb);
    // dr_fprintf(STDERR, "\n");

    return DR_EMIT_STORE_TRANSLATIONS;
  } else if (dr_fragment_app_pc(tag) == next_pc) {

    // dr_fprintf(STDERR, "status: %d\n", status);

    if (status <= 2) {
      clear_instr_from(drcontext, bb, nullptr);
    }

    switch (status)
    {
    case 0:
      call = INSTR_CREATE_lea(drcontext, opnd_create_reg(DR_REG_RDX), OPND_CREATE_MEM_lea(DR_REG_RBP, DR_REG_NULL, 0, -100)); // leaq -100(%rbp), %rdx
      instrlist_append(bb, set_app_instr(call, where_pc));
      call = INSTR_CREATE_lea(drcontext, opnd_create_reg(DR_REG_RSI), OPND_CREATE_MEM_lea(DR_REG_RBP, DR_REG_NULL, 0, -200)); // leaq -200(%rbp), %rsi
      instrlist_append(bb, set_app_instr(call, where_pc));
      call = INSTR_CREATE_lea(drcontext, opnd_create_reg(DR_REG_RDI), OPND_CREATE_MEM_lea(DR_REG_RBP, DR_REG_NULL, 0, -170)); // leaq -170(%rbp), %rdi
      instrlist_append(bb, set_app_instr(call, where_pc));
      call = INSTR_CREATE_call(drcontext, opnd_create_pc(trace_module["libstdc++.so.6"]->
        traced_function["std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)"]->pc)); // call ...
      instrlist_append(bb, set_app_instr(call, where_pc));
      ++status;
      break;
    case 1:
      call = INSTR_CREATE_lea(drcontext, opnd_create_reg(DR_REG_RDI), OPND_CREATE_MEM_lea(DR_REG_RBP, DR_REG_NULL, 0, -170)); // leaq -170(%rbp), %rdi
      instrlist_append(bb, set_app_instr(call, where_pc));
      call = INSTR_CREATE_call(drcontext, opnd_create_pc(trace_module["Application.out"]->traced_function["B::getInstance"]->pc)); // call B::getInstance()
      instrlist_append(bb, set_app_instr(call, where_pc));
      ++status;
      break;
    case 2:
      call = INSTR_CREATE_lea(drcontext, opnd_create_reg(DR_REG_RDI), OPND_CREATE_MEM_lea(DR_REG_RBP, DR_REG_NULL, 0, -64)); // leaq -64(%rbp), %rdi
      instrlist_append(bb, set_app_instr(call, where_pc));
      call = XINST_CREATE_move(drcontext, opnd_create_reg(DR_REG_RSI), opnd_create_reg(DR_REG_RAX)); // movb %rax, %rsi
      instrlist_append(bb, set_app_instr(call, where_pc));
      call = INSTR_CREATE_call(drcontext, opnd_create_pc(trace_module["Application.out"]->traced_function["_ZNK1B7getNameB5cxx11Ev"]->pc)); // call B::getName()
      instrlist_append(bb, set_app_instr(call, where_pc));
      ++status;
      break;
    case 3:
      where_pc = instr_get_app_pc(instrlist_first(bb));
      next_pc = nullptr;

      reset_all_register(drcontext, bb, instrlist_first(bb), where_pc);

      call = XINST_CREATE_add(drcontext, opnd_create_reg(DR_REG_RSP), OPND_CREATE_INT64(200)); // addq $200, %rsp
      instrlist_prepend(bb, set_app_instr(call, where_pc));

      ++status;
      break;
    }

    // print_instrlist(drcontext, bb);
    // dr_fprintf(STDERR, "\n");

    return DR_EMIT_STORE_TRANSLATIONS;
  }

  return DR_EMIT_DEFAULT;
}

DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
  drsym_init(0);
  drmgr_init();
  drwrap_init();

  drmgr_register_bb_app2app_event(basic_block_app2app_callback, nullptr);
  drmgr_register_module_load_event(module_load);
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)

project(DynamoRIO_Linux_Demo)

add_library(DynamoRIO_Linux_Demo SHARED "client.cpp")

find_package(DynamoRIO)
configure_DynamoRIO_client(DynamoRIO_Linux_Demo)

use_DynamoRIO_extension(DynamoRIO_Linux_Demo drmgr)
use_DynamoRIO_extension(DynamoRIO_Linux_Demo drx)
use_DynamoRIO_extension(DynamoRIO_Linux_Demo drsyms)
use_DynamoRIO_extension(DynamoRIO_Linux_Demo drwrap)
use_DynamoRIO_extension(DynamoRIO_Linux_Demo drreg)
use_DynamoRIO_extension(DynamoRIO_Linux_Demo droption)

仅插入调用相关汇编样例

笔者环境

代码

static reg_id_t 
get_pass_param_reg(IN int index) {
  switch (index) {
  case 1:
    return DR_REG_RDI;
  case 2:
    return DR_REG_RDI;
  case 3:
    return DR_REG_RDI;
  case 4:
    return DR_REG_RDI;
  case 5:
    return DR_REG_RDI;
  case 6:
    return DR_REG_RDI;
  default:
    return DR_REG_INVALID;
  }
}

static void
pass_param(IN void *drcontext, IN instrlist_t *bb, IN instr_t *where, IN app_pc pc, IN int index, IN void *param) {
# ifdef X86
  instr_t* instr;
# ifdef X64
  if (index <= 6) {
    instr = INSTR_CREATE_mov_imm(drcontext, opnd_create_reg(get_pass_param_reg(index)), OPND_CREATE_INTPTR(param));
    insert_instr_before_where(bb, where, set_app_instr(instr, pc));
    return;
  }
# endif
  instr = INSTR_CREATE_push_imm(drcontext, OPND_CREATE_INT32(param));
  insert_instr_before_where(bb, where, set_app_instr(instr, pc));
# endif
}

static void
insert_application_function_call(IN void *drcontext, IN instrlist_t *bb, IN instr_t *where, IN app_pc instr_pc, IN app_pc insert_function, IN int param_count IN...) {
  save_all_register(drcontext, bb, where, instr_pc);
  va_list args;
  va_start(args, param_count);
  for (int i = 1; i <= param_count; ++i) {
    void* arg = va_arg(args, void*);
    pass_param(drcontext, bb, where, instr_pc, i, arg);
  }
  va_end(args);
  instr_t* instr = XINST_CREATE_call(drcontext, opnd_create_pc(insert_function));
  insert_instr_before_where(bb, where, set_app_instr(instr, instr_pc));
}

string instanceString("Single");

dr_emit_flags_t basic_block_app2app_callback(void *drcontext, void *tag, instrlist_t *bb, bool for_trace, bool translating) {
  static app_pc where_pc = nullptr;
  static app_pc next_pc = nullptr;
  static unsigned status = 0;
  instr_t *call = nullptr;

  if (status > 3) {
    return DR_EMIT_DEFAULT;
  }

  if (dr_fragment_app_pc(tag) == trace_module["Application.out"]->traced_function["main"]->pc) {

    instr_t *first = instrlist_first(bb);
    instr_t *where = instr_get_next(instr_get_next(first)); 
    where_pc = instr_get_app_pc(where);
    next_pc = instr_get_app_pc(instr_get_next(where));

    clear_instr_from(drcontext, bb, where);

    insert_application_function_call(drcontext, bb, nullptr, where_pc, trace_module["Application.out"]->traced_function["B::getInstance"]->pc, 1, &instanceString);

    return DR_EMIT_STORE_TRANSLATIONS;
  } else if (dr_fragment_app_pc(tag) == next_pc) {

    // dr_fprintf(STDERR, "status: %d\n", status);
    switch (status)
    {
    case 0:
      clear_instr_from(drcontext, bb, nullptr);
      call = XINST_CREATE_move(drcontext, opnd_create_reg(DR_REG_RSI), opnd_create_reg(DR_REG_RAX));
      instrlist_append(bb, set_app_instr(call, where_pc));
      call = INSTR_CREATE_call(drcontext, opnd_create_pc(trace_module["Application.out"]->traced_function["_ZNK1B7getNameB5cxx11Ev"]->pc));
      instrlist_append(bb, set_app_instr(call, where_pc));
      ++status;
      break;
    case 1:
      reset_all_register(drcontext, bb, instrlist_first(bb), next_pc);
      next_pc = nullptr;
      ++status;
    }

    // print_instrlist(drcontext, bb);
    // dr_fprintf(STDERR, "\n");

    return DR_EMIT_STORE_TRANSLATIONS;
  }

  return DR_EMIT_DEFAULT;
}