Commit graph

19280 commits

Author SHA1 Message Date
Gunnar Beutner 5911d379a6 Ports: Update checksums to use the SHA256 algorithm 2021-04-25 13:30:18 +02:00
kleines Filmröllchen d77e7e99e4 Piano: Add track Volume and improve QOL
This patch implements a couple of enhancements to the synthesizer
engine:

* Each track has a volume control.
* The input and tooltips for all controls are improved.
* The noise channel is pitched, which allows for basic drum synthesis.
2021-04-25 11:30:41 +02:00
Andreas Kling 418bc484e4 Revert "IPCCompiler: Use string hashes for IPC endpoint magic"
This reverts commit 59218007a3.
2021-04-25 11:24:12 +02:00
sin-ack 53aec3e06d LibGUI: Implement Vim motion system
This patch implements Vim motions.  The VimMotion class will accept
keycodes from the editing engine to build up a motion, and will
signal when a motion is complete via VimMotion::is_complete().  The
editing engine can then call VimMotion::get_range() to obtain a
TextRange object which can be used to perform operations on the text,
or VimMotion::get_position() to obtain a TextPosition which is the
new position of the cursor after the motion.

Currently, the following motions are supported:

- h/j/k/l, regular Vim line and character movements
- 0/^/$, start/end of line and start of non-blank
- w/e/b/ge, word-related movements
- W/E/B/gE, WORD (anything non-blank) versions of the above motions
- gg/G, document related movements
- t/f, to/find character

All motions except gg/G accept a number prefix to repeat the motion that
many times.

This patch updates insert, normal and visual modes to use this motion
system for movement.
2021-04-25 10:41:16 +02:00
sin-ack bb096429ad Tests: Remove 4chan catalog JSON from tree
According to kling, it was "an early stress test for the JSON decoder"
and can be removed now.
2021-04-25 10:15:15 +02:00
Gunnar Beutner 5b69e8d2c6 Ports: Build shared libraries with -Wl,-soname
Without a SONAME gcc will put the whole library path into executables
which link against these libraries:

$ readelf -d Root/usr/local/games/openttd

Dynamic section at offset 0xf0747c contains 32 entries:
 Tag        Type     Name/Value
0x00000001 (NEEDED) [libgcc_s.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/libpng.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/libz.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/liblzma.so]
0x00000001 (NEEDED) [libSDL2-2.0.so.1]
0x00000001 (NEEDED) [libicui18n.so.69]
0x00000001 (NEEDED) [libicuuc.so.69]
0x00000001 (NEEDED) [libicudata.so.69]
0x00000001 (NEEDED) [libpthread.so]
0x00000001 (NEEDED) [libm.so]
0x00000001 (NEEDED) [libc.so]

This causes the executable to fail because the dynamic linker
tries to find the library in the incorrect path.
2021-04-25 10:14:50 +02:00
Gunnar Beutner e6953d14d8 Toolchain: Update cmake platform definition
This fixes building cmake and other ports which use cmake
to detect whether we have -ldl.
2021-04-25 10:14:50 +02:00
Gunnar Beutner 6a825510a0 Ports: Fix detection for -ldl 2021-04-25 10:14:50 +02:00
Gunnar Beutner adaf2b347c Ports: Remove obsolete patches for Python
This enables shared library support for Python and removes
a few patches which are not necessary anymore now that
we have dlfcn support.
2021-04-25 10:14:50 +02:00
Gunnar Beutner f40ee1b03f LibC+LibELF: Implement more fully-features dlfcn functionality
This implements more of the dlfcn functionality. Most notably:

* It's now possible to dlopen() libraries which were already
  loaded at program startup time. This does not cause those
  libraries to be loaded twice.
* Errors are reported via dlerror() rather than by crashing
  the program.
