Commit a0f6d5ed authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

[debugger] Use code offsets from frame summary in FromFrame Function.

The CL 33579 (https://codereview.chromium.org/1618343002) use code offsets instead of raw PC where possible.

But the offset maybe come from an optimized frame, not the un-optimized frame that FromCodeOffset and BreakIndexFromCodeOffset function expect.
So The offset from optimized frame can't be used in FromCodeOffset and  BreakIndexFromCodeOffset function.

This CL use the frame summary to find the corresponding code offset in unoptimized code according to Yang's suggestion.

Review URL: https://codereview.chromium.org/1663113002

Cr-Commit-Position: refs/heads/master@{#33778}
parent 5d2c09a8
......@@ -149,13 +149,20 @@ BreakLocation BreakLocation::FromCodeOffset(Handle<DebugInfo> debug_info,
return it.GetBreakLocation();
}
// Move GetFirstFrameSummary Definition to here as FromFrame use it.
FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame) {
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
frame->Summarize(&frames);
return frames.first();
}
BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info,
JavaScriptFrame* frame) {
// Code offset to the instruction after the current one, possibly a break
// location as well. So the "- 1" to exclude it from the search.
Code* code = frame->LookupCode();
int code_offset = static_cast<int>(frame->pc() - code->instruction_start());
return FromCodeOffset(debug_info, code_offset - 1);
// Get code offset from the unoptimized code.
FrameSummary summary = GetFirstFrameSummary(frame);
return FromCodeOffset(debug_info, summary.code_offset() - 1);
}
// Find the break point at the supplied address, or the closest one before
......@@ -794,13 +801,6 @@ bool Debug::IsBreakOnException(ExceptionBreakType type) {
}
FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame) {
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
frame->Summarize(&frames);
return frames.first();
}
void Debug::PrepareStepIn(Handle<JSFunction> function) {
if (!is_active()) return;
if (last_step_action() < StepIn) return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment