Skip to content

Commit bbba234

Browse files
ebluesteinfredemmott
authored andcommitted
HHVM Debugger: Fix conditional breakpoints not working correctly
Summary: The breakpoints were being erroneously removed from the VM after the first time the condition evaluated to false. Reviewed By: Goom11 Differential Revision: D9039623 fbshipit-source-id: ac806bbaa00f0baadbf190908c8db4e94c06258e
1 parent a8fd6b8 commit bbba234

1 file changed

Lines changed: 14 additions & 30 deletions

File tree

hphp/runtime/ext/vsdebug/debugger.cpp

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,6 @@ void Debugger::onBreakpointHit(
16811681
int line
16821682
) {
16831683
std::string stopReason;
1684-
int matchingBpId = -1;
16851684
const std::string filePath = getFilePathForUnit(compilationUnit);
16861685

16871686
if (prepareToPauseTarget(ri) != PrepareToPauseResult::ReadyToPause) {
@@ -1713,12 +1712,10 @@ void Debugger::onBreakpointHit(
17131712
bool lineInRange = line >= bp->m_resolvedLocation.m_startLine &&
17141713
line <= bp->m_resolvedLocation.m_endLine;
17151714

1716-
bool conditionSatisfied = bpMgr->isBreakConditionSatisified(ri, bp);
17171715
if (lineInRange) {
1718-
if (conditionSatisfied) {
1719-
matchingBpId = bpId;
1716+
if (bpMgr->isBreakConditionSatisified(ri, bp)) {
17201717
stopReason = getStopReasonForBp(
1721-
matchingBpId,
1718+
bpId,
17221719
!bp->m_resolvedLocation.m_path.empty()
17231720
? bp->m_resolvedLocation.m_path
17241721
: bp->m_path,
@@ -1728,7 +1725,16 @@ void Debugger::onBreakpointHit(
17281725
// Breakpoint hit!
17291726
pauseTarget(ri, stopReason.c_str());
17301727
bpMgr->onBreakpointHit(bpId);
1731-
break;
1728+
1729+
processCommandQueue(
1730+
getCurrentThreadId(),
1731+
ri,
1732+
"breakpoint",
1733+
stopReason.c_str(),
1734+
true
1735+
);
1736+
1737+
return;
17321738
} else {
17331739
VSDebugLogger::Log(
17341740
VSDebugLogger::LogLevelInfo,
@@ -1740,17 +1746,8 @@ void Debugger::onBreakpointHit(
17401746
}
17411747
}
17421748

1743-
if (matchingBpId >= 0) {
1744-
// If an active breakpoint was found at this location, enter the debugger.
1745-
processCommandQueue(
1746-
getCurrentThreadId(),
1747-
ri,
1748-
"breakpoint",
1749-
stopReason.c_str(),
1750-
true
1751-
);
1752-
} else if (ri->m_runToLocationInfo.path == filePath &&
1753-
line == ri->m_runToLocationInfo.line) {
1749+
if (ri->m_runToLocationInfo.path == filePath &&
1750+
line == ri->m_runToLocationInfo.line) {
17541751

17551752
// Hit our run to location destination!
17561753
stopReason = "Run to location";
@@ -1782,19 +1779,6 @@ void Debugger::onBreakpointHit(
17821779
stopReason.c_str(),
17831780
true
17841781
);
1785-
} else {
1786-
// This breakpoint no longer exists. Remove it from the VM.
1787-
VSDebugLogger::Log(
1788-
VSDebugLogger::LogLevelInfo,
1789-
"Request hit bp that no longer exists, removing from VM. %s:%d",
1790-
filePath.c_str(),
1791-
line
1792-
);
1793-
removeBreakpoint(
1794-
func != nullptr
1795-
? BreakpointType::Function
1796-
: BreakpointType::Source
1797-
);
17981782
}
17991783
}
18001784

0 commit comments

Comments
 (0)