* Calls to the dl*() functions are thread-safe.
2021-04-25 10:14:50 +02:00
Gunnar Beutner 549d9bd3ea LibC: Move the __pthread_mutex_trylock function to LibC
Let's move this to LibC because the dynamic loader depends
on this function.
2021-04-25 10:14:50 +02:00
Hendiadyoin1 acd65a5f86 UserspaceEmulator: Add more Instructions
Adds:
* CMC
* POPA
* POPAD
* POPF
* PUSHA
* PUSHAD
* PUSHF
* PUSH_RM16
* SAHF
* FPU:
  * FNOP
  * FPREM
  * FSINCOS
  * FCMOVxx
  * FISTTP
2021-04-25 09:56:29 +02:00
Gunnar Beutner cfa095b44a Port: Add port for tcl 2021-04-25 09:54:39 +02:00
Gunnar Beutner 2447dcd1ea LibC: Implement the rewinddir() function 2021-04-25 09:54:39 +02:00
Brian Gianforcaro 8d6e9fad40 Kernel: Remove the now defunct LOCKER(..) macro. 2021-04-25 09:38:27 +02:00
Brian Gianforcaro 0d5827f865 Kernel: Remove the now defunct RESTORE_LOCK(..) macro. 2021-04-25 09:38:27 +02:00
Brian Gianforcaro 04156d53ca Kernel: Utilize AK::SourceLocation for LOCK_DEBUG instrumentation.
The previous `LOCKER(..)` instrumentation only covered some of the
cases where a lock is actually acquired. By utilizing the new
`AK::SourceLocation` functionality we can now reliably instrument
all calls to lock automatically.

Other changes:
- Tweak the message in `Thread::finalize()` which dumps leaked lock
  so it's more readable and includes the function information that is
  now available.

- Make the `LOCKER(..)` define a no-op, it will be cleaned up in a
  follow up change.
2021-04-25 09:38:27 +02:00
Brian Gianforcaro 87724b3d09 AK: Add default constructor to SourceLocation 2021-04-25 09:38:27 +02:00
Brian Gianforcaro c248bbc7fd Kernel: Add lock_count to procfs$all when LOCK_DEBUG is enabled. 2021-04-25 09:38:27 +02:00
Brian Gianforcaro 7481789eac Kernel: Fix LOCK_DEBUG feature to work again
- UBSAN detected cases where we were calling thread->holding_lock(..)
  but current_thread was nullptr.

- Fix Lock::force_unlock_if_locked to not pass the correct ref delta to
  holding_lock(..).
2021-04-25 09:38:27 +02:00
Andrew Kaster 35c0a6c54d AK+Userland: Move AK/TestSuite.h into LibTest and rework Tests' CMake
As many macros as possible are moved to Macros.h, while the
macros to create a test case are moved to TestCase.h. TestCase is now
the only user-facing header for creating a test case. TestSuite and its
helpers have moved into a .cpp file. Instead of requiring a TEST_MAIN
macro to be instantiated into the test file, a TestMain.cpp file is
provided instead that will be linked against each test. This has the
side effect that, if we wanted to have test cases split across multiple
files, it's as simple as adding them all to the same executable.

The test main should be portable to kernel mode as well, so if
there's a set of tests that should be run in self-test mode in kernel
space, we can accomodate that.

