[debugger] account for script source offsets in --print-break-location.

R=vogelheim@chromium.org

Review-Url: https://codereview.chromium.org/1928943002
Cr-Commit-Position: refs/heads/master@{#35870}
This commit is contained in:
yangguo 2016-04-28 07:23:45 -07:00 committed by Commit bot
parent 08dbdd4037
commit c1c53a7d4c

View File

@ -2258,8 +2258,10 @@ void Debug::PrintBreakLocation() {
Handle<Script> script = Handle<Script>::cast(script_obj); Handle<Script> script = Handle<Script>::cast(script_obj);
Handle<String> source(String::cast(script->source())); Handle<String> source(String::cast(script->source()));
Script::InitLineEnds(script); Script::InitLineEnds(script);
int line = Script::GetLineNumber(script, source_position); int line =
int column = Script::GetColumnNumber(script, source_position); Script::GetLineNumber(script, source_position) - script->line_offset();
int column = Script::GetColumnNumber(script, source_position) -
(line == 0 ? script->column_offset() : 0);
Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
int line_start = int line_start =
line == 0 ? 0 : Smi::cast(line_ends->get(line - 1))->value() + 1; line == 0 ? 0 : Smi::cast(line_ends->get(line - 1))->value() + 1;