Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: src/inspector/v8-debugger-script.cc

Issue 2728563002: [inspector] added type of break location into getPossibleBreakpoints output (Closed)
Patch Set: added DCHECK Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/v8-debugger-script.h ('k') | src/wasm/wasm-objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-debugger-script.cc
diff --git a/src/inspector/v8-debugger-script.cc b/src/inspector/v8-debugger-script.cc
index d4f94dd15a238ce5ea4140f4c0e5490315d4804c..f8dae51812a526c951aee9472ce7eba637e484ee 100644
--- a/src/inspector/v8-debugger-script.cc
+++ b/src/inspector/v8-debugger-script.cc
@@ -155,11 +155,40 @@ class ActualScript : public V8DebuggerScript {
bool getPossibleBreakpoints(
const v8::debug::Location& start, const v8::debug::Location& end,
bool restrictToFunction,
- std::vector<v8::debug::Location>* locations) override {
+ std::vector<v8::debug::BreakLocation>* locations) override {
v8::HandleScope scope(m_isolate);
v8::Local<v8::debug::Script> script = m_script.Get(m_isolate);
- return script->GetPossibleBreakpoints(start, end, restrictToFunction,
- locations);
+ std::vector<v8::debug::BreakLocation> allLocations;
+ if (!script->GetPossibleBreakpoints(start, end, restrictToFunction,
+ &allLocations)) {
+ return false;
+ }
+ if (!allLocations.size()) return true;
+ v8::debug::BreakLocation current = allLocations[0];
+ for (size_t i = 1; i < allLocations.size(); ++i) {
+ if (allLocations[i].GetLineNumber() == current.GetLineNumber() &&
+ allLocations[i].GetColumnNumber() == current.GetColumnNumber()) {
+ if (allLocations[i].type() != v8::debug::kCommonBreakLocation) {
+ DCHECK(allLocations[i].type() == v8::debug::kCallBreakLocation ||
+ allLocations[i].type() == v8::debug::kReturnBreakLocation);
+ // debugger can returns more then one break location at the same
+ // source location, e.g. foo() - in this case there are two break
+ // locations before foo: for statement and for function call, we can
+ // merge them for inspector and report only one with call type.
+ current = allLocations[i];
+ }
+ } else {
+ // we assume that returned break locations are sorted.
+ DCHECK(
+ allLocations[i].GetLineNumber() > current.GetLineNumber() ||
+ (allLocations[i].GetColumnNumber() >= current.GetColumnNumber() &&
+ allLocations[i].GetLineNumber() == current.GetLineNumber()));
+ locations->push_back(current);
+ current = allLocations[i];
+ }
+ }
+ locations->push_back(current);
+ return true;
}
void resetBlackboxedStateCache() override {
@@ -223,7 +252,7 @@ class WasmVirtualScript : public V8DebuggerScript {
bool getPossibleBreakpoints(
const v8::debug::Location& start, const v8::debug::Location& end,
bool restrictToFunction,
- std::vector<v8::debug::Location>* locations) override {
+ std::vector<v8::debug::BreakLocation>* locations) override {
v8::HandleScope scope(m_isolate);
v8::Local<v8::debug::Script> script = m_script.Get(m_isolate);
String16 v8ScriptId = String16::fromInteger(script->Id());
@@ -244,7 +273,7 @@ class WasmVirtualScript : public V8DebuggerScript {
bool success = script->GetPossibleBreakpoints(
translatedStart, translatedEnd, restrictToFunction, locations);
- for (v8::debug::Location& loc : *locations) {
+ for (v8::debug::BreakLocation& loc : *locations) {
TranslateV8LocationToProtocolLocation(m_wasmTranslation, &loc, v8ScriptId,
scriptId());
}
« no previous file with comments | « src/inspector/v8-debugger-script.h ('k') | src/wasm/wasm-objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698