Ejemplo n.º 1
0
static void addBreakPointsInFile(Eval::DebuggerProxy* proxy,
                                 Eval::PhpFile* efile) {
  Eval::BreakPointInfoPtrVec bps;
  proxy->getBreakPoints(bps);
  for(unsigned int i = 0; i < bps.size(); i++) {
    Eval::BreakPointInfoPtr bp = bps[i];
    if (bp->m_line1 == 0 || bp->m_file.empty()) {
      // invalid breakpoint for file:line
      continue;
    }
    if (!Eval::BreakPointInfo::MatchFile(bp->m_file, efile->getFileName(),
                                         efile->getRelPath())) {
      continue;
    }
    Unit* unit = efile->unit();
    OffsetRangeVec offsets;
    if (!unit->getOffsetRanges(bp->m_line1, offsets)) {
      continue;
    }
    TRACE(3, "Add to breakpoint filter for %s:%d, unit %p:\n",
          efile->getFileName().c_str(), bp->m_line1, unit);
    getBreakPointFilter()->addRanges(unit, offsets);
    if (RuntimeOption::EvalJit) {
      blacklistRangesInJit(unit, offsets);
    }
  }
}
Ejemplo n.º 2
0
static void addBreakPointFuncEntry(const Func* f) {
  PC pc = f->unit()->at(f->base());
  TRACE(5, "func() break %s : unit %p offset %d)\n",
        f->fullName()->data(), f->unit(), f->base());
  getBreakPointFilter()->addPC(pc);
  if (RuntimeOption::EvalJit) {
    if (transl()->addDbgBLPC(pc)) {
      // if a new entry is added in blacklist
      if (!transl()->addDbgGuard(f, f->base())) {
        Logger::Warning("Failed to set breakpoints in Jitted code");
      }
    }
  }
}
Ejemplo n.º 3
0
// Looks up the offset range in the given unit, of the given breakpoint.
// If the offset cannot be found, the breakpoint is marked as invalid.
// Otherwise it is marked as valid and the offset is added to the
// breakpoint filter and the offset range is black listed for the JIT.
static void addBreakPointInUnit(Eval::BreakPointInfoPtr bp, Unit* unit) {
  OffsetRangeVec offsets;
  if (!unit->getOffsetRanges(bp->m_line1, offsets) || offsets.size() == 0) {
    bp->m_bindState = Eval::BreakPointInfo::KnownToBeInvalid;
    return;
  }
  bp->m_bindState = Eval::BreakPointInfo::KnownToBeValid;
  TRACE(3, "Add to breakpoint filter for %s:%d, unit %p:\n",
      unit->filepath()->data(), bp->m_line1, unit);
  getBreakPointFilter()->addRanges(unit, offsets);
  if (RuntimeOption::EvalJit) {
    blacklistRangesInJit(unit, offsets);
  }
}
Ejemplo n.º 4
0
void phpAddBreakPoint(const Unit* unit, Offset offset) {
  PC pc = unit->at(offset);
  getBreakPointFilter()->addPC(pc);
  if (RuntimeOption::EvalJit) {
    if (transl()->addDbgBLPC(pc)) {
      // if a new entry is added in blacklist
      if (!transl()->addDbgGuards(unit)) {
        Logger::Warning("Failed to set breakpoints in Jitted code");
      }
      // In this case, we may be setting a breakpoint in a tracelet which could
      // already be jitted, and present on the stack. Make sure we don't return
      // to it so we have a chance to honor breakpoints.
      g_vmContext->preventReturnsToTC();
    }
  }
}
Ejemplo n.º 5
0
static void addBreakPointFuncEntry(const Func* f) {
  // we are in a generator, skip CreateCont / RetC / PopC opcodes
  auto base = f->isGenerator()
    ? (f->isAsync() ? bad_value<Offset>() : c_Generator::userBase(f))
    : f->base();
  auto pc = f->unit()->at(base);

  TRACE(5, "func() break %s : unit %p offset %d ==> pc %p)\n",
        f->fullName()->data(), f->unit(), base, pc);
  getBreakPointFilter()->addPC(pc);
  if (RuntimeOption::EvalJit) {
    if (tx->addDbgBLPC(pc)) {
      // if a new entry is added in blacklist
      if (!mcg->addDbgGuard(f, base, false)) {
        Logger::Warning("Failed to set breakpoints in Jitted code");
      }
    }
  }
}