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

Side by Side Diff: runtime/bin/dbg_connection.cc

Issue 10540121: Add API to configure debugger pause on exception (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « runtime/bin/dbg_connection.h ('k') | runtime/include/dart_debugger_api.h » ('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 "bin/dbg_connection.h" 5 #include "bin/dbg_connection.h"
6 #include "bin/dartutils.h" 6 #include "bin/dartutils.h"
7 #include "bin/socket.h" 7 #include "bin/socket.h"
8 #include "bin/thread.h" 8 #include "bin/thread.h"
9 #include "bin/utils.h" 9 #include "bin/utils.h"
10 10
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 uint64_t bp_id_value; 618 uint64_t bp_id_value;
619 Dart_Handle res = Dart_IntegerToUint64(bp_id, &bp_id_value); 619 Dart_Handle res = Dart_IntegerToUint64(bp_id, &bp_id_value);
620 ASSERT_NOT_ERROR(res); 620 ASSERT_NOT_ERROR(res);
621 dart::TextBuffer msg(64); 621 dart::TextBuffer msg(64);
622 msg.Printf("{ \"id\": %d, \"result\": { \"breakpointId\": %d }}", 622 msg.Printf("{ \"id\": %d, \"result\": { \"breakpointId\": %d }}",
623 msg_id, bp_id_value); 623 msg_id, bp_id_value);
624 SendMsg(&msg); 624 SendMsg(&msg);
625 } 625 }
626 626
627 627
628 void DebuggerConnectionHandler::HandlePauseOnExcCmd(const char* json_msg) {
629 int msg_id = msgbuf_->MessageId();
630 char* exc_chars = msgbuf_->GetStringParam("exceptions");
631 Dart_ExceptionPauseInfo info = kNoPauseOnExceptions;
632 if (strcmp(exc_chars, "none") == 0) {
633 info = kNoPauseOnExceptions;
634 } else if (strcmp(exc_chars, "all") == 0) {
635 info = kPauseOnAllExceptions;
636 } else if (strcmp(exc_chars, "unhandled") == 0) {
637 info = kPauseOnUnhandledExceptions;
638 } else {
639 SendError(msg_id, "illegal value for parameter 'exceptions'");
640 return;
641 }
642 Dart_Handle res = Dart_SetExceptionPauseInfo(info);
643 ASSERT_NOT_ERROR(res);
644 dart::TextBuffer msg(32);
645 msg.Printf("{ \"id\": %d }", msg_id);
646 SendMsg(&msg);
647 }
648
649
628 void DebuggerConnectionHandler::HandleRemBpCmd(const char* json_msg) { 650 void DebuggerConnectionHandler::HandleRemBpCmd(const char* json_msg) {
629 int msg_id = msgbuf_->MessageId(); 651 int msg_id = msgbuf_->MessageId();
630 int bpt_id = msgbuf_->GetIntParam("breakpointId"); 652 int bpt_id = msgbuf_->GetIntParam("breakpointId");
631 Dart_Handle res = Dart_RemoveBreakpoint(bpt_id); 653 Dart_Handle res = Dart_RemoveBreakpoint(bpt_id);
632 if (Dart_IsError(res)) { 654 if (Dart_IsError(res)) {
633 SendError(msg_id, Dart_GetError(res)); 655 SendError(msg_id, Dart_GetError(res));
634 return; 656 return;
635 } 657 }
636 dart::TextBuffer msg(32); 658 dart::TextBuffer msg(32);
637 msg.Printf("{ \"id\": %d }", msg_id); 659 msg.Printf("{ \"id\": %d }", msg_id);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 static JSONDebuggerCommand debugger_commands[] = { 722 static JSONDebuggerCommand debugger_commands[] = {
701 { "resume", HandleResumeCmd }, 723 { "resume", HandleResumeCmd },
702 { "getLibraries", HandleGetLibrariesCmd }, 724 { "getLibraries", HandleGetLibrariesCmd },
703 { "getClassProperties", HandleGetClassPropsCmd }, 725 { "getClassProperties", HandleGetClassPropsCmd },
704 { "getLibraryProperties", HandleGetLibPropsCmd }, 726 { "getLibraryProperties", HandleGetLibPropsCmd },
705 { "getObjectProperties", HandleGetObjPropsCmd }, 727 { "getObjectProperties", HandleGetObjPropsCmd },
706 { "getScriptURLs", HandleGetScriptURLsCmd }, 728 { "getScriptURLs", HandleGetScriptURLsCmd },
707 { "getScriptSource", HandleGetSourceCmd }, 729 { "getScriptSource", HandleGetSourceCmd },
708 { "getStackTrace", HandleGetStackTraceCmd }, 730 { "getStackTrace", HandleGetStackTraceCmd },
709 { "setBreakpoint", HandleSetBpCmd }, 731 { "setBreakpoint", HandleSetBpCmd },
732 { "setPauseOnException", HandlePauseOnExcCmd },
710 { "removeBreakpoint", HandleRemBpCmd }, 733 { "removeBreakpoint", HandleRemBpCmd },
711 { "stepInto", HandleStepIntoCmd }, 734 { "stepInto", HandleStepIntoCmd },
712 { "stepOut", HandleStepOutCmd }, 735 { "stepOut", HandleStepOutCmd },
713 { "stepOver", HandleStepOverCmd }, 736 { "stepOver", HandleStepOverCmd },
714 { NULL, NULL } 737 { NULL, NULL }
715 }; 738 };
716 739
717 for (;;) { 740 for (;;) {
718 SendQueuedMsgs(); 741 SendQueuedMsgs();
719 while (!msgbuf_->IsValidMessage() && msgbuf_->Alive()) { 742 while (!msgbuf_->IsValidMessage() && msgbuf_->Alive()) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 DebuggerConnectionImpl::StartHandler(port_number); 894 DebuggerConnectionImpl::StartHandler(port_number);
872 Dart_SetBreakpointHandler(BreakpointHandler); 895 Dart_SetBreakpointHandler(BreakpointHandler);
873 Dart_SetBreakpointResolvedHandler(BptResolvedHandler); 896 Dart_SetBreakpointResolvedHandler(BptResolvedHandler);
874 Dart_SetExceptionThrownHandler(ExceptionThrownHandler); 897 Dart_SetExceptionThrownHandler(ExceptionThrownHandler);
875 } 898 }
876 899
877 900
878 DebuggerConnectionHandler::~DebuggerConnectionHandler() { 901 DebuggerConnectionHandler::~DebuggerConnectionHandler() {
879 CloseDbgConnection(); 902 CloseDbgConnection();
880 } 903 }
OLDNEW
« no previous file with comments | « runtime/bin/dbg_connection.h ('k') | runtime/include/dart_debugger_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698