Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index 4bd5fa0cf0cd64b761d4bacb59195ac52b2ab28d..55bab373890ed733354780623f058675725d0047 100644 |
--- a/src/debug/debug.cc |
+++ b/src/debug/debug.cc |
@@ -149,13 +149,22 @@ BreakLocation BreakLocation::FromCodeOffset(Handle<DebugInfo> debug_info, |
return it.GetBreakLocation(); |
} |
+// Put GetFirstFrameSummary Declaration here as FromFrame use it. |
+FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame); |
Yang
2016/02/05 08:49:34
Can you simply move the function definition to her
|
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); |
+ Handle<JSFunction> function(summary.function()); |
Yang
2016/02/05 08:49:34
You don't need to refresh the frame summary here.
|
+ Handle<SharedFunctionInfo> shared(function->shared()); |
+ // Refresh frame summary if the code has been recompiled for debugging. |
+ if (AbstractCode::cast(shared->code()) != *summary.abstract_code()) { |
+ summary = GetFirstFrameSummary(frame); |
+ } |
+ |
+ return FromCodeOffset(debug_info, summary.code_offset() - 1); |
} |
// Find the break point at the supplied address, or the closest one before |