more debugger fixes

-setting/clearing breakpoints during run-time now works
-multi-line strings resulted in wrong line numbers in bytecode, fixed
This commit is contained in:
Juan Linietsky 2015-08-04 20:17:13 -03:00
parent 09a2de9916
commit 8280bb0de0
5 changed files with 37 additions and 0 deletions

View file

@ -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);
}

View file

@ -642,6 +642,11 @@ void GDTokenizerText::_advance() {
str+=res;
} else {
if (CharType(GETCHAR(i))=='\n') {
line++;
column=0;
}
str+=CharType(GETCHAR(i));
}
i++;

View file

@ -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: {

View file

@ -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();

View file

@ -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();