From 8280bb0de0737f9149face902db21192a0d98ca8 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 4 Aug 2015 20:17:13 -0300 Subject: more debugger fixes -setting/clearing breakpoints during run-time now works -multi-line strings resulted in wrong line numbers in bytecode, fixed --- core/script_debugger_remote.cpp | 16 ++++++++++++++++ modules/gdscript/gd_tokenizer.cpp | 5 +++++ tools/editor/plugins/script_editor_plugin.cpp | 1 + tools/editor/script_editor_debugger.cpp | 13 +++++++++++++ tools/editor/script_editor_debugger.h | 2 ++ 5 files changed, 37 insertions(+) diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 2ec858eb8b..ebed016b7f 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -243,6 +243,15 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { if (request_scene_tree) request_scene_tree(request_scene_tree_ud); + + } else if (command=="breakpoint") { + + bool set = cmd[3]; + if (set) + insert_breakpoint(cmd[2],cmd[1]); + else + remove_breakpoint(cmd[2],cmd[1]); + } else { _parse_live_edit(cmd); } @@ -518,6 +527,13 @@ void ScriptDebuggerRemote::_poll_events() { if (request_scene_tree) request_scene_tree(request_scene_tree_ud); + } else if (command=="breakpoint") { + + bool set = cmd[3]; + if (set) + insert_breakpoint(cmd[2],cmd[1]); + else + remove_breakpoint(cmd[2],cmd[1]); } else { _parse_live_edit(cmd); } diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 8b25b38bd3..560724cad0 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -642,6 +642,11 @@ void GDTokenizerText::_advance() { str+=res; } else { + if (CharType(GETCHAR(i))=='\n') { + line++; + column=0; + } + str+=CharType(GETCHAR(i)); } i++; diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 3ef240e74c..302e4f2196 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1101,6 +1101,7 @@ void ScriptEditor::_menu_option(int p_option) { int line=current->get_text_edit()->cursor_get_line(); bool dobreak = !current->get_text_edit()->is_line_set_as_breakpoint(line); current->get_text_edit()->set_line_as_breakpoint(line,dobreak); + get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),line+1,dobreak); } break; case DEBUG_NEXT: { diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 7ef1be0da4..2e1fa2814e 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -1078,6 +1078,19 @@ void ScriptEditorDebugger::live_debug_reparent_node(const NodePath& p_at, const } +void ScriptEditorDebugger::set_breakpoint(const String& p_path,int p_line,bool p_enabled) { + + if (connection.is_valid()) { + Array msg; + msg.push_back("breakpoint"); + msg.push_back(p_path); + msg.push_back(p_line); + msg.push_back(p_enabled); + ppeer->put_var(msg); + } +} + + void ScriptEditorDebugger::_error_selected(int p_idx) { error_stack->clear(); diff --git a/tools/editor/script_editor_debugger.h b/tools/editor/script_editor_debugger.h index f8e943df9b..3c66dde340 100644 --- a/tools/editor/script_editor_debugger.h +++ b/tools/editor/script_editor_debugger.h @@ -173,6 +173,8 @@ public: void live_debug_duplicate_node(const NodePath& p_at,const String& p_new_name); void live_debug_reparent_node(const NodePath& p_at,const NodePath& p_new_place,const String& p_new_name,int p_at_pos); + void set_breakpoint(const String& p_path,int p_line,bool p_enabled); + void update_live_edit_root(); -- cgit v1.2.3