Commit graph

703 commits

Author SHA1 Message Date
Itamar
be81278634 HackStudio: Use ProjectBuilder to build and run the current project
This enables building and running standalone serenity components from
Hack Studio :^)
2022-01-12 14:55:19 +01:00
Itamar
bb6324a9a9 HackStudio: Add ProjectBuilder component
ProjectBuilder takes care of building and running the current project
from Hack Studio.

The existing functionality of building javascript and Makefile projects
remains, and in addition to it the ability to build standalone serenity
components is added.

If the Hack Studio project is the serenity repository itself,
ProjectBuilder will attempt building the component that the currently
active file belongs to.

It does so by creating a new CMake file which adds the component as a
build subdirectory.
It also parses all CMake files in the serenity repository to gather all
available libraries. It declares the libraries and their dependencies in
this CMake file.

It then uses the HACKSTUDIO_BUILD CMake option to direct the build
system to use this CMake file instead of doing a full system build.
2022-01-12 14:55:19 +01:00
Itamar
afb4c447b4 HackStudio: Add optional parameters to TerminalWrapper::run()
The optional parameters allow specifying a working directory and
controlling whether or not to block until the command returns.
2022-01-12 14:55:19 +01:00
Itamar
3afd17db9d HackStudio: Add Project::project_is_serenity() function 2022-01-12 14:55:19 +01:00
Itamar
fbdd6df185 LibCore: Make Core::command return CommandResult struct
Previously, Core::command only returned a String which contained the
data from stdout.

The CommandResult struct contains the exit code as well as the data
from stdout and stderr.
2022-01-12 14:55:19 +01:00
Daniel Bertalan
182016d7c0 Kernel+LibC+LibCore+UE: Implement fchmodat(2)
This function is an extended version of `chmod(2)` that lets one control
whether to dereference symlinks, and specify a file descriptor to a
directory that will be used as the base for relative paths.
2022-01-12 14:54:12 +01:00
creator1creeper1
d4484f4de3 HackStudio: Propagate errors using try_set_main_widget
The documentation tooltip and parameters hint tooltip initialization
functions are now fallible and now call try_set_main_widget
instead of set_main_widget. They are only called by Editor's new
custom try_create function.
2022-01-09 00:56:11 +01:00
creator1creeper1
4c0b8a70e2 HackStudio: Propagate errors using try_set_main_widget in main 2022-01-09 00:56:11 +01:00
creator1creeper1
cb3a643f35 Inspector: Propagate errors using try_set_main_widget in main 2022-01-09 00:56:11 +01:00
Rummskartoffel
1b8012e5c7 UserspaceEmulator: Fail with EINVAL for mmap with size 0
This is the behaviour specified by POSIX and also the behaviour of the
real kernel, so let's follow that while emulating.
2022-01-08 23:43:09 +01:00
Rummskartoffel
89502fc329 UserspaceEmulator: Interpret zero-alignment as page-sized alignment
This commit fixes an issue where zero-alignment would lead to the
requested range being allocated outside of the total available range,
hitting an assert in RangeAllocator::allocate_anywhere().
2022-01-08 23:43:09 +01:00
Linus Groh
eb60d16549 LibJS: Convert Interpreter::run() to ThrowCompletionOr<Value>
Instead of making it a void function, checking for an exception, and
then receiving the relevant result via VM::last_value(), we can
consolidate all of this by using completions.

This allows us to remove more uses of VM::exception(), and all uses of
VM::last_value().
2022-01-08 23:43:03 +01:00
mjz19910
10ec98dd38 Everywhere: Fix spelling mistakes 2022-01-07 15:44:42 +01:00
mjz19910
3102d8e160 Everywhere: Fix many spelling errors 2022-01-07 10:56:59 +01:00
Ben Wiederhake
8b8cd18482 HackStudio: Avoid unnecessary copies in CodeComprehensionEngine 2022-01-01 15:40:39 +01:00
Conor Byrne
14b2656107 HackStudio: Use String instead of LexicalPath
LexicalPath is a 'heavier' object than a String that is mainly used for
path parsing and validation, we don't actually need any of that in
GitRepo and its related files, so let's move to String :^)

I've also done some east-const conversion in the files that I was
editing for the string change.
2022-01-01 14:47:23 +01:00
Conor Byrne
4cfc992125 HackStudio: Add new multiline commit dialog
This new commit dialog features multi-line input and a line and column
indicator. A great improvement over the last one, if you ask me! :^)
2022-01-01 14:47:23 +01:00
Conor Byrne
507ad1954f HackStudio: Fix crash when clicking unstaged files
In certain cases, an index might be invalid in the unstaged files view.
We must check if this index is valid before attempting to read the
index's data.
2021-12-31 14:12:54 +01:00
Timothy Flynn
565a880ce5 Userland: Link directly against LibUnicodeData where needed
This is partially a revert of commits:
    10a8b6d411
    561b67a1ad

Rather than adding the prot_exec pledge requried to use dlopen(), we can
link directly against LibUnicodeData in applications that we know need
that library.

This might make the dlopen() dance a bit unnecessary. The same purpose
might now be fulfilled with weak symbols. That can be revisted next, but
for now, this at least removes the potential security risk of apps like
the Browser having prot_exec privileges.
2021-12-30 14:18:12 +01:00
Stephan Unverwerth
1c3a82d59e Profiler: Extract percentage gradient calculation into its own file 2021-12-28 23:17:24 +01:00
Stephan Unverwerth
ddccf451a9 Profiler: Make everything east-const :^) 2021-12-28 23:17:24 +01:00
Stephan Unverwerth
cf8427b7b4 Profiler: Add source code view
This adds a new view mode to profiler which displays source lines and
samples that occured at those lines. This view can be opened via the
menu or by pressing CTRL-S.

It does this by mapping file names from DWARF to "/usr/src/serenity/..."
i.e. source code should be copied to /usr/src/serenity/Userland and
/usr/src/serenity/Kernel to be visible in this mode.

Currently *all* files contributing to the selected function are loaded
completely which could be a lot of data when dealing with lots of
inlined code.
2021-12-28 23:17:24 +01:00
Daniel Bertalan
4e1898df99 UserspaceEmulator: Exclude special ranges from RangeAllocator
If we do not mark these ranges as reserved, RangeAllocator might later
give us addresses that overlap these, which then causes an assertion
failure in the SoftMMU.  This behavior led to recurring CI failures, and
sometimes made programs as simple as `/bin/true` fail.

Fixes "Crash 1" reported in #9104
2021-12-28 19:28:13 +02:00
Maciej
6cfa58c7f3 HackStudio: Highlight AF files as INI 2021-12-28 11:36:12 +01:00
Conor Byrne
cc1b2b95f7 HackStudio: Ask to create a non-existent directory when making a project
Previously, if the parent directory didn't exist when making a project,
it would say that the creation directory was 'invalid' which isn't
necessarily true.

This patch prompts the user to ask if they would like to create the
parent directory when creating a project, instead of treating it as an
'invalid' directory.
2021-12-27 23:20:54 +01:00
Daniel Bertalan
8e3d1a42e3 Kernel+UE+LibC: Store address as void* in SC_m{re,}map_params
Most other syscalls pass address arguments as `void*` instead of
`uintptr_t`, so let's do that here too. Besides improving consistency,
this commit makes `strace` correctly pretty-print these arguments in
hex.
2021-12-23 23:08:10 +01:00
Daniel Bertalan
77f9272aaf Kernel+UE: Add MAP_FIXED_NOREPLACE mmap() flag
This feature was introduced in version 4.17 of the Linux kernel, and
while it's not specified by POSIX, I think it will be a nice addition to
our system.

MAP_FIXED_NOREPLACE provides a less error-prone alternative to
MAP_FIXED: while regular fixed mappings would cause any intersecting
ranges to be unmapped, MAP_FIXED_NOREPLACE returns EEXIST instead. This
ensures that we don't corrupt our process's address space if something
is already at the requested address.

Note that the more portable way to do this is to use regular
MAP_ANONYMOUS, and check afterwards whether the returned address matches
what we wanted. This, however, has a large performance impact on
programs like Wine which try to reserve large portions of the address
space at once, as the non-matching addresses have to be unmapped
separately.
2021-12-23 23:08:10 +01:00
Daniel Bertalan
143dbba562 UserspaceEmulator: Replace intersecting ranges if MAP_FIXED is specified
This commit changes UserspaceEmulator to match the behavior that the
kernel has since ce1bf37.
2021-12-23 23:08:10 +01:00
Hendiadyoin1
6d14940053 Profiler: Use AK::any_of for process filtration
Equivalent to std::ranges::any_of as clang-tidy suggests.
2021-12-23 12:45:36 -08:00
Hendiadyoin1
071d72b494 Profiler: Always use FlyString const&'s in ProfileNode construction
No need to copy and move them around, just to pass them as a
`String const&` to the constructor.

