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

Unified Diff: runtime/vm/debugger.cc

Issue 147353005: Prevent accidental breakpoints in non-debuggable code (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
===================================================================
--- runtime/vm/debugger.cc (revision 32165)
+++ runtime/vm/debugger.cc (working copy)
@@ -1310,11 +1310,19 @@
for (intptr_t i = 0; i < desc.Length(); i++) {
intptr_t desc_token_pos = desc.TokenPos(i);
ASSERT(desc_token_pos >= 0);
- if (desc_token_pos < requested_token_pos) {
- // This descriptor is before the first acceptable token position.
- continue;
- }
if (IsSafePoint(desc, i)) {
+ if ((desc_token_pos < func.token_pos()) ||
+ (desc_token_pos > func.end_token_pos())) {
+ // The position is outside of the function token range. This can
+ // happen in constructors, for initializer expressions that are
+ // inlined in the field declaration.
+ ASSERT(func.IsConstructor());
+ continue;
+ }
+ if (desc_token_pos < requested_token_pos) {
+ // This descriptor is before the first acceptable token position.
+ continue;
+ }
if (desc_token_pos < best_fit_pos) {
// So far, this descriptor has the lowest token position after
// the first acceptable token position.
@@ -1440,6 +1448,22 @@
}
+static bool IsDebuggableFunctionKind(const Function& func) {
+ RawFunction::Kind kind = func.kind();
+ if ((kind == RawFunction::kImplicitGetter) ||
+ (kind == RawFunction::kImplicitSetter) ||
+ (kind == RawFunction::kImplicitStaticFinalGetter) ||
+ (kind == RawFunction::kStaticInitializer) ||
+ (kind == RawFunction::kMethodExtractor) ||
+ (kind == RawFunction::kNoSuchMethodDispatcher) ||
+ (kind == RawFunction::kInvokeFieldDispatcher) ||
+ func.IsImplicitConstructor()) {
+ return false;
+ }
+ return true;
+}
+
+
static void SelectBestFit(Function* best_fit, Function* func) {
if (best_fit->IsNull()) {
*best_fit = func->raw();
@@ -1482,7 +1506,8 @@
for (intptr_t pos = 0; pos < num_functions; pos++) {
function ^= functions.At(pos);
ASSERT(!function.IsNull());
- if (FunctionContains(function, script, token_pos)) {
+ if (IsDebuggableFunctionKind(function) &&
+ FunctionContains(function, script, token_pos)) {
SelectBestFit(&best_fit, &function);
}
}
@@ -1494,7 +1519,8 @@
for (intptr_t pos = 0; pos < num_closures; pos++) {
function ^= closures.At(pos);
ASSERT(!function.IsNull());
- if (FunctionContains(function, script, token_pos)) {
+ if (IsDebuggableFunctionKind(function) &&
+ FunctionContains(function, script, token_pos)) {
SelectBestFit(&best_fit, &function);
}
}
@@ -1891,14 +1917,7 @@
bool Debugger::IsDebuggable(const Function& func) {
- RawFunction::Kind fkind = func.kind();
- if ((fkind == RawFunction::kImplicitGetter) ||
- (fkind == RawFunction::kImplicitSetter) ||
- (fkind == RawFunction::kImplicitStaticFinalGetter) ||
- (fkind == RawFunction::kStaticInitializer) ||
- (fkind == RawFunction::kMethodExtractor) ||
- (fkind == RawFunction::kNoSuchMethodDispatcher) ||
- (fkind == RawFunction::kInvokeFieldDispatcher)) {
+ if (!IsDebuggableFunctionKind(func)) {
return false;
}
const Class& cls = Class::Handle(func.Owner());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698