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

Side by Side Diff: runtime/vm/debugger.cc

Issue 23072026: fix cpp11 compile errors (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/debugger.h" 5 #include "vm/debugger.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 ctx = activation->GetSavedCurrentContext(); 956 ctx = activation->GetSavedCurrentContext();
957 if (FLAG_verbose_debug && ctx.IsNull()) { 957 if (FLAG_verbose_debug && ctx.IsNull()) {
958 const Function& caller = activation->function(); 958 const Function& caller = activation->function();
959 const Function& callee = callee_activation->function(); 959 const Function& callee = callee_activation->function();
960 const Script& script = 960 const Script& script =
961 Script::Handle(Class::Handle(caller.Owner()).script()); 961 Script::Handle(Class::Handle(caller.Owner()).script());
962 intptr_t line, col; 962 intptr_t line, col;
963 script.GetTokenLocation(activation->TokenPos(), &line, &col); 963 script.GetTokenLocation(activation->TokenPos(), &line, &col);
964 OS::Print("CollectStackTrace error: no saved context in function " 964 OS::Print("CollectStackTrace error: no saved context in function "
965 "'%s' which calls closure '%s' " 965 "'%s' which calls closure '%s' "
966 " in line %"Pd" column %"Pd"\n", 966 " in line %" Pd " column %" Pd "\n",
967 caller.ToFullyQualifiedCString(), 967 caller.ToFullyQualifiedCString(),
968 callee.ToFullyQualifiedCString(), 968 callee.ToFullyQualifiedCString(),
969 line, col); 969 line, col);
970 } 970 }
971 } 971 }
972 if (optimized_frame_found || code.is_optimized()) { 972 if (optimized_frame_found || code.is_optimized()) {
973 // Set context to null, to avoid returning bad context variable values. 973 // Set context to null, to avoid returning bad context variable values.
974 activation->SetContext(Context::Handle()); 974 activation->SetContext(Context::Handle());
975 optimized_frame_found = true; 975 optimized_frame_found = true;
976 } else { 976 } else {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 } else { 1184 } else {
1185 // This function has not been compiled yet. Set a pending 1185 // This function has not been compiled yet. Set a pending
1186 // breakpoint to be resolved later. 1186 // breakpoint to be resolved later.
1187 SourceBreakpoint* source_bpt = 1187 SourceBreakpoint* source_bpt =
1188 GetSourceBreakpoint(target_function, first_token_pos); 1188 GetSourceBreakpoint(target_function, first_token_pos);
1189 if (source_bpt != NULL) { 1189 if (source_bpt != NULL) {
1190 // A pending source breakpoint for this uncompiled location 1190 // A pending source breakpoint for this uncompiled location
1191 // already exists. 1191 // already exists.
1192 if (FLAG_verbose_debug) { 1192 if (FLAG_verbose_debug) {
1193 OS::Print("Pending breakpoint for uncompiled function" 1193 OS::Print("Pending breakpoint for uncompiled function"
1194 " '%s' at line %"Pd" already exists\n", 1194 " '%s' at line %" Pd " already exists\n",
1195 target_function.ToFullyQualifiedCString(), 1195 target_function.ToFullyQualifiedCString(),
1196 source_bpt->LineNumber()); 1196 source_bpt->LineNumber());
1197 } 1197 }
1198 return source_bpt; 1198 return source_bpt;
1199 } 1199 }
1200 source_bpt = 1200 source_bpt =
1201 new SourceBreakpoint(nextId(), target_function, first_token_pos); 1201 new SourceBreakpoint(nextId(), target_function, first_token_pos);
1202 RegisterSourceBreakpoint(source_bpt); 1202 RegisterSourceBreakpoint(source_bpt);
1203 if (FLAG_verbose_debug) { 1203 if (FLAG_verbose_debug) {
1204 OS::Print("Registering pending breakpoint for " 1204 OS::Print("Registering pending breakpoint for "
1205 "uncompiled function '%s' at line %"Pd"\n", 1205 "uncompiled function '%s' at line %" Pd "\n",
1206 target_function.ToFullyQualifiedCString(), 1206 target_function.ToFullyQualifiedCString(),
1207 source_bpt->LineNumber()); 1207 source_bpt->LineNumber());
1208 } 1208 }
1209 source_bpt->Enable(); 1209 source_bpt->Enable();
1210 return source_bpt; 1210 return source_bpt;
1211 } 1211 }
1212 ASSERT(breakpoint_pos != -1); 1212 ASSERT(breakpoint_pos != -1);
1213 SourceBreakpoint* source_bpt = 1213 SourceBreakpoint* source_bpt =
1214 GetSourceBreakpoint(target_function, breakpoint_pos); 1214 GetSourceBreakpoint(target_function, breakpoint_pos);
1215 if (source_bpt != NULL) { 1215 if (source_bpt != NULL) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 OS::Print("Failed to find script with url '%s'\n", 1279 OS::Print("Failed to find script with url '%s'\n",
1280 script_url.ToCString()); 1280 script_url.ToCString());
1281 } 1281 }
1282 return NULL; 1282 return NULL;
1283 } 1283 }
1284 intptr_t first_token_idx, last_token_idx; 1284 intptr_t first_token_idx, last_token_idx;
1285 script.TokenRangeAtLine(line_number, &first_token_idx, &last_token_idx); 1285 script.TokenRangeAtLine(line_number, &first_token_idx, &last_token_idx);
1286 if (first_token_idx < 0) { 1286 if (first_token_idx < 0) {
1287 // Script does not contain the given line number. 1287 // Script does not contain the given line number.
1288 if (FLAG_verbose_debug) { 1288 if (FLAG_verbose_debug) {
1289 OS::Print("Script '%s' does not contain line number %"Pd"\n", 1289 OS::Print("Script '%s' does not contain line number %" Pd "\n",
1290 script_url.ToCString(), line_number); 1290 script_url.ToCString(), line_number);
1291 } 1291 }
1292 return NULL; 1292 return NULL;
1293 } else if (last_token_idx < 0) { 1293 } else if (last_token_idx < 0) {
1294 // Line does not contain any tokens. first_token_index is the first 1294 // Line does not contain any tokens. first_token_index is the first
1295 // token after the given line. We check whether that token is 1295 // token after the given line. We check whether that token is
1296 // part of a function. 1296 // part of a function.
1297 last_token_idx = first_token_idx; 1297 last_token_idx = first_token_idx;
1298 } 1298 }
1299 1299
1300 Function& func = Function::Handle(isolate_); 1300 Function& func = Function::Handle(isolate_);
1301 while (first_token_idx <= last_token_idx) { 1301 while (first_token_idx <= last_token_idx) {
1302 func = lib.LookupFunctionInScript(script, first_token_idx); 1302 func = lib.LookupFunctionInScript(script, first_token_idx);
1303 if (!func.IsNull()) { 1303 if (!func.IsNull()) {
1304 break; 1304 break;
1305 } 1305 }
1306 first_token_idx++; 1306 first_token_idx++;
1307 } 1307 }
1308 if (func.IsNull()) { 1308 if (func.IsNull()) {
1309 if (FLAG_verbose_debug) { 1309 if (FLAG_verbose_debug) {
1310 OS::Print("No executable code at line %"Pd" in '%s'\n", 1310 OS::Print("No executable code at line %" Pd " in '%s'\n",
1311 line_number, script_url.ToCString()); 1311 line_number, script_url.ToCString());
1312 } 1312 }
1313 return NULL; 1313 return NULL;
1314 } 1314 }
1315 if (last_token_idx < 0) { 1315 if (last_token_idx < 0) {
1316 // The token at first_token_index is past the requested source line. 1316 // The token at first_token_index is past the requested source line.
1317 // Set the breakpoint at the closest position after that line. 1317 // Set the breakpoint at the closest position after that line.
1318 last_token_idx = func.end_token_pos(); 1318 last_token_idx = func.end_token_pos();
1319 } 1319 }
1320 return SetBreakpoint(func, first_token_idx, last_token_idx); 1320 return SetBreakpoint(func, first_token_idx, last_token_idx);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 // Check whether we are in a Dart function that the user is 1581 // Check whether we are in a Dart function that the user is
1582 // interested in. 1582 // interested in.
1583 ActivationFrame* frame = TopDartFrame(); 1583 ActivationFrame* frame = TopDartFrame();
1584 ASSERT(frame != NULL); 1584 ASSERT(frame != NULL);
1585 const Function& func = frame->function(); 1585 const Function& func = frame->function();
1586 if (!IsDebuggable(func)) { 1586 if (!IsDebuggable(func)) {
1587 return; 1587 return;
1588 } 1588 }
1589 1589
1590 if (FLAG_verbose_debug) { 1590 if (FLAG_verbose_debug) {
1591 OS::Print(">>> single step break at %s:%"Pd" (func %s token %"Pd")\n", 1591 OS::Print(">>> single step break at %s:%" Pd " (func %s token %" Pd ")\n",
1592 String::Handle(frame->SourceUrl()).ToCString(), 1592 String::Handle(frame->SourceUrl()).ToCString(),
1593 frame->LineNumber(), 1593 frame->LineNumber(),
1594 String::Handle(frame->QualifiedFunctionName()).ToCString(), 1594 String::Handle(frame->QualifiedFunctionName()).ToCString(),
1595 frame->TokenPos()); 1595 frame->TokenPos());
1596 } 1596 }
1597 1597
1598 stack_trace_ = CollectStackTrace(); 1598 stack_trace_ = CollectStackTrace();
1599 SignalPausedEvent(frame); 1599 SignalPausedEvent(frame);
1600 1600
1601 RemoveInternalBreakpoints(); 1601 RemoveInternalBreakpoints();
(...skipping 21 matching lines...) Expand all
1623 ActivationFrame* top_frame = stack_trace->ActivationFrameAt(0); 1623 ActivationFrame* top_frame = stack_trace->ActivationFrameAt(0);
1624 ASSERT(top_frame != NULL); 1624 ASSERT(top_frame != NULL);
1625 CodeBreakpoint* bpt = GetCodeBreakpoint(top_frame->pc()); 1625 CodeBreakpoint* bpt = GetCodeBreakpoint(top_frame->pc());
1626 ASSERT(bpt != NULL); 1626 ASSERT(bpt != NULL);
1627 1627
1628 bool report_bp = true; 1628 bool report_bp = true;
1629 if (bpt->IsInternal() && !IsDebuggable(top_frame->function())) { 1629 if (bpt->IsInternal() && !IsDebuggable(top_frame->function())) {
1630 report_bp = false; 1630 report_bp = false;
1631 } 1631 }
1632 if (FLAG_verbose_debug) { 1632 if (FLAG_verbose_debug) {
1633 OS::Print(">>> %s %s breakpoint at %s:%"Pd" " 1633 OS::Print(">>> %s %s breakpoint at %s:%" Pd " "
1634 "(token %"Pd") (address %#"Px")\n", 1634 "(token %" Pd ") (address %#" Px ")\n",
1635 report_bp ? "hit" : "ignore", 1635 report_bp ? "hit" : "ignore",
1636 bpt->IsInternal() ? "internal" : "user", 1636 bpt->IsInternal() ? "internal" : "user",
1637 String::Handle(bpt->SourceUrl()).ToCString(), 1637 String::Handle(bpt->SourceUrl()).ToCString(),
1638 bpt->LineNumber(), 1638 bpt->LineNumber(),
1639 bpt->token_pos(), 1639 bpt->token_pos(),
1640 top_frame->pc()); 1640 top_frame->pc());
1641 } 1641 }
1642 1642
1643 if (report_bp && (event_handler_ != NULL)) { 1643 if (report_bp && (event_handler_ != NULL)) {
1644 stack_trace_ = stack_trace; 1644 stack_trace_ = stack_trace;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 } 1865 }
1866 1866
1867 1867
1868 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 1868 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
1869 ASSERT(bpt->next() == NULL); 1869 ASSERT(bpt->next() == NULL);
1870 bpt->set_next(code_breakpoints_); 1870 bpt->set_next(code_breakpoints_);
1871 code_breakpoints_ = bpt; 1871 code_breakpoints_ = bpt;
1872 } 1872 }
1873 1873
1874 } // namespace dart 1874 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698