A new serenity_test CMake function streamlines adding a new test with
arguments for the test source file, subdirectory under /usr/Tests to
install the test application and an optional list of libraries to link
against the test application. To accomodate future test where the
provided TestMain.cpp is not suitable (e.g. test-js), a CUSTOM_MAIN
parameter can be passed to the function to not link against the
boilerplate main function.
2021-04-25 09:36:49 +02:00
Andrew Kaster 89ee38fe5c Tests: Add environment variable for tests only
This is useful for CI where we don't want to spend a minute and a half
benchmarking Vector::append, and we don't have a good way to pass
test-specific arguments yet. :)
2021-04-25 09:36:49 +02:00
Rok Povsic 77d4b6e435 VimEditingEngine: Add handling { and } to move between empty lines 2021-04-25 09:34:51 +02:00
Brian Gianforcaro f8fffe4613 LibWeb: Utilize SourceLocation for HTMLDocumentParser logging 2021-04-25 09:32:03 +02:00
Brian Gianforcaro 6d69c97b99 LibWeb: Utilize SourceLocation for HTMLTokenizer logging 2021-04-25 09:32:03 +02:00
Brian Gianforcaro 1411ae1bc7 LibWeb: Utilize SourceLocation for CSS/Tokenizer logging 2021-04-25 09:32:03 +02:00
Brian Gianforcaro 46524426fb LibWeb: Utilize SourceLocation for CSS/Parser logging 2021-04-25 09:32:03 +02:00
Brian Gianforcaro 4022d3cb75 LibWeb: Use SourceLocation for DeprecatedCSSParser logging. 2021-04-25 09:32:03 +02:00
Brian Gianforcaro 7a73f11005 LibCpp: Convert ScopeLogger to use AK:SourceLocation
Utilize AK::SourceLocation to get function information into
the scope logger, instead of relying on pre-processor macros.
2021-04-25 09:32:03 +02:00
Brian Gianforcaro 357a13b404 AK: Add a AK::Formatter implementation for AK::SourceLocation 2021-04-25 09:32:03 +02:00
Idan Horowitz b42bfa75d8 Meta: Allow for spaces in commit title category linter 2021-04-25 09:30:12 +02:00
sin-ack 59218007a3 IPCCompiler: Use string hashes for IPC endpoint magic
This patch removes the IPC endpoint numbers that needed to be specified
in the IPC files.  Since the string hash is a (hopefully) collision free
number that depends on the name of the endpoint, we now use that
instead. :^)
2021-04-25 09:29:49 +02:00
Gunnar Beutner f89c60664c Ports: Fix building openssh
This fixes a spelling mistake in the timespeccmp() macro and
enables debug symbols for OpenSSH to make diagnosing problems
easier.
2021-04-25 09:28:21 +02:00
Brian Gianforcaro 898e9492f7 Base: clang-format the cpp-gui template project.
I noticed this was miss-formated when fixing up the clang-format
error in a different PR. I just ran `pre-commit run --all-files`
2021-04-25 01:13:59 +02:00
Brian Gianforcaro 0398e4a48a Ports: Fix python3 package so linting script doesn't error out.
I have my environment configured to use https://pre-commit.com/.
I guess the scripts were changed recently to lint all ports, and
the python port was barfing on my system because of this bug.
2021-04-25 00:57:36 +02:00
Jelle Raaijmakers 4c26e318a3 Ports: Pass along any command arguments in package.sh
Commit b3db01e20 broke simple commands without arguments like:

  ./package.sh clean

Now, all available arguments are passed along, even if there are none.
2021-04-25 00:38:27 +02:00
Jelle Raaijmakers 54f5b1346c Kernel: Support null act argument for sigaction syscall
Userspace can provide a null argument for the `act` argument to the
`sigaction` syscall to not set any new behavior. This is described
here:

https://pubs.opengroup.org/onlinepubs/007904875/functions/sigaction.html

Without this fix, the `copy_from_user(...)` invocation on `user_act`
fails and makes the syscall return early.
2021-04-24 23:00:28 +02:00
Brian Gianforcaro 0ad29bc3c9 AK: Add SourceLocation support
C++20 added std::source_location, which lets you capture the
callers __FILE__ / __LINE__ / __FUNCTION__ etc as a default
argument to functions.
See: https://en.cppreference.com/w/cpp/utility/source_location

During a bug investigation @ADKaster suggested we could use this
to make the LOCK_DEBUG feature of the kernel more user friendly
and allow it to automatically instrument all call sites.

We then implemented / tested it over discord. :^)

