| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 13b6e7b42486bf5963175b678746b4d22ae99efe..8bf674d97b881fa8ed2051faaafd81d0c840d236 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -9241,7 +9241,8 @@ int GetSmiValue(i::Handle<i::FixedArray> array, int index) {
|
|
|
| bool debug::Script::GetPossibleBreakpoints(
|
| const debug::Location& start, const debug::Location& end,
|
| - bool restrict_to_function, std::vector<debug::Location>* locations) const {
|
| + bool restrict_to_function,
|
| + std::vector<debug::BreakLocation>* locations) const {
|
| CHECK(!start.IsEmpty());
|
| i::Handle<i::Script> script = Utils::OpenHandle(this);
|
| if (script->type() == i::Script::TYPE_WASM) {
|
| @@ -9263,15 +9264,30 @@ bool debug::Script::GetPossibleBreakpoints(
|
| : GetSourceOffset(end);
|
| if (start_offset >= end_offset) return true;
|
|
|
| - std::set<int> offsets;
|
| + std::vector<i::BreakLocation> v8_locations;
|
| if (!isolate->debug()->GetPossibleBreakpoints(
|
| - script, start_offset, end_offset, restrict_to_function, &offsets)) {
|
| + script, start_offset, end_offset, restrict_to_function,
|
| + &v8_locations)) {
|
| return false;
|
| }
|
|
|
| + std::map<int, i::BreakLocation> unique_locations;
|
| + for (const auto& location : v8_locations) {
|
| + auto it = unique_locations.find(location.position());
|
| + if (it != unique_locations.end() &&
|
| + (it->second.IsCall() || it->second.IsDebuggerStatement() ||
|
| + it->second.IsReturn() || it->second.IsTailCall())) {
|
| + continue;
|
| + }
|
| + if (it == unique_locations.end()) {
|
| + unique_locations.insert(std::make_pair(location.position(), location));
|
| + } else {
|
| + it->second = location;
|
| + }
|
| + }
|
| int current_line_end_index = 0;
|
| - for (const auto& it : offsets) {
|
| - int offset = it;
|
| + for (const auto& it : unique_locations) {
|
| + int offset = it.first;
|
| while (offset > GetSmiValue(line_ends, current_line_end_index)) {
|
| ++current_line_end_index;
|
| CHECK(current_line_end_index < line_ends->length());
|
| @@ -9281,10 +9297,13 @@ bool debug::Script::GetPossibleBreakpoints(
|
| if (current_line_end_index > 0) {
|
| line_offset = GetSmiValue(line_ends, current_line_end_index - 1) + 1;
|
| }
|
| - locations->push_back(debug::Location(
|
| + debug::Location location(
|
| current_line_end_index + script->line_offset(),
|
| offset - line_offset +
|
| - (current_line_end_index == 0 ? script->column_offset() : 0)));
|
| + (current_line_end_index == 0 ? script->column_offset() : 0));
|
| + locations->emplace_back(
|
| + location, it.second.IsCall() || it.second.IsTailCall(),
|
| + it.second.IsReturn(), it.second.IsDebuggerStatement());
|
| }
|
| return true;
|
| }
|
|
|