Commit Graph

104 Commits

Author SHA1 Message Date
33e16435f5 Replace some problematic uses of String::num to String::num_int64 2025-01-15 12:51:51 -05:00
be86ce3103 Apply iwyu suggestion in core. 2024-12-19 00:43:47 +08:00
b5c31ebb41 Add contains_char() for single-character 'contains' calls. 2024-12-06 20:23:35 +01:00
68f638cf02 Use (r)find_char instead of (r)find for single characters 2024-11-17 10:02:18 +01:00
4d4353179e Merge pull request #97218 from wenqiangwang/local_debuggger_expr_evalulation
Add support for `print` command in local (command line `-d`) debugger
2024-11-12 12:13:13 -06:00
7cd850b909 [Debugger] Move quit shortcut configuration to the SceneDebugger 2024-11-07 15:03:17 +01:00
38f9769bc6 [Core] Improve error messages with vformat 2024-10-30 15:55:51 +01:00
0d350e7108 Set clang-format RemoveSemicolon rule to true
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
645abdbb80 Add expression evaluater to debugger (REPL)
Co-authored-by: rohanrhu <rohanrhu2@gmail.com>
2024-10-01 15:36:09 +02:00
9a94353fa3 Added support for 'print' command in local (command line -d) debugger 2024-09-28 13:28:07 -07:00
9f9ee0c813 SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
e33fdb4296 Use MutexLock in more places 2024-08-29 14:12:59 +02:00
b18e1e0dcd Fix Game window stops responding when debugger pauses
Fixes #73374

As of godot 4 On windows/osx the game window will be frozen and will not
be updated.

In the debugger loop it calls

OS::get_singleton()->process_and_drop_events();
which allows windows/osx to handle system events. If the window doesn't
handle these events then both systems will judge the window to be 'not
responding' (osx beachball cursor)

When the event processing code was migrated from OS to DisplayServer the
process_and_drop_events() logic was moved to DisplayServer, but the call
inside the remote debugger pause loop was not updated to call the
DisplayServer version, there are currently no implementations of
OS::process_and_drop_events() so i removed it and switched to the new
DisplayServer::force_process_and_drop_events() method.
2024-07-10 13:38:57 -07:00
a0dbdcc3ab Replace find with contains/has where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
2024-05-08 12:37:42 +02:00
955d5affa8 Reduce and prevent unnecessary random-access to List
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +02:00
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
b3cac9c092 Allow Ref instantiate to accept constructor args 2024-02-10 13:19:14 -06:00
684752e75b Replace error checks against size with is_empty 2024-02-09 12:50:15 +01:00
c027aecc2e Merge pull request #86676 from rune-scape/sparse-script-reload
GDScript: Hot-reload changed scripts only
2024-01-17 18:52:54 +01:00
ACB
c976306628 fix deadlock in RemoteDebugger::debug 2024-01-14 11:07:14 +01:00
cde478bda6 Hot-reload only changed scripts 2024-01-02 17:56:52 -08:00
a3cb1b096f Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
5e512b705e Support threads in the script debugger
* This implementation adds threads on the side of the client (script debugger).
* Some functions of the debugger are optimized.
* The profile is also now thread safe using atomics.
* The editor can switch between multiple threads when debugging.

This PR adds threaded support for the script language debugger. Every thread has its own thread local data and it will connect to the debugger using multiple thread IDs.
This means that, now, the editor can receive multiple threads entering debug mode at the same time.
2023-07-26 12:06:45 +02:00
4ecad8dea3 Fix infinite loop on EOF in the command line debugger
When using the command line debugger (godot -d) on Unix systems, when
entering an EOF (ctrl+D), the debugger enters an infinite loop.

Adding a check for EOF in the debugger loop exits the debugger when EOF
is entered.

Fixes #50170.
2023-06-11 04:20:22 -07:00
a37c30dfc9 Fix thread IDs.
On Linux, thread IDs were not properly assigned with the current approach.
The line:
`std::thread new_thread(&Thread::callback, _thread_id_hash(thread.get_id()), p_settings, p_callback, p_user);`
does not work because the thread ID is not assigned until the thread starts.

This PR changes the behavior to use manually generated thread IDs. Additionally, if a thread is (or may have been created) outside Godot, the method `Thread::attach_external_thread` was added.
2023-04-24 15:13:58 +02:00
c0083e431b Cleanup unused engine code v2 2023-01-19 13:02:18 +01:00
d95794ec8a One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
67265d14f7 [MP] Move engine and editor profilers to a plugin.
Also refactor the editor plugin out of the ReplicationEditor.
2022-11-14 15:09:00 +01:00
54418ea659 Remove NO_THREADS fallback code, Godot 4 requires thread support
This also removes `OS::can_use_threads` from the public API since it's always
true.
2022-10-03 11:23:26 +02:00
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
033001375f Fix editor re-focus on debugger break on Windows 2022-07-21 21:47:05 +02:00
cebdfd1bbd Fixing Print_rich which only displays correctly in terminal
There was an issue that the type was not passed through correctly. These couple of lines fix this issue and make print_rich work as expected.
2022-07-01 04:34:19 +09:00
9961881b98 Remove SceneTree dependency from LocalDebugger
Core classes should not have dependencies on scene classes.
2022-06-29 19:49:27 -06:00
c6291bcd8a Adding print_rich for printing with BBCode 2022-06-29 00:41:29 +09:00
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
79be2c7b75 Rename profiler "Idle Time" to "Process Time"
References to "idle time" are progressively being replaced by
"process time" throughout the engine to avoid confusion.
2022-05-05 20:23:47 +02:00
6e6fe2b025 Merge pull request #59582 from Faless/net/4.x_tcp_explicit_poll 2022-04-27 13:56:58 +02:00
de4c97758a Fix more issues found by cppcheck. 2022-04-20 10:34:00 +03:00
f851c4aa33 Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
0e52867668 [Net] Make StreamPeerTCP::_poll_connection explicit.
No longer hacked into `get_status` and renamed to `poll`.

The old `poll` (for *nix `poll`, win `select`) is now called `wait`.
2022-03-27 16:36:44 +02:00
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
6583797305 [Debugger] Move servers-related behaviours to ServersDebugger.
Forcing draw during debug break is now handled by ServersDebugger, and
only happens when the proper message is sent from the EditorDebugger
("servers:draw").
In a similar way, briging the window in foreground is now also handled
by ServersDebugger upon receiving "servers:foreground" which is sent by
the EditorDebugger when resuming from a break ("continue").
2022-02-06 17:36:48 +01:00
87f4bbd668 [Debugger] Move most profilers to ServersDebugger.
Also splits bandwidth/rpc profiler (RPCProfiler is now in
SceneDebugger).
2022-02-06 17:36:48 +01:00
789e648f4d [Debugger] New extensible EngineProfiler class.
Uses GDExtension, replaces old Callable system for profilers, and is
also used internally.
2022-02-06 17:33:45 +01:00
adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
050908626f Merge pull request #57526 from tavurth/bugfix/high-macos-cpu-usage 2022-02-02 10:16:24 +01:00
c37bd41c79 Increase RemoteDebuggerPeerTCP poll to 6.9ms
Fix high CPU usage on MacOS by reverting the polling for Network
debugging to match 144hz refresh rate.
2022-02-01 23:35:30 +03:00