Commit graph

313 commits

Author SHA1 Message Date
Marcus Minhorst
649ddd7774 Replaced uint with unsigned int 2025-07-19 11:37:24 -03:00
Marcus Minhorst
9b0f5d9b0d Fixes sign-compare warnings 2025-07-18 21:11:50 -03:00
Nikita
45ac7c1d9e
ZScript DAP Debug server (#3009)
* Add STL-standard type traits and functions to TMap to enable for loop iteration

* add third-party range-map library

I have e-mailed the author for clarifcation on the license, will update this when they respond

* vcpkg: Add cppdap and eventpp libraries, update baseline

* DAP implementation

* Add `FileSystem::FileHash()` to get the CRC32 hash

* add `starting_offset` param to `VMDisasm()` for debugger disassembly view

Defaults to `0`, should not change output if it's not set

* Add `VMFrameStack::HasFrames()` to prevent assertions when inspecting in the debugger

* Add `PC` field to VMFrame, ensure that it is updated whenever vm increments/decrements the pc

Does not change alignment, the offsets used in VMFrame still work
We need this for the debugger because we otherwise have no way to get the pc; it was a local in `ExecScriptFunc()`

* `ZCCCompiler::CreateClassTypes()`: ensure SourceLumpName is set for classes derived from non-native classes

* start debug server in d_main, add `vm_debug` cvars and `-debug` CLI arg

* Add documentation for `vm_debug` cvars

* vm_exec: Add debugger hooks for instruction execution events

* c_console: Add debugger hooks for logging events in `PrintString`

* add `.cache/` to gitignore

* vendor cppdap on main @ 6464cd7

Patches:
removed .gitmodules (submodules were thirdparty/json, thirdparty/googletest)
removed thirdparty/googletest, not needed
removed thirdparty/json/docs, thirdparty/json/test, thirdparty/json/benchmarks to prevent massive bloat

* vendor eventpp on master @ 1224dd6

* build: use internal cppdap and eventpp by default

* dap: fix Binary::GetFunctionLineRange()

* fix bug in range_map::find_ranges

* make Binary dap::Source dynamic

* cache source code upon retrieval

* refactor Binary into a class, cleanup PexCache

* fix ending session gracefully

* d_main: Stop debug server in D_Cleanup()

* Fix connecting to debugger when session already started

* cleanup unused stuff in ZScriptDebugger

* always send TerminateEvents on disconnect if initialized

* tweak color display

* Don't cache disassembly lines when scanning scripts

* Cache nodes when getting runtime state

* WIP display locals

* Fix display of static arrays

* Ensure names display in proper order

* dap: Fix struct locals display, add args display

* Support `start` parameter

* Support `filter` parameter

* remove struct unbound native data display

Practically useless for debugging zscript and didn't work properly anyway

* d_main: fix vm_jit and vm_jit not being disabled soon enough

* support breaking on abort exceptions

* dap: refactor game event emitter functions into seperate header

* dap: show native functions on stack

* dap: Remove "Native" from exception handling, simplify exception event emit

* dap: add instruction breakpoints

* dap: fix display of locals not in scope yet

* dap: Make disassembly view display invalid instructions for non-code addresses

* dap: remove dot initializers

* dap: fix local structs in scope

* dap: don't parse the non-used options in the launch/attach requests

* dap: fix local struct view

* dap: Fix displaying objects that aren't their actual types

* dap: Fix action and state handling

* dap: stack display view

* dap: fix object display view

* d_dehacked: set qualified name in addition to the printable name

* dap: fix displaying breakpoint errors when script isn't loaded

* dap: remove debug print

* dap: Display parameter names

* dap: Turn down verbosity of logging

* dap: fix disassembly view

* dap: fix performance problems with arrays

* c_console: emit event only if not PRINT_NODAPEVENT

* dap: improve logging

* dap: update upstream cppdap library to fix deadlocks on no bind

* dap: Fix ending session on client socket closed

* dap: prevent DebugServer.h from pulling in `dap` and `ZScriptDebugger.h`

* dap: fix pause event not being emitted on pause

* dap: remove eventpp emitters, way too slow

* Remove eventpp dependency

* dap: Display correct register names

* dap: Show special inits in registers

* dap: Add stack offset to VMLocalVariable

* dap: fix display of static arrays and local variables on stack vs. registers

* dap: fix displaying function pointers

* dap: tweak color display

* dap: fix scalar display < 4

* dap: add Globals display to debugger

* dap: unify methods to get vmvalue

* dap: rename free method to freeValue to avoid running afoul of macro defs

* fix windows builds

* fix compile on linux

* cleanup

* Fix display of function breakpoints

* dap: Don't send back binary files

* dap: include sbarinfo in script types (no debug support for anything but zscript yet, this is just for returning source info)

* dap: don't show ending session message unless initialized

* fix erroneous commit

* dap: handle evaluate requests

* Fix getting bitfield values

* Add CVars Scope and evaluation

* add running console commands from repl

* dap: disable commands via repl for now

* fix loading functions DECORATE scripts

* Add source information to Dehacked VM functions, add debugging support

* dap: cleanup

* fix resolving archive paths

* don't send source back on native stack frames

* handle `modules` request

* cleanup

* allow evaluating cvars on hover

* fix oob bpinfos

* fix restarting the game blowing out the debug server

* dap: process input events while paused to prevent deadlocks

* fix getting local state

* dap: fix LocalState alignment

* dap: fix DumpStateHelper

* update cppdap protocol version to 1.68.0

* remove cppdap from vcpkg deps

We can't use the upstream version anyway because the maintainers are not merging our patches

* dap: make named variable nodes derive from the same class

* dap: make cvar scope available in native stack frames

* handle local variables with conflicting names

* add I_GetWindowEvent() to win32 to only process window events when debugging is paused

* dap: fix evaluate

* dap: fix display of `out` variables
2025-07-18 00:01:18 -03:00
Boondorl
a44632f41b Fixed EFX enum 2025-07-17 03:19:52 -03:00
Boondorl
73445f6f6a Fixed arithmetic state jumps going out-of-bounds 2025-07-17 03:19:52 -03:00
Ricardo Luís Vaz Silva
99ffd8727b rewrite array codegen for field access
fixes major codegen bug
2025-07-17 03:19:12 -03:00
Ricardo Luís Vaz Silva
f4eebd1ced CallVM API, plus multi-return and vector support 2025-06-18 03:52:23 -03:00
DyNaM1Kk
62d258a689 Exported DoubleBindings 2025-06-04 08:48:16 -03:00
Boondorl
e7d0991798 Fixed JIT error with Conjugate/Inverse
These need to be compiler intrinsics since faux types aren't supported with self.
2025-05-30 10:58:10 -03:00
Ricardo Luís Vaz Silva
706d1b6978 Scriptified scoreboard drawing 2025-05-21 10:50:34 -03:00
Ricardo Luís Vaz Silva
8019b56823 fix comment 2025-04-01 17:19:03 -03:00
Ricardo Luís Vaz Silva
d8651420cc fix parameter/return checking 2025-04-01 17:19:03 -03:00
Ricardo Luís Vaz Silva
278bd0fb7d finish implementing VMCallSingle 2025-04-01 17:19:03 -03:00
Ricardo Luís Vaz Silva
1f1c271883 VMCallScript -> VMCallSingle 2025-04-01 17:19:03 -03:00
MajorCooke
6f3032dc54 Exported:
* GetLumpContainer
* GetContainerName
* GetLumpFullPath
for WADS struct, useful for debugging custom-made parsers and identifying where problems may arise.

All credit goes to Jay for the code.
2025-03-30 20:36:13 -03:00
Magnus Norddahl
92cc96a672 Add VMCallScript template for calling ZScript functions with type checking 2025-03-20 00:10:50 -03:00
Magnus Norddahl
b4c3d2331e Fix memory leak in mixins 2025-03-20 00:10:50 -03:00
Ricardo Luís Vaz Silva
c82c6bff16 fix function-pointer cast parsing 2025-03-07 17:22:24 -03:00
Ricardo Luís Vaz Silva
b0889b9814 Fix deprecation version checks on class fields/pointers 2025-03-06 08:59:02 -03:00
Ricardo Luís Vaz Silva
909d211137 rename vm internal structs to make room for compilation-unit-internal structs/classes 2025-03-05 12:07:19 -03:00
Ricardo Luís Vaz Silva
0d963166f1 Allow >> in parser for aggregate types
makes stuff like Array<Class<X>> parse properly (bit hacky but can't do much better without restructuring the scanner/lexer)
2025-03-05 12:07:19 -03:00
Ricardo Luís Vaz Silva
7685553af8 4.14.1 accepts 4.15, bump version to 4.15.1 2025-03-03 08:28:59 -03:00
Ricardo Luís Vaz Silva
02523b1f90 restrict internal structs to gzdoom.pk3 2025-03-02 17:48:03 -03:00
Ricardo Luís Vaz Silva
93c8af32ca allow deprecation of classes/structs, deprecate Dictionary 2025-03-02 17:48:03 -03:00
Ricardo Luís Vaz Silva
35c44c7e21 don't allow backing types of string/array/map/etc to be referenced as actual types 2025-03-02 17:48:03 -03:00
Ricardo Luís Vaz Silva
e8b7a30a79 add better descriptive name for vectors/quats 2025-03-02 17:48:03 -03:00
Ricardo Luís Vaz Silva
6b8736fb30 rework how vector local type restrictions are managed 2025-03-02 17:48:03 -03:00
Ricardo Luís Vaz Silva
ad579a8e43 add unsafe clearscope, to allow declaring clearscope fields outside of gzdoom.pk3 2025-02-20 04:18:29 -03:00
Ricardo Luís Vaz Silva
7e86116ab1 make const actually work, and add unsafe(const) for old behavior 2025-02-20 04:18:29 -03:00
Boondorl
236c9b4224 Added FindClass
Allows for classes to be looked up during run time without having to use string casting.
2025-02-20 04:14:18 -03:00
marrub
9f6c1d65c5 add default cvar getters 2025-02-20 04:14:07 -03:00
Chronos Ouroboros
7d180069e3 Fix FxExpression::EmitCompare not properly handling constant registers. 2025-02-17 07:53:27 -03:00
Ricardo Luís Vaz Silva
bfd9b6f720 add static function to convert ints to names 2025-02-08 16:49:00 -03:00
Ricardo Luís Vaz Silva
fcc2fc65de change id type fixes version from 4.15 to 4.14.1 2025-02-08 10:56:55 -05:00
Ricardo Luís Vaz Silva
e543e26bdc expand deprecation allowance for gzdoom.pk3 2025-01-30 13:34:25 -03:00
Ricardo Luís Vaz Silva
61df13306f fix DScriptScanner 2025-01-11 09:31:20 -03:00
Rachael Alexanderson
f3b0c3ac5e
- Roll back filesystem changes. These were causing instabilities in the master branch that were interfering with development. 2025-01-04 11:27:21 -05:00
Ricardo Luís Vaz Silva
bdddfcc80a allow nullptr with spriteid/textureid/translationid (for default parameters/etc) 2024-12-21 04:33:25 -05:00
Ricardo Luís Vaz Silva
d36fa3c36b add helper methods to Sound/SpriteID/TranslationID 2024-12-21 04:33:25 -05:00
Ricardo Luís Vaz Silva
eefad0764e fix TranslationID casting 2024-12-21 04:33:25 -05:00
Ricardo Luís Vaz Silva
e82c7d2428 remove "DECORATE" from error string
* print warning count as well
* allow treating warnings as errors
2024-12-13 16:46:48 -03:00
Ricardo Luís Vaz Silva
325817afdf remove version check for array type fix, to prevent crashes/etc with bad types 2024-12-12 15:18:53 -05:00
Christoph Oelckers
d1abc3eb8c renamed things in file system to reduce Doom specific terminology. 2024-11-24 18:05:11 +01:00
Christoph Oelckers
634a646c2d take namespace enum out of namespace and added CheckNumForAnyName and CheckNumForFullNameInFile to clarify the meaning of CheckNumForFullName.
This is to take some renaming noise out of the upcoming refactoring.
2024-11-24 17:59:16 +01:00
Christoph Oelckers
ba2800d698 renamed GetFileFullName to GetFileName 2024-11-24 17:59:15 +01:00
Christoph Oelckers
e0778e23eb M_SaveDefaults is also not part of the common engine backend. 2024-11-23 20:39:23 +01:00
Boondorl
597b06ae52 Added CRandom functions
Unique RNG namespace for client-side effects and HUDs. Identifiers for these cannot clash with identifiers that affect the playsim making them completely safe to use in HUD elements. They also won't be saved.
2024-11-15 23:56:23 -03:00
Boondorl
d85d04f421 Fixed crash on functions with missing return values 2024-11-05 01:02:19 -05:00
Christoph Oelckers
a14bba3561 Check array size for overflow.
Since ZScript is a 32 bit VM, the largest safe value for an array's physical size is 2GB. Any larger value will be destroyed by the compiler which relies on signed 32 bit values too much.
2024-10-25 08:47:19 +02:00
Christoph Oelckers
ee6991e6d8 Do a check if a local variable exceeds the available stack space.
Windows stack is 1 MB so play it safe and allow 512 kb as max. stack space for a single function.
2024-10-25 07:55:17 +02:00