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

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

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