Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
33d0b9e1
Unverified
Commit
33d0b9e1
authored
May 06, 2020
by
Rémi Verschelde
Committed by
GitHub
May 06, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38393 from nekomatata/printerr-remote-debugger-4.0
Format remote printerr properly in script debugger output
parents
cbb86fdf
aacf69ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
9 deletions
+65
-9
remote_debugger.cpp
core/debugger/remote_debugger.cpp
+28
-5
remote_debugger.h
core/debugger/remote_debugger.h
+10
-1
script_editor_debugger.cpp
editor/debugger/script_editor_debugger.cpp
+27
-3
No files found.
core/debugger/remote_debugger.cpp
View file @
33d0b9e1
...
@@ -480,10 +480,16 @@ void RemoteDebugger::_print_handler(void *p_this, const String &p_string, bool p
...
@@ -480,10 +480,16 @@ void RemoteDebugger::_print_handler(void *p_this, const String &p_string, bool p
if
(
rd
->
is_peer_connected
())
{
if
(
rd
->
is_peer_connected
())
{
if
(
overflowed
)
if
(
overflowed
)
s
+=
"[...]"
;
s
+=
"[...]"
;
rd
->
output_strings
.
push_back
(
s
);
OutputString
output_string
;
output_string
.
message
=
s
;
output_string
.
type
=
p_error
?
MESSAGE_TYPE_ERROR
:
MESSAGE_TYPE_LOG
;
rd
->
output_strings
.
push_back
(
output_string
);
if
(
overflowed
)
{
if
(
overflowed
)
{
rd
->
output_strings
.
push_back
(
"[output overflow, print less text!]"
);
output_string
.
message
=
"[output overflow, print less text!]"
;
output_string
.
type
=
MESSAGE_TYPE_ERROR
;
rd
->
output_strings
.
push_back
(
output_string
);
}
}
}
}
}
}
...
@@ -517,15 +523,32 @@ void RemoteDebugger::flush_output() {
...
@@ -517,15 +523,32 @@ void RemoteDebugger::flush_output() {
if
(
output_strings
.
size
())
{
if
(
output_strings
.
size
())
{
// Join output strings so we generate less messages.
// Join output strings so we generate less messages.
Vector
<
String
>
joined_log_strings
;
Vector
<
String
>
strings
;
Vector
<
String
>
strings
;
strings
.
resize
(
output_strings
.
size
());
Vector
<
int
>
types
;
String
*
w
=
strings
.
ptrw
();
for
(
int
i
=
0
;
i
<
output_strings
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
output_strings
.
size
();
i
++
)
{
w
[
i
]
=
output_strings
[
i
];
const
OutputString
&
output_string
=
output_strings
[
i
];
if
(
output_string
.
type
==
MESSAGE_TYPE_ERROR
)
{
if
(
!
joined_log_strings
.
empty
())
{
strings
.
push_back
(
String
(
"
\n
"
).
join
(
joined_log_strings
));
types
.
push_back
(
MESSAGE_TYPE_LOG
);
joined_log_strings
.
clear
();
}
strings
.
push_back
(
output_string
.
message
);
types
.
push_back
(
MESSAGE_TYPE_ERROR
);
}
else
{
joined_log_strings
.
push_back
(
output_string
.
message
);
}
}
if
(
!
joined_log_strings
.
empty
())
{
strings
.
push_back
(
String
(
"
\n
"
).
join
(
joined_log_strings
));
types
.
push_back
(
MESSAGE_TYPE_LOG
);
}
}
Array
arr
;
Array
arr
;
arr
.
push_back
(
strings
);
arr
.
push_back
(
strings
);
arr
.
push_back
(
types
);
_put_msg
(
"output"
,
arr
);
_put_msg
(
"output"
,
arr
);
output_strings
.
clear
();
output_strings
.
clear
();
}
}
...
...
core/debugger/remote_debugger.h
View file @
33d0b9e1
...
@@ -40,6 +40,11 @@
...
@@ -40,6 +40,11 @@
#include "core/ustring.h"
#include "core/ustring.h"
class
RemoteDebugger
:
public
EngineDebugger
{
class
RemoteDebugger
:
public
EngineDebugger
{
public
:
enum
MessageType
{
MESSAGE_TYPE_LOG
,
MESSAGE_TYPE_ERROR
,
};
private
:
private
:
typedef
DebuggerMarshalls
::
OutputError
ErrorMessage
;
typedef
DebuggerMarshalls
::
OutputError
ErrorMessage
;
...
@@ -57,7 +62,11 @@ private:
...
@@ -57,7 +62,11 @@ private:
Ref
<
RemoteDebuggerPeer
>
peer
;
Ref
<
RemoteDebuggerPeer
>
peer
;
List
<
String
>
output_strings
;
struct
OutputString
{
String
message
;
MessageType
type
;
};
List
<
OutputString
>
output_strings
;
List
<
ErrorMessage
>
errors
;
List
<
ErrorMessage
>
errors
;
int
n_messages_dropped
=
0
;
int
n_messages_dropped
=
0
;
...
...
editor/debugger/script_editor_debugger.cpp
View file @
33d0b9e1
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "script_editor_debugger.h"
#include "script_editor_debugger.h"
#include "core/debugger/debugger_marshalls.h"
#include "core/debugger/debugger_marshalls.h"
#include "core/debugger/remote_debugger.h"
#include "core/io/marshalls.h"
#include "core/io/marshalls.h"
#include "core/project_settings.h"
#include "core/project_settings.h"
#include "core/ustring.h"
#include "core/ustring.h"
...
@@ -396,10 +397,33 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
...
@@ -396,10 +397,33 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
inspector
->
add_stack_variable
(
p_data
);
inspector
->
add_stack_variable
(
p_data
);
}
else
if
(
p_msg
==
"output"
)
{
}
else
if
(
p_msg
==
"output"
)
{
ERR_FAIL_COND
(
p_data
.
size
()
<
1
);
ERR_FAIL_COND
(
p_data
.
size
()
!=
2
);
ERR_FAIL_COND
(
p_data
[
0
].
get_type
()
!=
Variant
::
PACKED_STRING_ARRAY
);
ERR_FAIL_COND
(
p_data
[
0
].
get_type
()
!=
Variant
::
PACKED_STRING_ARRAY
);
Vector
<
String
>
strings
=
p_data
[
0
];
Vector
<
String
>
output_strings
=
p_data
[
0
];
EditorNode
::
get_log
()
->
add_message
(
String
(
"
\n
"
).
join
(
strings
));
ERR_FAIL_COND
(
p_data
[
1
].
get_type
()
!=
Variant
::
PACKED_INT32_ARRAY
);
Vector
<
int
>
output_types
=
p_data
[
1
];
ERR_FAIL_COND
(
output_strings
.
size
()
!=
output_types
.
size
());
for
(
int
i
=
0
;
i
<
output_strings
.
size
();
i
++
)
{
RemoteDebugger
::
MessageType
type
=
(
RemoteDebugger
::
MessageType
)(
int
)(
output_types
[
i
]);
EditorLog
::
MessageType
msg_type
;
switch
(
type
)
{
case
RemoteDebugger
:
:
MESSAGE_TYPE_LOG
:
{
msg_type
=
EditorLog
::
MSG_TYPE_STD
;
}
break
;
case
RemoteDebugger
:
:
MESSAGE_TYPE_ERROR
:
{
msg_type
=
EditorLog
::
MSG_TYPE_ERROR
;
}
break
;
default
:
{
WARN_PRINT
(
"Unhandled script debugger message type: "
+
itos
(
type
));
msg_type
=
EditorLog
::
MSG_TYPE_STD
;
}
break
;
}
EditorNode
::
get_log
()
->
add_message
(
output_strings
[
i
],
msg_type
);
}
}
else
if
(
p_msg
==
"performance:profile_frame"
)
{
}
else
if
(
p_msg
==
"performance:profile_frame"
)
{
Vector
<
float
>
p
;
Vector
<
float
>
p
;
p
.
resize
(
p_data
.
size
());
p
.
resize
(
p_data
.
size
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment