Commit graph

19262 commits

Author SHA1 Message Date
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
Timothy Flynn
0764a68616 LibSQL: Parse UPDATE statement
This also migrates parsing of conflict resolution to a helper method,
since both INSERT and UPDATE need it.
2021-04-24 14:22:08 +02:00
Timothy Flynn
8d79b4a3e1 LibSQL: Parse INSERT statement
This also adds missing '&' on a couple AST getter methods.
2021-04-24 14:22:08 +02:00
Timothy Flynn
35f0450dd8 LibSQL: Add missing forward declarations 2021-04-24 14:22:08 +02:00
Brendan Coles
0252563a4e Utilities: Add cksum 2021-04-24 11:53:55 +02:00
Brendan Coles
e0188d27de Utilities: Add pathchk 2021-04-24 11:48:57 +02:00
Brendan Coles
ac98dc4f7c AudioServer: Mixer: limit max volume to 200% 2021-04-24 01:30:10 +02:00
Jelle Raaijmakers
2a0f92ef1f Ports/scummvm: Add launcher 2021-04-24 00:17:47 +02:00
Gunnar Beutner
f74b8a2d1f LibELF: Avoid calculating symbol hashes when we don't need them 2021-04-23 23:35:36 +02:00
Hendiadyoin1
39d34fb1f1 UE: Implement FLD_RM80 and FSTP_RM80
We do a bit too big reads and writes, but this should not be that bad
although it may taint memory graphs
2021-04-23 22:50:53 +02:00
Hendiadyoin1
f1957bb86b UE+LibX86: Support bigger reads and writes 2021-04-23 22:50:53 +02:00
Hendiadyoin1
a99812633b LibX86: Add basic u128 and u256 constainers
These support all bitwise operations
2021-04-23 22:50:53 +02:00
Timothy Flynn
fa59d02692 LibSQL: Parse IN / NOT IN expressions with a nested SELECT statement 2021-04-23 22:36:07 +02:00
Timothy Flynn
004025c3c4 LibSQL: Parse common-table-expressions with a nested SELECT statement
This also moves testing of common-table-expression to its own test case.
2021-04-23 22:36:07 +02:00
Timothy Flynn
cb943a2179 LibSQL: Parse CREATE TABLE statements with a nested SELECT statement 2021-04-23 22:36:07 +02:00
Timothy Flynn
99b38aa3fa LibSQL: Parse EXISTS expressions
The EXISTS expression is a bit of an odd-man-out because it can appear
as any of the following forms:

    EXISTS (select-stmt)
    NOT EXISTS (select-stmt)
    (select-stmt)

Which makes it the only keyword expression that doesn't require its
keyword to actually be used. The consequence is that we might come
across an EXISTS expression while parsing another expression type;
NOT would have triggered a unary operator expression, and an opening
parentheses would have triggered an expression chain.
2021-04-23 22:36:07 +02:00
Timothy Flynn
e62e76ca1a LibSQL: Parse terminating semi-colon in top-level statement parser
Currently, every parse_*_statement method ends by parsing a semi-colon.
This will prevent nested statements, e.g. a SELECT statement may be
nested in a CREATE TABLE statement. Move the semi-colon expectation up
and out of the individual statement parsers.
2021-04-23 22:36:07 +02:00
Timothy Flynn
27685bc799 LibSQL: Add Parser::parse_schema_and_table_name helper
Another common semantic is parsing an identifier of the form
"schema_name.table_name" / "table_name". Add a helper to do this work.

This helper does not parse any optional alias after the table name.
some syntaxes specify an alias using the AS keyword, some let the AS
keyword be optional, and others just parse it as an identifier. So
callers to this helper will just continue parsing the alias however
they require.
2021-04-23 22:36:07 +02:00
Timothy Flynn
418884ab64 LibSQL: Add Parser::parse_comma_separated_list helper
A quite common semantic emerged for parsing comma-separated expressions:

    consume(TokenType::ParenOpen);

    do {
        // do something

        if (!match(TokenType::Comma))
            break;

        consume(TokenType::Comma);
    } while (!match(TokenType::Eof));

    consume(TokenType::ParenClose);

Add a helper to do the bulk of the while loop.
2021-04-23 22:36:07 +02:00