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

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

Issue 2979163002: Allow setting breakpoints in function literal field initializers under --dfe. (Closed)
Patch Set: Address comments on patch set 1 Created 3 years, 5 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
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 "platform/address_sanitizer.h" 9 #include "platform/address_sanitizer.h"
10 10
11 #include "vm/code_patcher.h" 11 #include "vm/code_patcher.h"
12 #include "vm/compiler.h" 12 #include "vm/compiler.h"
13 #include "vm/dart_entry.h" 13 #include "vm/dart_entry.h"
14 #include "vm/deopt_instructions.h" 14 #include "vm/deopt_instructions.h"
15 #include "vm/disassembler.h" 15 #include "vm/disassembler.h"
16 #include "vm/flags.h" 16 #include "vm/flags.h"
17 #include "vm/globals.h" 17 #include "vm/globals.h"
18 #include "vm/json_stream.h" 18 #include "vm/json_stream.h"
19 #include "vm/kernel_reader.h"
19 #include "vm/longjump.h" 20 #include "vm/longjump.h"
20 #include "vm/message_handler.h" 21 #include "vm/message_handler.h"
21 #include "vm/object.h" 22 #include "vm/object.h"
22 #include "vm/object_store.h" 23 #include "vm/object_store.h"
23 #include "vm/os.h" 24 #include "vm/os.h"
24 #include "vm/parser.h" 25 #include "vm/parser.h"
25 #include "vm/port.h" 26 #include "vm/port.h"
26 #include "vm/runtime_entry.h" 27 #include "vm/runtime_entry.h"
27 #include "vm/service.h" 28 #include "vm/service.h"
28 #include "vm/service_event.h" 29 #include "vm/service_event.h"
(...skipping 21 matching lines...) Expand all
50 DEFINE_FLAG(bool, verbose_debug, false, "Verbose debugger messages"); 51 DEFINE_FLAG(bool, verbose_debug, false, "Verbose debugger messages");
51 DEFINE_FLAG(bool, 52 DEFINE_FLAG(bool,
52 steal_breakpoints, 53 steal_breakpoints,
53 false, 54 false,
54 "Intercept breakpoints and other pause events before they " 55 "Intercept breakpoints and other pause events before they "
55 "are sent to the embedder and use a generic VM breakpoint " 56 "are sent to the embedder and use a generic VM breakpoint "
56 "handler instead. This handler dispatches breakpoints to " 57 "handler instead. This handler dispatches breakpoints to "
57 "the VM service."); 58 "the VM service.");
58 59
59 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); 60 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger);
61 DECLARE_FLAG(bool, use_dart_frontend);
60 62
61 #ifndef PRODUCT 63 #ifndef PRODUCT
62 64
63 Debugger::EventHandler* Debugger::event_handler_ = NULL; 65 Debugger::EventHandler* Debugger::event_handler_ = NULL;
64 66
65 class RemoteObjectCache : public ZoneAllocated { 67 class RemoteObjectCache : public ZoneAllocated {
66 public: 68 public:
67 explicit RemoteObjectCache(intptr_t initial_size); 69 explicit RemoteObjectCache(intptr_t initial_size);
68 intptr_t AddObject(const Object& obj); 70 intptr_t AddObject(const Object& obj);
69 RawObject* GetObj(intptr_t obj_id) const; 71 RawObject* GetObj(intptr_t obj_id) const;
(...skipping 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 for (intptr_t pos = 0; pos < num_fields; pos++) { 2657 for (intptr_t pos = 0; pos < num_fields; pos++) {
2656 TokenPosition start; 2658 TokenPosition start;
2657 TokenPosition end; 2659 TokenPosition end;
2658 field ^= fields.At(pos); 2660 field ^= fields.At(pos);
2659 ASSERT(!field.IsNull()); 2661 ASSERT(!field.IsNull());
2660 if (field.Script() != script.raw()) { 2662 if (field.Script() != script.raw()) {
2661 // The field should be defined in the script we want to set 2663 // The field should be defined in the script we want to set
2662 // the breakpoint in. 2664 // the breakpoint in.
2663 continue; 2665 continue;
2664 } 2666 }
2665 if (Parser::FieldHasFunctionLiteralInitializer(field, &start, &end)) { 2667 if (!field.has_initializer()) {
2668 continue;
2669 }
2670
2671 bool has_func_literal_initializer = false;
2672 #ifndef DART_PRECOMPILED_RUNTIME
2673 if (FLAG_use_dart_frontend) {
2674 has_func_literal_initializer =
2675 kernel::KernelReader::FieldHasFunctionLiteralInitializer(
2676 field, &start, &end);
2677 } else {
2678 #endif // !DART_PRECOMPILED_RUNTIME
2679 has_func_literal_initializer =
2680 Parser::FieldHasFunctionLiteralInitializer(field, &start, &end);
2681 #ifndef DART_PRECOMPILED_RUNTIME
2682 }
2683 #endif // !DART_PRECOMPILED_RUNTIME
siva 2017/07/18 22:49:07 Strictly speaking this entire function and most of
sivachandra 2017/07/19 00:14:21 Acknowledged.
2684
2685 if (has_func_literal_initializer) {
2666 if ((start <= token_pos && token_pos <= end) || 2686 if ((start <= token_pos && token_pos <= end) ||
2667 (token_pos <= start && start <= last_token_pos)) { 2687 (token_pos <= start && start <= last_token_pos)) {
2668 return true; 2688 return true;
2669 } 2689 }
2670 } 2690 }
2671 } 2691 }
2672 } 2692 }
2673 } 2693 }
2674 return false; 2694 return false;
2675 } 2695 }
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
4340 4360
4341 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 4361 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
4342 ASSERT(bpt->next() == NULL); 4362 ASSERT(bpt->next() == NULL);
4343 bpt->set_next(code_breakpoints_); 4363 bpt->set_next(code_breakpoints_);
4344 code_breakpoints_ = bpt; 4364 code_breakpoints_ = bpt;
4345 } 4365 }
4346 4366
4347 #endif // !PRODUCT 4367 #endif // !PRODUCT
4348 4368
4349 } // namespace dart 4369 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698