Commit graph

107 commits

Author SHA1 Message Date
Kevin Eady
686090d950
Introduce DAP Debugger (#608)
* Add cppdap debugger library and simple server (#508)

* Add cppdap library

* Add cppdap server

* fixup cmake scripts for windows

* Enable caching of cppdap on GitHub actions

* Fix CMake for cppdap target

* Wait 1s for session close before thread ends

* Address review comments
- Remove unnecessary use of wait_for
- Fix wait_for method

* Do not use SocketClientThread for cppdap clients

* Address review comments
- Cleanup object ownership

* Add authorization and event handling (#510)

* Add authorization and event handling [WIP]

* Use std::weak_ptr; Only allow one debugger conn

* Only attach debugger if dbg file exists

* Cleanup weak_ptr; Fix listeners; Add handler stubs

* Address review comments
- PolLock on uoexec and weakptr access
- Use make_shared when creating client thread

* Add ExecutorDebugListener on_destroy callback

* Use cppdap sockets instead of clib sockets

* Update cppdap repository to 2703cf4

* Implement server address binding

* Update cppdap repository to eeca5ce

* Fix warnings

* Use weak_from_this

* Fix stalled executors on disconnect

* Fix stalled executors on re-attach

* Clear uoexec weakptr on all debugger detaches

* Move server to gamestate

* move DapDebugServer into Network namespace

* move DapDebugServer into GameState for storage

* Move DapDebugServer into NetworkManager

* Fix missing memory include

* Add more events (#513)

* Add more events

* Implement dbg_step_out

* Fix breakpoint clearing

* Add even more events (#515)

* add launch request

* Add custom `processes` command

* fixup loop

* Refactoring to move handlers to member functions

* Add VariablesRequest and ScopesRequest

* use std::varaint for Handles

* add pollocks

* refactor Handles to new file

* move custom messages to proto.h

* move clientthread

* some formatting / cleanup

* Add missing PolLock

* move dap variables creation to Handles

* appobj members

* rename ClientThread to DebugClientThread

* rename LaunchRequest args to arg

* Fix compiler error on size_t

* Add support for EvaluateRequest and SetVariableRequest (#519)

* Update grammar for evaluateUnit

* Cleanup various compiler code

* Add support for EvaluateRequest
Only supports values, variables, element access, member access

* Add report clearing to reinitialize state

* Add support for SetVariableRequest

* Fix CI build errors

* Move ExpressionEvaluator to Bscript

* Fix formatting

* Fix include

* Refactor global and frame variable references

* Encapsulate Executor debugging environment; Fix step over (#524)

* Fix step over

* Some cleanup of executor
- Remove unused debug states
- Rename members for consistency

* move debugging environment to new class

* Move instruction inspection to class

* Cleanup slashes on Windows; Add Executor state to processes response (#527)

* Fix backspaces in script names on Windows

* Fix compilation warnings with data loss

* Use boost::icontains for string comparison

* Add Executor state to processes response

* Updates for libfmt

* Fix tests; Fix cppdap build for Mac universal binary (#607)

* fix tests

* fix cppdap build for mac universal binary

* Update cppdap to 2a4c7cf

* Add tests; Modify launch behavior to not stop at entry (redo) (#609)

* Remove unused setExceptionBreakpoints handler

* Add debugger tests

* Launching a script should not set attaching state

* Add launch tests

* Do not check for connection in debugger tests

* Rename `program` to `script` in protocol structs

* Fix launch stopAtEntry; quote string var values

* Fix compilation error on Windows

* Add configfiles doc entry

* Various fixes for finishing touches; Add core-changes (#610)

* switch cmake projects

* simple docs

* cmake move make_directory

* Fix launch request with relative, absolute, package paths

* make relative paths as absolute in source request

* Add true, false, uninit to ExpressionEvaluator

* Re-add setExceptionBreakpoints to avoid unhandled message errors

* Better debug thread logging with instance numbers

* launched scripts should terminate on disconnect (according to DAP spec)

* Properly handle exited event in client thread

* Add core-changes

* Address Discord comments
- Mention vscode-escript in core-changes
- Re-add "cppdap already built" in cmake

* change cmake escriptgrammarlib visibility to public
2024-01-28 09:49:55 +01:00
turleypol
d848deae18
POLLOG* macros use the new formatting (#598)
* POLLOG* macros use the new formatting
removed all old logging functions

* removed old fmt lib from everything except StreamWriter
removed unneeded functions

* fixed review comments
2024-01-16 17:55:42 +01:00
turleypol
154a68a9fd
LEAKLOG, DEBUGLOG, SCRIPTLOG, FLEXLOG changed to new logging (#597)
* LEAKLOG, DEBUGLOG, SCRIPTLOG changed to new logging

* updated FLEXLOG
2024-01-13 17:08:33 +01:00
turleypol
0e675c516a
use new formatter for ERROR_PRINT, added ERROR_PRINTLN (#595)
* use new formatter for ERROR_PRINT, added ERROR_PRINTLN

* remove old log define

* fix comments
2024-01-12 06:51:44 +01:00
turleypol
43b776b94d
New format lib version (#592)
* renamed include guard to be able to use both format lib versions in
parallel

* build Fmt lib and link it into clib

* use std::string instead of format Writer for logging
added variant "2" for logging with new fmt lib

* use new logging variant for two logs

* always add \n to flush log, lets see if the assumption holds

* use new lib for tostring

* replaced all INFO_PRINTS in clib

* formatter for Token, BObject and BObjectImp

* started with bsccript

* use function instead of actual object for logging

* remaining bscript, started plib

* logvariant without newline added, more template magic

* format support for base types, added test for format padding
new version for fdump

* chanhed ecompile/runecl fixed compilation with ESCRIPT_PROFILE

* rewrite INFO_PRINT in plib,poltool/uoconvert/uotool

* replaced remaining INFO_PRINTS, renamed macros INFO_PRINT for logging
without newline, INFO_PRINTLN for newline addition.
Replaced also INFO_PRINT_TRACE and renamed it to INFO_PRINTLN_TRACE

* gitignore for fmt lib

* cleanup vim leftovers
2024-01-10 18:29:10 +01:00
Kevin Eady
e05dfd7d6d
fix crash control script crash on destroyed item (#563) 2023-11-13 07:27:14 +01:00
turleypol
31780b070e
extended print and syslog with color support (#544)
* extended print and syslog with color support
needs linux or atleast windows11

* added pol.cfg setting to disable colored output

* added docs
2023-10-18 15:18:06 +02:00
Kevin Eady
e6c93ad709
Fix implementation of previous OpenConnection data race fix (#542) 2023-08-30 12:42:59 +02:00
Kevin Eady
2af4881042
Fix OpenConnection race condition (#540)
* Fix OpenConnection race condition

* Update core-changes
2023-08-28 19:46:23 +02:00
Kevin Eady
ccc6213c6f
Add ignore_line_breaks option to os::OpenConnection (#512)
* Add use_byte_reader option to OpenConnection

* Fix formatting

* fix incorrect param number

* Do not include on writes CRLF if using byte reader

* Rename to ignore_line_breaks

* Update docs

* Add core-changes
2023-03-20 19:54:39 +01:00
Kevin Eady
f892bf2ced
Add flag to os::HTTPRequest() for additional response data; Add http::WriteStatus() and http::WriteHeader() (#504)
* Add flag to HTTPRequest() for addl response data

* Add ability to change status and headers in www scripts

* Add tests for new webserver features

* Update docs and core-changes
2023-02-08 21:13:48 +01:00
turleypol
7ee1b64e19
replaced baseclass x,y,z,realm members with Pos4d. (#420)
* replaced baseclass x,y,z,realm members with Pos4d.
Adapted the code, no changes except making the compiler happy

* review changes

* Fixed gotten_item

* fixed copy&waste
2021-09-10 20:17:25 +02:00
turleypol
8b7ece1c18
Testclient (#390)
* first testclient version
fixed dangling pointer in openconnection
added option to keep connection alive

* movement tests
OpenConnection do not start socketclient on connection error
changed communication pkts between testclient and server
send every event to server from testclient

* add new item event
serialize method
check move position

* added openconnection docs

* test if the ci can fail to find python3

* explicit add python3

* added multiclient support

* debug logs

* more debug

* id out of sync?

* cleanup fixed typo

* transfer client id

* send todos to the correct brain

* addee core changes
2021-03-25 19:26:09 +01:00
turleypol
90b92f4002
Get environment variable/Extended Testsuite (#359)
* added os:GetEnvironmentVariable to list all environs or get a single one

* first version of restarting the core to test save/load
added environment variable to filter tests

* fixed string constructor (size_t instead of signed int)

* added string_view constructor

* splitted and extended restart tests

* added docs

* added pol.cfg setting to disallow environment variable access

* Change environmental variable access rules
Instead of defaulting to all values allowed, now defaults to none. May
specify either `*` to allow all variables, or a comma-delimited list.

* Address review changes
- Use Clib lower instead of boost
- const auto references
- Separate tests for access and finding env vars

* Update documentation

* Apply suggestions from code review

Co-authored-by: Kevin Eady <8634912+KevinEady@users.noreply.github.com>
Co-authored-by: Fernando Rozenblit <rozenblit@gmail.com>
2021-02-27 08:36:22 +01:00
turleypol
6d73472029
Testsuite reorganization, new feature to call exported functions (#237)
* restructured pol testscripts
pkg based (dedicated pkgroot)
runs per pkg:
setup.ecl if exists
all scripts starting with "test"
cleanup.ecl if exists

return 1 for success everything else is an error

* Scripts can now be loaded and exported functions called
adapted testscripts to use this feature
critical script handling missing

* added support for used in critical scripts

* use weakptr instead of pid
moved keep_alive flag to uoexecutor

* Function and nethod accept now a argument list

* added docs

* missing docs

* faster shutdown time

* fixed typo

* fixed weird cornercase

* shorter test functions names, the length is limited, renamed
loadexported test script to have a dedicated testscript

* generate tiledata/multi for small boat
added generate scripts for generation..
adapted testdata set

* boat tests

* extended scripttests
scheduler will now always know about the loaded script
secured scheduler api

* cleanuo scripts for boat and npc

* shorter function for error return
fixed cleanup: npcs have gravestones, chars was one off and scripted
create of a char made it permanent logged in (until next restart),
which also means that it cannot be deleted

* bypass windows specific ecompile.cfg logic

* fix for parallel execution

* on windows its called .exe ..

* use target binary directly, so cmake can replace it with the actual path
use absolute path to testsuite
disabled temporary the copy of ecompile

* configure ecompile.cfg to add absolute path

* early sleepms calls can lead to endless waiting

* Code coverage (#260)

* play with coverage reports

* fix yml

* use 0 as default for gcov cmake var

* fixed used cov version, hopefully fixed now cmake

* demangle function names

* removed debug msg

* added a few polcore tests (basically just for coverage)
first set executor to noncritical before blocking

* added https://coveralls.io/github/polserver/polserver

* added a stackable item
added a few backpack insert tests
do coverage build only on push events not also for PR merge builds

* added storage tests..
docs need fixes, the Imps are not working at all

* fixed storage test to really move items

* added a house
corrected static/dynamic flag
created a few house tests

* updated yml file to new github api

* corrected coverage discord job name

* always put to runlist even if not necessary

* extended aos prop tests

* equip/unequip aos mod

* extra ci step for shard test fixtures and activated verbose shard test

* use extra ci step for all build configs, sorted testscripts for
execution

* fixed sorting

* added param to syslog to not print the context (cleaner testscript
visualization)

* added build targets for tests

* sleep api cleanup

* more aos property tests

* build for coveralls also on pullrequest

* readded debug state reset on schedule

* updated checkout ci action

* updated checkout in all ci runs
2020-12-16 18:56:10 +01:00
Fernando Rozenblit
cbadd96b49
General cleanup of module includes (#253)
1) Made all module methods [[nodiscard]]. Glad to report no leaks were found. We should add the same to BObjects.

2) Protected members of NPCExecutorModule (were public before).
3) Added NPCExecutorModule::controlled_npc() so that osmod can access the npc's name and position.

4) Removed declarations for undefined functions:
- attributemod.h: mf_SetAttributeIntrinsicMod()
- osmod.h: mf_System_RPM()
- vitalmod.h: mf_SetVitalMaximumValue() and mf_SetVitalRegenRate()
2020-08-29 11:35:13 +02:00
Kevin Eady
12d6186d10
Script option enhancements (#118)
* Fix SCRIPTOPT_CAN_ACCESS_OFFLINE_MOBILES

* Add SCRIPTOPT_SURVIVE_ATTACHED_DISCONNECT

* wip beginning work on templatization

* Use PolModule in pol-specific modules

* wip, creating PolModule with getXYZParam

* wip 1, moving getXYZ to UOExecutor

* compilable with PolObjectImp / PolApplicObj

* add type guard

* wip, change signatures

change signatures of script_method, script_method_id, and
custom_script_method

* compilable (windows)

* linux fixes

* namespace fixes

* remove uoexhelp

* formatting

* compilable

- move can_access_offline_mobiles back to uoexec
- add guildscrobj and partyscrobj sources
- move EGuildRefObjImp and EPartyRefObjImp
- wip, implement asUOExec
- formatting uoexec.cpp,.h

* finish uoexec() helper

* some cleanup
2020-02-08 09:21:35 +01:00
turleypol
7e8f92bc85 rewrote module function generation, maybe this works 2019-11-10 22:04:08 +01:00
Kevin Eady
ca850a0c76 project refactoring 2019-10-18 21:32:30 +02:00
Kevin Eady
5c0fb7c4ea First support for .em-parsed module function tbls
- Create module parser custom target
- Include generated tables in .cpp sources
- Standardize module function names based off .em names
2019-10-17 22:37:26 +02:00
Kevin Eady
b55e852a5b wip 1 2019-10-17 19:08:49 +02:00
Fernando Rozenblit
818c06af96 GetProcess(-1) will now return the script pid. GetProcess(0) will not find any script, as before. For this change, script pids had to be constrained to the range of valid signed ints. Please update your .em's and recompile. 2019-09-30 23:49:31 +02:00
turleypol
ee046a9904 os::HttpRequest can handle now compressed responses.
Added todo line that no sanitize happens for this method. Lets wait
until the first one has problems. Optional param maybe or check the
response header.
2019-09-04 17:50:14 +02:00
Jonathan Morland-Barrett
a31f1d509b Added error for if NaN sent as PID 2019-08-22 14:12:01 +08:00
Jonathan Morland-Barrett
35535a220a Fix for GetProcess() not actually loading the parent PID. 2019-08-22 07:42:08 +08:00
GIB
d8911acc72
Hotfix/start skill script (#90)
* Update os.em file so that script parameter is passed as a string by default instead of int.
Updated docs for start_skill_script to be clearer what is being asked for, and reflect changes to os.em
Modified script param check to also check the string length.
2019-06-17 21:23:57 +08:00
Fernando Rozenblit
f4f9c20afd Merge branch 'master' into network-improvements 2019-04-26 20:33:27 +02:00
Kevin Eady
f5fad28cf7 Reorder initializers 2019-03-15 01:11:59 +01:00
Kevin Eady
44f2ebbe90 Refactor to make os_module private in UOExecutor 2019-03-11 21:37:51 +01:00
Fernando Rozenblit
bc79dc046e Moved basic network files to clib 2019-03-04 21:41:27 +01:00
turleypol
1ae8963db9 Socket is now a only moveable type (like it always was)
cleanup connect api
2019-02-23 21:30:20 +01:00
Fernando Rozenblit
0c077678df Removed option "Multithread" from pol.cfg. POL for a long time has defaulted to using multiple threads. 2019-02-22 19:24:23 +01:00
turleypol
395083a31c memoryestimation did not add the module cost per executor
added EstimateSize util.em function returns estimated memorysize in
bytes of given argument. (docs to be done)
2019-02-01 23:18:43 +01:00
turleypol
9cfb4ec5a5 moved pkt headers into network folder 2018-12-30 21:35:54 +01:00
turleypol
3e656ed5f8 fixed all gcc/clang warnings which where disabled 2018-10-31 15:40:25 +01:00
esdete
dc2d29b433 NULL to nullptr 2018-07-31 14:30:29 +02:00
Gabriele Tozzi
b72f725e02 Whitespace fixes 2018-04-03 04:13:03 +02:00
turleypol
3afc41241b
CMake on windows (#48)
CMake can now also be used for windows
2018-02-24 22:34:55 +01:00
turleypol
dbb25bdb62
Include and buildsystem cleanup (#45)
Include cleanup
Reworked buildsystem (Linux only)
Removed dynamic libs, Linux now again uses static linking (like windows)
2018-01-29 21:55:48 +01:00
turley
414b53252f Fixed a few warnings 2018-01-03 15:18:47 +01:00
turleypol
5ed9973f0f fixed memleak 2018-01-03 12:30:23 +01:00
turleypol
ceb8a32fb4 Merge remote-tracking branch 'origin/master' into curl
* origin/master:
  fixed windows build due to missing header
  Cleanup of header includes.
2018-01-01 23:00:51 +01:00
turleypol
798eda5b63 Cleanup of header includes. 2018-01-01 21:52:14 +01:00
turleypol
4c804b4702 format httprequest method
removed unneeded dependency for poltool/uoconvert
2018-01-01 00:45:48 +01:00
Kevin Eady
517fe81314 Merge master and resolve conflicts 2017-12-28 18:15:55 +01:00
Kevin Eady
ff253776d3 Changes from review 2017-12-28 17:31:59 +01:00
Kevin Eady
ef5562f25c Initial implementation of libcurl support 2017-12-27 21:46:13 +01:00
turleypol
35a156dd20 added os::PerformanceMeasure() can be used to find scripts which slow
the server down.
2017-12-23 21:21:04 +01:00
turleypol
37ec763c81 format sources 2017-10-21 18:12:38 +02:00
turleypol
63a3979b2f activated for ingoing auxconnections the threadpool
fixed initialization order of AuxClientThread
do not let members uninitialized in AuxClientThread
some minor tunings
2017-10-21 18:07:46 +02:00