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

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

Issue 3006923002: Revised "Eliminate dependencies on assemblers and code stubs in precompiled runtime." (Closed)
Patch Set: Explicitly clear unbox_numeric_fields flag in PRODUCT builds Created 3 years, 3 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
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/deferred_objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 bool ActivationFrame::IsDebuggable() const { 664 bool ActivationFrame::IsDebuggable() const {
665 return Debugger::IsDebuggable(function()); 665 return Debugger::IsDebuggable(function());
666 } 666 }
667 667
668 void ActivationFrame::PrintDescriptorsError(const char* message) { 668 void ActivationFrame::PrintDescriptorsError(const char* message) {
669 OS::PrintErr("Bad descriptors: %s\n", message); 669 OS::PrintErr("Bad descriptors: %s\n", message);
670 OS::PrintErr("function %s\n", function().ToQualifiedCString()); 670 OS::PrintErr("function %s\n", function().ToQualifiedCString());
671 OS::PrintErr("pc_ %" Px "\n", pc_); 671 OS::PrintErr("pc_ %" Px "\n", pc_);
672 OS::PrintErr("deopt_id_ %" Px "\n", deopt_id_); 672 OS::PrintErr("deopt_id_ %" Px "\n", deopt_id_);
673 OS::PrintErr("context_level_ %" Px "\n", context_level_); 673 OS::PrintErr("context_level_ %" Px "\n", context_level_);
674 #if !defined(DART_PRECOMPILED_RUNTIME)
674 DisassembleToStdout formatter; 675 DisassembleToStdout formatter;
675 code().Disassemble(&formatter); 676 code().Disassemble(&formatter);
677 #endif // !defined(DART_PRECOMPILED_RUNTIME)
676 PcDescriptors::Handle(code().pc_descriptors()).Print(); 678 PcDescriptors::Handle(code().pc_descriptors()).Print();
677 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames, 679 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames,
678 Thread::Current(), 680 Thread::Current(),
679 StackFrameIterator::kNoCrossThreadIteration); 681 StackFrameIterator::kNoCrossThreadIteration);
680 StackFrame* frame = frames.NextFrame(); 682 StackFrame* frame = frames.NextFrame();
681 while (frame != NULL) { 683 while (frame != NULL) {
682 OS::PrintErr("%s\n", frame->ToCString()); 684 OS::PrintErr("%s\n", frame->ToCString());
683 frame = frames.NextFrame(); 685 frame = frames.NextFrame();
684 } 686 }
685 OS::Abort(); 687 OS::Abort();
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 if (FLAG_trace_debugger_stacktrace) { 1774 if (FLAG_trace_debugger_stacktrace) {
1773 const Context& ctx = activation->GetSavedCurrentContext(); 1775 const Context& ctx = activation->GetSavedCurrentContext();
1774 OS::PrintErr("\tUsing saved context: %s\n", ctx.ToCString()); 1776 OS::PrintErr("\tUsing saved context: %s\n", ctx.ToCString());
1775 } 1777 }
1776 if (FLAG_trace_debugger_stacktrace) { 1778 if (FLAG_trace_debugger_stacktrace) {
1777 OS::PrintErr("\tLine number: %" Pd "\n", activation->LineNumber()); 1779 OS::PrintErr("\tLine number: %" Pd "\n", activation->LineNumber());
1778 } 1780 }
1779 return activation; 1781 return activation;
1780 } 1782 }
1781 1783
1784 #if !defined(DART_PRECOMPILED_RUNTIME)
1782 RawArray* Debugger::DeoptimizeToArray(Thread* thread, 1785 RawArray* Debugger::DeoptimizeToArray(Thread* thread,
1783 StackFrame* frame, 1786 StackFrame* frame,
1784 const Code& code) { 1787 const Code& code) {
1785 ASSERT(code.is_optimized()); 1788 ASSERT(code.is_optimized());
1786 Isolate* isolate = thread->isolate(); 1789 Isolate* isolate = thread->isolate();
1787 // Create the DeoptContext for this deoptimization. 1790 // Create the DeoptContext for this deoptimization.
1788 DeoptContext* deopt_context = 1791 DeoptContext* deopt_context =
1789 new DeoptContext(frame, code, DeoptContext::kDestIsAllocated, NULL, NULL, 1792 new DeoptContext(frame, code, DeoptContext::kDestIsAllocated, NULL, NULL,
1790 true, false /* deoptimizing_code */); 1793 true, false /* deoptimizing_code */);
1791 isolate->set_deopt_context(deopt_context); 1794 isolate->set_deopt_context(deopt_context);
1792 1795
1793 deopt_context->FillDestFrame(); 1796 deopt_context->FillDestFrame();
1794 deopt_context->MaterializeDeferredObjects(); 1797 deopt_context->MaterializeDeferredObjects();
1795 const Array& dest_frame = 1798 const Array& dest_frame =
1796 Array::Handle(thread->zone(), deopt_context->DestFrameAsArray()); 1799 Array::Handle(thread->zone(), deopt_context->DestFrameAsArray());
1797 1800
1798 isolate->set_deopt_context(NULL); 1801 isolate->set_deopt_context(NULL);
1799 delete deopt_context; 1802 delete deopt_context;
1800 1803
1801 return dest_frame.raw(); 1804 return dest_frame.raw();
1802 } 1805 }
1806 #endif // !defined(DART_PRECOMPILED_RUNTIME)
1803 1807
1804 DebuggerStackTrace* Debugger::CollectStackTrace() { 1808 DebuggerStackTrace* Debugger::CollectStackTrace() {
1805 Thread* thread = Thread::Current(); 1809 Thread* thread = Thread::Current();
1806 Zone* zone = thread->zone(); 1810 Zone* zone = thread->zone();
1807 Isolate* isolate = thread->isolate(); 1811 Isolate* isolate = thread->isolate();
1808 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8); 1812 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8);
1809 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames, 1813 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames,
1810 Thread::Current(), 1814 Thread::Current(),
1811 StackFrameIterator::kNoCrossThreadIteration); 1815 StackFrameIterator::kNoCrossThreadIteration);
1812 Code& code = Code::Handle(zone); 1816 Code& code = Code::Handle(zone);
(...skipping 17 matching lines...) Expand all
1830 } 1834 }
1831 1835
1832 void Debugger::AppendCodeFrames(Thread* thread, 1836 void Debugger::AppendCodeFrames(Thread* thread,
1833 Isolate* isolate, 1837 Isolate* isolate,
1834 Zone* zone, 1838 Zone* zone,
1835 DebuggerStackTrace* stack_trace, 1839 DebuggerStackTrace* stack_trace,
1836 StackFrame* frame, 1840 StackFrame* frame,
1837 Code* code, 1841 Code* code,
1838 Code* inlined_code, 1842 Code* inlined_code,
1839 Array* deopt_frame) { 1843 Array* deopt_frame) {
1840 if (code->is_optimized() && !FLAG_precompiled_runtime) { 1844 #if !defined(DART_PRECOMPILED_RUNTIME)
1845 if (code->is_optimized()) {
1841 // TODO(rmacnak): Use CodeSourceMap 1846 // TODO(rmacnak): Use CodeSourceMap
1842 *deopt_frame = DeoptimizeToArray(thread, frame, *code); 1847 *deopt_frame = DeoptimizeToArray(thread, frame, *code);
1843 for (InlinedFunctionsIterator it(*code, frame->pc()); !it.Done(); 1848 for (InlinedFunctionsIterator it(*code, frame->pc()); !it.Done();
1844 it.Advance()) { 1849 it.Advance()) {
1845 *inlined_code = it.code(); 1850 *inlined_code = it.code();
1846 if (FLAG_trace_debugger_stacktrace) { 1851 if (FLAG_trace_debugger_stacktrace) {
1847 const Function& function = Function::Handle(zone, it.function()); 1852 const Function& function = Function::Handle(zone, it.function());
1848 ASSERT(!function.IsNull()); 1853 ASSERT(!function.IsNull());
1849 OS::PrintErr("CollectStackTrace: visiting inlined function: %s\n", 1854 OS::PrintErr("CollectStackTrace: visiting inlined function: %s\n",
1850 function.ToFullyQualifiedCString()); 1855 function.ToFullyQualifiedCString());
1851 } 1856 }
1852 intptr_t deopt_frame_offset = it.GetDeoptFpOffset(); 1857 intptr_t deopt_frame_offset = it.GetDeoptFpOffset();
1853 stack_trace->AddActivation(CollectDartFrame(isolate, it.pc(), frame, 1858 stack_trace->AddActivation(CollectDartFrame(isolate, it.pc(), frame,
1854 *inlined_code, *deopt_frame, 1859 *inlined_code, *deopt_frame,
1855 deopt_frame_offset)); 1860 deopt_frame_offset));
1856 } 1861 }
1857 } else { 1862 return;
1858 stack_trace->AddActivation(CollectDartFrame(
1859 isolate, frame->pc(), frame, *code, Object::null_array(), 0));
1860 } 1863 }
1864 #endif // !defined(DART_PRECOMPILED_RUNTIME)
1865 stack_trace->AddActivation(CollectDartFrame(isolate, frame->pc(), frame,
1866 *code, Object::null_array(), 0));
1861 } 1867 }
1862 1868
1863 DebuggerStackTrace* Debugger::CollectAsyncCausalStackTrace() { 1869 DebuggerStackTrace* Debugger::CollectAsyncCausalStackTrace() {
1864 if (!FLAG_causal_async_stacks) { 1870 if (!FLAG_causal_async_stacks) {
1865 return NULL; 1871 return NULL;
1866 } 1872 }
1867 Thread* thread = Thread::Current(); 1873 Thread* thread = Thread::Current();
1868 Zone* zone = thread->zone(); 1874 Zone* zone = thread->zone();
1869 Isolate* isolate = thread->isolate(); 1875 Isolate* isolate = thread->isolate();
1870 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8); 1876 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 } 1945 }
1940 } 1946 }
1941 // Follow the link. 1947 // Follow the link.
1942 async_stack_trace = async_stack_trace.async_link(); 1948 async_stack_trace = async_stack_trace.async_link();
1943 } 1949 }
1944 1950
1945 return stack_trace; 1951 return stack_trace;
1946 } 1952 }
1947 1953
1948 DebuggerStackTrace* Debugger::CollectAwaiterReturnStackTrace() { 1954 DebuggerStackTrace* Debugger::CollectAwaiterReturnStackTrace() {
1955 #if defined(DART_PRECOMPILED_RUNTIME)
1956 // Causal async stacks are not supported in the AOT runtime.
1957 ASSERT(!FLAG_async_debugger);
1958 return NULL;
1959 #else
1949 if (!FLAG_async_debugger) { 1960 if (!FLAG_async_debugger) {
1950 return NULL; 1961 return NULL;
1951 } 1962 }
1952 // Causal async stacks are not supported in the AOT runtime.
1953 ASSERT(!FLAG_precompiled_runtime);
1954 1963
1955 Thread* thread = Thread::Current(); 1964 Thread* thread = Thread::Current();
1956 Zone* zone = thread->zone(); 1965 Zone* zone = thread->zone();
1957 Isolate* isolate = thread->isolate(); 1966 Isolate* isolate = thread->isolate();
1958 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8); 1967 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8);
1959 1968
1960 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames, 1969 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames,
1961 Thread::Current(), 1970 Thread::Current(),
1962 StackFrameIterator::kNoCrossThreadIteration); 1971 StackFrameIterator::kNoCrossThreadIteration);
1963 1972
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 } else { 2091 } else {
2083 stack_trace->AddAsyncCausalFrame(pc, code); 2092 stack_trace->AddAsyncCausalFrame(pc, code);
2084 } 2093 }
2085 } 2094 }
2086 } 2095 }
2087 // Follow the link. 2096 // Follow the link.
2088 async_stack_trace = async_stack_trace.async_link(); 2097 async_stack_trace = async_stack_trace.async_link();
2089 } 2098 }
2090 2099
2091 return stack_trace; 2100 return stack_trace;
2101 #endif // defined(DART_PRECOMPILED_RUNTIME)
2092 } 2102 }
2093 2103
2094 ActivationFrame* Debugger::TopDartFrame() const { 2104 ActivationFrame* Debugger::TopDartFrame() const {
2095 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames, 2105 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames,
2096 Thread::Current(), 2106 Thread::Current(),
2097 StackFrameIterator::kNoCrossThreadIteration); 2107 StackFrameIterator::kNoCrossThreadIteration);
2098 StackFrame* frame = iterator.NextFrame(); 2108 StackFrame* frame = iterator.NextFrame();
2099 while ((frame != NULL) && !frame->IsDartFrame()) { 2109 while ((frame != NULL) && !frame->IsDartFrame()) {
2100 frame = iterator.NextFrame(); 2110 frame = iterator.NextFrame();
2101 } 2111 }
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
4360 4370
4361 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 4371 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
4362 ASSERT(bpt->next() == NULL); 4372 ASSERT(bpt->next() == NULL);
4363 bpt->set_next(code_breakpoints_); 4373 bpt->set_next(code_breakpoints_);
4364 code_breakpoints_ = bpt; 4374 code_breakpoints_ = bpt;
4365 } 4375 }
4366 4376
4367 #endif // !PRODUCT 4377 #endif // !PRODUCT
4368 4378
4369 } // namespace dart 4379 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/deferred_objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698