We still end up copying it to a normal String in the end though...
2021-12-23 12:45:36 -08:00
Hendiadyoin1
e3469391d3 Profiler: Remove one else-after-return 2021-12-23 12:45:36 -08:00
Hendiadyoin1
e727605007 Profiler: Don't return constant copies of GUI::ModelIndex 2021-12-23 12:45:36 -08:00
Hendiadyoin1
39a4c0e6ce Profiler: Add some implied auto qualifiers 2021-12-23 12:45:36 -08:00
Hendiadyoin1
584ba7da13 UserspaceEmulator: Return ValueAndShadowReference& on operator=
This is what normal assign operators do and what clang-tidy expects form
us.
2021-12-23 12:45:36 -08:00
Hendiadyoin1
c0d6afdc67 UserspaceEmulator: Avoid copies of non trivial types on invocations
These include AK::String and X86::Instruction
2021-12-23 12:45:36 -08:00
Hendiadyoin1
95d2feed33 UserspaceEmulator: Remove redundant private specifier in SoftCPU.h 2021-12-23 12:45:36 -08:00
Hendiadyoin1
6b9a35ac51 UserspaceEmulator: Remove some else-after-returns 2021-12-23 12:45:36 -08:00
Hendiadyoin1
15daae468b UserspaceEmulator: Add some implied auto qualifiers 2021-12-23 12:45:36 -08:00
Itamar
1ec917aa23 HackStudio: Attach debuggee to "Console" terminal tab
Previously the debuggee process used the same tty of the HackStudio
process.

We now set things up so the debuggee gets attached to the
TerminalWrapper in the "Console" tab.
2021-12-22 02:14:32 -08:00
Itamar
0cea8d1310 HackStudio: Separate master & slave PTY setup in TerminalWrapper
Previously the setup for both the master and slave pseudoterminals was
done in TerminalWrapper::run_command.

This commit separates the relevant logic into
TerminalWrapper::setup_master_pseudoterminal
and TerminalWrapper::setup_slave_pseudoterminal.
2021-12-22 02:14:32 -08:00
Itamar
83dd1e5b80 HackStudio: Rename "Build" tab to "Console"
The TerminalWrapper in this tab is not only used for displaying build
output, so "Console" would be a better name.
2021-12-22 02:14:32 -08:00
Idan Horowitz
5f4a67434c Kernel: Move userspace virtual address range base to 0x10000
Now that the shared bottom 2 MiB virtual address mappings are gone
userspace can use lower virtual addresses.
2021-12-22 00:02:36 -08:00
Nick Johnson
08e4a1a4dc AK+Everywhere: Replace __builtin bit functions
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount},
this commit removes all calls to these functions and replaces them with
the equivalent functions in AK/BuiltinWrappers.h.
2021-12-21 22:13:51 +01:00
Astraeus-
9971bb0b05 Profiler: Add horizontal_scrollbar height to initial_height
This prevents the scrollbar from covering the TimelineTrack
when there is one
2021-12-21 22:10:33 +01:00
Rok Povsic
a3c732b8ae Profiler: Display tooltip when hovering over flamegraph bars 2021-12-20 11:31:47 +01:00
Rok Povsic
d3a80b1a6e Profiler: Extract the bar label String into a private method 2021-12-20 11:31:47 +01:00
Astraeus-
a961a51692 Profiler: Convert to try_create_default_icon
and sprinkle in some more TRY() statements
2021-12-18 23:36:59 +01:00
Astraeus-
8513aff1cd Playground: Convert to try_create_default_icon
and sprinkle in some more TRY() statements
2021-12-18 23:36:59 +01:00
Astraeus-
64a5f990b1 Inspector: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Jean-Baptiste Boric
ee34340c6a UserspaceEmulator: Remove support for SC_select syscall 2021-12-12 21:48:50 +01:00