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

Side by Side Diff: src/debug.cc

Issue 11395: Removed all functions for parsing the debugger command line commands. The cor... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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
« no previous file with comments | « no previous file | src/debug-delay.js » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 v8::Object::Cast(*fun->Call(api_exec_state, 0, NULL)); 1762 v8::Object::Cast(*fun->Call(api_exec_state, 0, NULL));
1763 if (try_catch.HasCaught()) { 1763 if (try_catch.HasCaught()) {
1764 PrintLn(try_catch.Exception()); 1764 PrintLn(try_catch.Exception());
1765 return; 1765 return;
1766 } 1766 }
1767 1767
1768 // Notify the debugger that a debug event has occurred. 1768 // Notify the debugger that a debug event has occurred.
1769 host_running_ = false; 1769 host_running_ = false;
1770 SetEventJSONFromEvent(event_data); 1770 SetEventJSONFromEvent(event_data);
1771 1771
1772 // Wait for commands from the debugger. 1772 // Wait for requests from the debugger.
1773 while (true) { 1773 while (true) {
1774 command_received_->Wait(); 1774 command_received_->Wait();
1775 Logger::DebugTag("Get command from command queue, in interactive loop."); 1775 Logger::DebugTag("Got request from command queue, in interactive loop.");
1776 Vector<uint16_t> command = command_queue_.Get(); 1776 Vector<uint16_t> command = command_queue_.Get();
1777 ASSERT(!host_running_); 1777 ASSERT(!host_running_);
1778 if (!Debugger::debugger_active()) { 1778 if (!Debugger::debugger_active()) {
1779 host_running_ = true; 1779 host_running_ = true;
1780 return; 1780 return;
1781 } 1781 }
1782 1782
1783 // Invoke the JavaScript to convert the debug command line to a JSON 1783 // Invoke the JavaScript to process the debug request.
1784 // request, invoke the JSON request and convert the JSON response to a text
1785 // representation.
1786 v8::Local<v8::String> fun_name; 1784 v8::Local<v8::String> fun_name;
1787 v8::Local<v8::Function> fun; 1785 v8::Local<v8::Function> fun;
1788 v8::Local<v8::Value> args[1]; 1786 v8::Local<v8::Value> request;
1789 v8::TryCatch try_catch; 1787 v8::TryCatch try_catch;
1790 fun_name = v8::String::New("processDebugCommand"); 1788 fun_name = v8::String::New("processDebugRequest");
1791 fun = v8::Function::Cast(*cmd_processor->Get(fun_name)); 1789 fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
1792 args[0] = v8::String::New(reinterpret_cast<uint16_t*>(command.start()), 1790 request = v8::String::New(reinterpret_cast<uint16_t*>(command.start()),
1793 command.length()); 1791 command.length());
1794 v8::Local<v8::Value> result_val = fun->Call(cmd_processor, 1, args); 1792 const int kArgc = 1;
1793 v8::Handle<Value> argv[kArgc] = { request };
1794 v8::Local<v8::Value> response_val = fun->Call(cmd_processor, kArgc, argv);
1795 1795
1796 // Get the result of the command. 1796 // Get the response.
1797 v8::Local<v8::String> result_string; 1797 v8::Local<v8::String> response;
1798 bool running = false; 1798 bool running = false;
1799 if (!try_catch.HasCaught()) { 1799 if (!try_catch.HasCaught()) {
1800 // Get the result as an object. 1800 // Get response string.
1801 v8::Local<v8::Object> result = v8::Object::Cast(*result_val); 1801 if (!response_val->IsUndefined()) {
1802 response = v8::String::Cast(*response_val);
1803 } else {
1804 response = v8::String::New("");
1805 }
1802 1806
1803 // Log the JSON request/response. 1807 // Log the JSON request/response.
1804 if (FLAG_trace_debug_json) { 1808 if (FLAG_trace_debug_json) {
1805 PrintLn(result->Get(v8::String::New("request"))); 1809 PrintLn(request);
1806 PrintLn(result->Get(v8::String::New("response"))); 1810 PrintLn(response);
1807 } 1811 }
1808 1812
1809 // Get the running state. 1813 // Get the running state.
1810 running = result->Get(v8::String::New("running"))->ToBoolean()->Value(); 1814 fun_name = v8::String::New("isRunning");
1811 1815 fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
1812 // Get result text. 1816 const int kArgc = 1;
Mads Ager (chromium) 2008/11/24 08:46:31 Do you want this to be static as well?
Søren Thygesen Gjesse 2008/11/24 10:31:48 Sure, changed.
1813 v8::Local<v8::Value> text_result = 1817 v8::Handle<Value> argv[kArgc] = { response };
1814 result->Get(v8::String::New("response")); 1818 v8::Local<v8::Value> running_val = fun->Call(cmd_processor, kArgc, argv);
1815 if (!text_result->IsUndefined()) { 1819 if (!try_catch.HasCaught()) {
1816 result_string = text_result->ToString(); 1820 running = running_val->ToBoolean()->Value();
1817 } else {
1818 result_string = v8::String::New("");
1819 } 1821 }
1820 } else { 1822 } else {
1821 // In case of failure the result text is the exception text. 1823 // In case of failure the result text is the exception text.
1822 result_string = try_catch.Exception()->ToString(); 1824 response = try_catch.Exception()->ToString();
1823 } 1825 }
1824 1826
1825 // Convert text result to C string. 1827 // Convert text result to C string.
1826 v8::String::Value val(result_string); 1828 v8::String::Value val(response);
1827 Vector<uint16_t> str(reinterpret_cast<uint16_t*>(*val), 1829 Vector<uint16_t> str(reinterpret_cast<uint16_t*>(*val),
1828 result_string->Length()); 1830 response->Length());
1829 1831
1830 // Set host_running_ correctly for nested debugger evaluations. 1832 // Set host_running_ correctly for nested debugger evaluations.
1831 host_running_ = running; 1833 host_running_ = running;
1832 1834
1833 // Return the result. 1835 // Return the result.
1834 SendMessage(str); 1836 SendMessage(str);
1835 1837
1836 // Return from debug event processing is VM should be running. 1838 // Return from debug event processing is VM should be running.
1837 if (running) { 1839 if (running) {
1838 return; 1840 return;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 } 1936 }
1935 1937
1936 1938
1937 void LockingMessageQueue::Clear() { 1939 void LockingMessageQueue::Clear() {
1938 ScopedLock sl(lock_); 1940 ScopedLock sl(lock_);
1939 queue_.Clear(); 1941 queue_.Clear();
1940 } 1942 }
1941 1943
1942 1944
1943 } } // namespace v8::internal 1945 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/debug-delay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698