Beispiel #1
0
std::string expected_str(IndexedMemoryRef imr) {
  std::ostringstream out;
  // See above about the rbp/r13 thing.
  if (imr.r.base == rbp || imr.r.base == r13 || imr.r.disp != 0) {
    expected_disp_str(imr.r.disp, out);
  }
  out << '(' << expected_str(imr.r.base)
      << ',' << expected_str(imr.r.index)
      << ',' << imr.r.scale
      << ')';
  return out.str();
}
Beispiel #2
0
std::string expected_str(MemoryRef mr) {
  std::ostringstream out;
  /*
   * Operations with "rbp-like" registers still are encoded with a
   * displacement byte, even if the displacement is zero.  This wouldn't
   * matter, but objdump displays the zero displacements for these
   * registers (presumably because of this), so we have to add it to our
   * expected string in that case.
   */
  if (mr.r.base == rbp || mr.r.base == r13 || mr.r.disp != 0) {
    expected_disp_str(mr.r.disp, out);
  }
  out << '(' << expected_str(mr.r.base) << ')';
  return out.str();
}
Beispiel #3
0
std::string expected_str(MemoryRef mr) {
  std::ostringstream out;
  if (mr.r.disp != 0) {
    expected_disp_str(mr.r.disp, out);
  }
  if (int(mr.r.index) != -1) {
    out << '(' << expected_str(mr.r.base)
        << ',' << expected_str(mr.r.index)
        << ',' << mr.r.scale
        << ')';
  } else {
    out << '(' << expected_str(mr.r.base) << ')';
  }
  return out.str();
}