diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2018-01-09 17:19:03 +0100 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2018-01-09 17:19:03 +0100 |
commit | 5be356b72f5b765cdec069c2c4a4011a42fabc47 (patch) | |
tree | 5a8bc0f7a3e9cb0646634e5df57d9c73d98d6a09 /editor | |
parent | 52165fa12de7ca76898a7c1855a2f23797b2c2ed (diff) |
Mono: Implement stack info for errors and exceptions
Diffstat (limited to 'editor')
-rw-r--r-- | editor/script_editor_debugger.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index cbf2687d73..629b5b63fb 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1616,30 +1616,33 @@ void ScriptEditorDebugger::_error_selected(int p_idx) { error_stack->clear(); Array st = error_list->get_item_metadata(p_idx); - for (int i = 0; i < st.size(); i += 2) { + for (int i = 0; i < st.size(); i += 3) { String script = st[i]; - int line = st[i + 1]; + String func = st[i + 1]; + int line = st[i + 2]; Array md; md.push_back(st[i]); md.push_back(st[i + 1]); + md.push_back(st[i + 2]); - String str = script.get_file() + ":" + itos(line); + String str = func + " in " + script.get_file() + ":line " + itos(line); error_stack->add_item(str); error_stack->set_item_metadata(error_stack->get_item_count() - 1, md); - error_stack->set_item_tooltip(error_stack->get_item_count() - 1, TTR("File:") + " " + String(st[i]) + "\n" + TTR("Line:") + " " + itos(line)); + error_stack->set_item_tooltip(error_stack->get_item_count() - 1, + TTR("File:") + " " + script + "\n" + TTR("Function:") + " " + func + "\n" + TTR("Line:") + " " + itos(line)); } } void ScriptEditorDebugger::_error_stack_selected(int p_idx) { Array arr = error_stack->get_item_metadata(p_idx); - if (arr.size() != 2) + if (arr.size() != 3) return; Ref<Script> s = ResourceLoader::load(arr[0]); - emit_signal("goto_script_line", s, int(arr[1]) - 1); + emit_signal("goto_script_line", s, int(arr[2]) - 1); } void ScriptEditorDebugger::set_hide_on_stop(bool p_hide) { |