Co-Authored-by: Andrew Kaster <andrewdkaster@gmail.com>
2021-04-24 20:33:00 +02:00
Linus Groh b0faf2287a LibJS: Use linusg@serenityos.org for my new copyright headers, too
Whoops, I have a new email for these! :^)
2021-04-24 20:16:31 +02:00
Linus Groh 62c7608a25 LibJS+LibWeb: Move exception logging and remove should_log_exceptions
LibWeb is now responsible for logging unhandled exceptions itself,
which means set_should_log_exceptions() is no longer used and can be
removed. It turned out to be not the best option for web page exception
logging, as we would have no indication regarding whether the exception
was later handled of not.
2021-04-24 20:11:04 +02:00
Linus Groh 08373090ae LibJS: Add VM::on_call_stack_emptied callback
Instead of having to run queued promise jobs in LibWeb in various
places, this allows us to consolidate that into one function - this is
very close to how the spec describes it as well ("at some future point
in time, when there is no running execution context and the execution
context stack is empty, the implementation must [...]").

Eventually this will also be used to log unhandled exceptions, and
possibly other actions that require JS execution to have ended.
2021-04-24 20:11:04 +02:00
Linus Groh 97d49cb92b LibJS: Consolidate exception function names and source ranges
Instead of storing the function names (in a badly named Vector<String>)
and source ranges separately, consolidate them into a new struct:
TracebackFrame. This makes it both easier to use now and easier to
extend in the future.
Unlike before we now keep each call frame's current node source range
in the traceback frame next to the function name, meaning we can display
line and column numbers outside of the VM and after the call stack is
emptied.
2021-04-24 20:11:04 +02:00
Linus Groh 0cf04d07aa LibJS: Temporarily clear exception in Object::get_without_side_effects()
This would return an empty value once it hits an exception check
otherwise. Considering that this mostly is used in situations where we
already *do* have an exception (traceback printing, for example), let's
make this easier for ourselves to use.
2021-04-24 20:11:04 +02:00
Linus Groh 5caab0148c LibJS: Add TemporaryClearException helper class
This is very similar to AK::TemporaryChange (and in fact replaces one
use of it), but since we can't directly set VM's m_exception from
outside of the VM, we need something more sophisticated.
Sometimes we need to temporarily remove the stored exception for some
other operation to succeed (e.g. anything that uses call(), as well as
get_without_side_effects()) and later restore it - the boilerplate code
required for this is annoying enough to justify a helper.
2021-04-24 20:11:04 +02:00
Andreas Kling 3a4d42bbbb LibJS: Remove stray '%' from MemberExpression AST dump 2021-04-24 18:50:12 +02:00
Andreas Kling 8ebb9d350c LibGUI: Remove some unused cruft from GUI::IconView 2021-04-24 18:50:12 +02:00
Albert S 89a9d8f45c LaunchServer: Fix argument order to FileManager
Correct the order we pass the arguments to the FileManager so
opening file:// URLs works.

The path is a positional argument that was passed after the flags.
We need to make sure the flags are passed before positional arguments.
2021-04-24 17:55:04 +02:00
Mart G 157cd7c819 LibGUI: Prevent a Painter's clip_rect from being outside of its target
Previously a Painter's m_clip_origin field was initialized to a
widget's window_relative_rect, which is not ensured to be within
the target rect.
m_clip_origin is normally not used for clipping, but after calling
clear_clip_rect the clip rect that IS used for clipping gets reset
to m_clip_origin (so an invalid state is entered).
Now the window_relative_rect will be clipped by the target rect
first, and will only then be used to initialize both the active
clip_rect and m_clip_origin.
2021-04-24 15:57:20 +02:00
Linus Groh 0754280214 Meta: Add Tim Flynn to the contributors list :^) 2021-04-24 14:34:18 +02:00
Timothy Flynn 1500479a1d LibSQL: Parse ALTER TABLE statement
There are 4 forms an ALTER TABLE statement can take, and each are very
distinct, so they each get their own AST node class.
2021-04-24 14:22:08 +02:00