Commit graph

1019 commits

Author SHA1 Message Date
stelar7 55e9192886 HackStudio: Fix inverted condition when trying to create directories 2022-04-11 16:44:36 +02:00
kleines Filmröllchen 5319e3a03f LibCore+Userland: Remove File::ensure_parent_directories
We have a much safer and more powerful alternative now, so let's move
the few users over.
2022-04-11 00:08:48 +02:00
Simon Wanner 206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Andreas Kling e076f9997f HackStudio: Remove "evaluate expression" dialog
This was built on Web::InProcessWebView which is going to be removed.
Since this feature wasn't really used or maintained, let's just remove
it for now, and it can be resurrected on top of OutOfProcessWebView if
someone finds it useful enough to do that work.
2022-04-06 19:35:07 +02:00
Hendiadyoin1 7ba2e5e3e7 LibX86: Add CMPXCHG8B, RDRAND and RDSEED
With this we can run following script with no errors:
```sh
for /usr/lib/*.so {
    disasm "$it" > /dev/zero
}
```
2022-04-06 18:30:22 +02:00
Hendiadyoin1 688782efab UserspaceEmulator: Don't interpret SSE2 instructions as MMX ones
This is a huge FIXME right now, and should either be delegated to
SoftVPU or handled in these instructions.
2022-04-06 18:30:22 +02:00
Hendiadyoin1 3e3b677852 LibX86: Support SSE2 :^)
This allows disassembly of binaries with SSE2 instructions in them.
SSE2 also extends all MMX instructions without affecting the mnemonic,
therefore these are just directed to the same function for now.
The UserspaceEmulator does not know this as of
this commit.
2022-04-06 18:30:22 +02:00
Hendiadyoin1 5c19cfa55a UserspaceEmulator: Truncate in CVTTSS2SI 2022-04-06 18:30:22 +02:00
Hendiadyoin1 fd2af972ed LibX86: Correct CVTSS2SI's register signature
This was annotated the wrong way around.
2022-04-06 18:30:22 +02:00
Valtteri Koskivuori f2c02077ba Userland: Remove a few gratuitous IPC namespace qualifiers
Spotted this while trying to search for specific IPC encode/decode
implementations. Now they are all the same, so searching is easier.
2022-04-03 15:18:20 +01:00
kleines Filmröllchen 7e34b88ed4 LibGUI: Fully support TabWidget in GML
TabWidgets couldn't be used in GML properly, as the GML creation
routines didn't actually call the necessary functions in the TabWidget
to get a new tab added. This commit fixes that by making the name of the
tab a normal property, the previously introduced "title", which can be
trivially set from GML. Therefore, try_add_widget() loses an argument
(while try_add_tab doesn't, because it newly constructs the widget).
This allows us to get rid of the silly "fixing my widget tree after the
fact" code in Help and will make it super easy to use TabWidget in
future GML. :^)
2022-04-03 12:21:05 +02:00
Hendiadyoin1 2377344a89 UserspaceEmulator: Implement the SSE extension
This almost fully implements the SSE extension, similar to the x87 and
MMX extensions, using a separate class "SoftVPU".

Currently missing are all shadow and exception checks, as well as the
denormals-are-zero and flush-to-zero flags.
Also missing are some integer-SIMD functions.
2022-04-02 18:37:38 +02:00
Hendiadyoin1 1d2ad9cf61 UserspaceEmulator: Don't mark SoftFPU::mmx_get/set as ALWAYS_INLINE
These are exposed by SoftCPU, and this attribute would cause these not
to create any symbols to link against.
2022-04-02 18:37:38 +02:00
Hendiadyoin1 b7a8cfdde9 LibX86: Correctly name CVTTSS2SI_r32_xmm2m32
This was previously erroneously called CVTTPS2PI_r32_xmm2m32, while
the mnemonic was correctly CVTTSS2SI.
2022-04-02 18:37:38 +02:00
Idan Horowitz 086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Itamar 9cd27d1e15 LanguageServers/Cpp: Add SemanticType::PreprocessorMacro
This adds a new semantic token type, PreprocessorMacro.

Calls to preprocessor macros will now be highlighted when semantic
highlighting is enabled in Hack Studio.
2022-03-31 19:10:15 +02:00
Itamar 53c6c36fba LibGUI: Add AutocompleteProvider::TokenInfo::type_to_string() 2022-03-31 19:10:15 +02:00
Itamar 1ec3847acd HackStudio: Hide FindWidget on escape key press 2022-03-30 11:26:26 -04:00
Itamar d9d299f884 HackStudio: Add FindWidget
The find widget appears on Ctrl+F.

It uses the GUI::TextEditor search API to search for text, which also
takes care of highlighting the search results.
2022-03-29 17:45:36 +02:00
Brian Gianforcaro 4674577d80 Everywhere: Rename CommandResult stdout, stderr members to output, error
The names stdout / stderr are bound to conflict with existing
declarations when compiling against other LibC's. The build on OpenBSD
is broken for this reason at the moment.

Lets rename the members to more generic names to resolve the situation.
2022-03-27 16:41:39 -07:00
Simon Wanner e72f59cd23 Profiler: Render signposts behind histograms
Since signposts render along the full height they could hide CPU usage
spikes. This way that won't be an issue. :^)
2022-03-24 14:35:47 +01:00
Liav A b5ef900ccd Kernel: Don't assume paths of TTYs and pseudo terminals anymore
The obsolete ttyname and ptsname syscalls are removed.
LibC doesn't rely on these anymore, and it helps simplifying the Kernel
in many places, so it's an overall an improvement.

In addition to that, /proc/PID/tty node is removed too as it is not
needed anymore by userspace to get the attached TTY of a process, as
/dev/tty (which is already a character device) represents that as well.
2022-03-22 20:26:05 +01:00
Brian Gianforcaro 67fc81a65a Everywhere: Move cpp-tests under /home/anon/Tests 2022-03-20 22:20:59 +01:00
Itamar fc10bc3cb2 HackStudio: Search for libraries definitions in Userland/
Previously, the ProjectBuilder searched for serenity library definitions
under Userland/Libraries.

However, not all libraries are defined there. For example, LibShell is
under Userland/Shell.
2022-03-19 22:02:44 +01:00
Lenny Maiorani a0367aa43b DevTools+LibJS+LibWeb: Change class_name to use StringView
This helps make the overall codebase consistent. `class_name()` in
`Kernel` is always `StringView`, but not elsewhere.

Additionally, this results in the `strlen` (which needs to be done
when printing or other operations) always being computed at
compile-time.
2022-03-19 00:20:46 +00:00
Itamar 45788d030a HackStudio: Remove program name element in Core::command() calls
Core::command() takes care of inserting the program name as the first
element in argv, and so we shouldn't include the program name in the
argument vector we give it.

The Shell's argument parsing logic tolerated the extra argument,
until 83609ad.

This fixes building serenity components in Hack Studio.
2022-03-17 12:32:59 +03:30
ry-sev 23643cf21b HackStudio: Move editors inside tab widgets
This will move the editors inside a tab widget and the user
will be able to add new editors as tabs as well as add new
tab widgets. The user will be able to easily switch between
editors as well as the tab widgets.
2022-03-16 14:36:46 +01:00
Hendiadyoin1 cd21e03225 AK+Everywhere: Add sincos and use it in some places
Calculating sin and cos at once is quite a bit cheaper than calculating
them individually.
x87 has even a dedicated instruction for it: `fsincos`.
2022-03-15 11:39:42 +01:00
Hendiadyoin1 47fe911196 UserspaceEmulator: Clear c0 on x87 constant load instructions 2022-03-15 11:39:42 +01:00
Hendiadyoin1 3f581c77d9 UserspaceEmulator: Make error checks in FYL2XP1 and FYL2X a bit closer
...to the manual

This removes the non complete NaN checks and fixes a bounds check in
FYL2X.
2022-03-15 11:39:42 +01:00
Hendiadyoin1 60cb5b8dfa UserspaceEmulator: Add more FIXMES to SoftFPU
This also includes an exception check for sqrt and two
pow(2,...) -> exp2(...) changes.
2022-03-15 11:39:42 +01:00
Lucas CHOLLET 6f29ccaa5a HackStudio: Remove Terminal widget when the bound shell process dies
This feature allows the terminal widget to be automatically closed when
typing `exit` inside the shell.
2022-03-14 23:43:36 +01:00
electrikmilk ad71008d6f HackStudio: Add more files to new file menu
Add Python, Java, C, PHP, Wasm, INI, JSON, and Markdown files to new
file menu.
2022-03-08 22:42:40 +01:00
electrikmilk cd4b732acd HackStudio: Add missing key triggers
Add key triggers that are missing, primarily from the 'New..' menu.
2022-03-08 22:42:40 +01:00
electrikmilk 7fe0e7b46b HackStudio: Move 'New' Menu to 'File'
Currently we have a 'Project' menu with a 'New' menu in it, this tries
to organize things by just having one 'New...' sub-menu in the 'File'
menu that creates new files, projects and directories.

To solve conflicts, move 'Semantic Highlighting' to the 'View' menu.

As a result of both of these changes, remove 'Project' menu.
2022-03-08 22:42:40 +01:00
Jakub Berkop d084f8d90a Profiler: Present read event info in tree structure
This commit adds "Filesystem Events" View to the Profiler. This tab
 will present combined information for recorded Filesystem events.
Currently only accumulated count and duration is presented.
Duration amount currently only shows events that took over 1ms,
which means that in most cases 0 is show.
2022-03-05 21:47:01 +01:00
Andreas Kling a6a8ba80fc LibGfx: Rename Color::from_rgba() => Color::from_argb()
This matches the rename of RGBA32 to ARGB32. It also makes more sense
when you see it used with 32-bit hexadecimal literals:

Before:
    Color::from_rgba(0xaarrggbb)

After:
    Color::from_argb(0xaarrggbb)
2022-03-04 23:40:21 +01:00
Ali Mohammad Pur a5d4824abe UserspaceEmulator: Pass signal information through to emulated process
With this, SA_SIGINFO is also fully (as much as the kernel, at least)
supported by UE.
2022-03-04 20:07:05 +01:00
Ali Mohammad Pur 1125cbe336 UserspaceEmulator: Update signal handlers to use the new stack layout
The kernel sets up the stack like this, so set it up the same way.
2022-03-04 20:07:05 +01:00
Ali Mohammad Pur baf7038919 UserspaceEmulator: Add a SoftMMU::read<T> function
...and implement SoftCPU::read_memory<T> with it.
This allows the MMU to read a typed object (using 1-byte reads), which
is significantly nicer to use than reading the struct fields manually.
2022-03-04 20:07:05 +01:00
Ali Mohammad Pur 70b53b44b2 UserspaceEmulator: Wrap the GPRs in ValueWithShadow
...instead of manually tracking their shadow data.
2022-03-04 20:07:05 +01:00
Ali Mohammad Pur f6e82a8e0a UserspaceEmulator: Make it possible to wrap PODs in ValueWithShadow
Instead of making it hold the shadow data as another `T`, make it hold
the data as a byte array, and allow it to read the byte array as `T`.
This makes it much easier to make a "read_typed" function in the MMU.
2022-03-04 20:07:05 +01:00
Ali Mohammad Pur e08cf8f554 UserspaceEmulator: Let SoftCPU.h include Emulator.h
...instead of Emulator.h including SoftCPU.h.
This will be used in a later commit to access into Emulator from a
template in SoftCPU.h.
2022-03-04 20:07:05 +01:00
Lucas CHOLLET 9a83d34543 HackStudio: Propagate error from TerminalWrapper
Use the ErrorOr pattern with the Core::System wrappers to propagate more
errors from the TerminalWrapper.

The run_command method, when called with WaitForExit::Yes now returns an
error on command failure.
2022-03-02 18:08:05 +01:00
xSlendiX f0ac1bcaf8 HackStudio: Add icon to "Open Recent"
This commit adds the newly added "open-recent" icon to HackStudio.
2022-03-01 21:20:11 +00:00
Itamar 7fa7c7d63c LanguageServers/Cpp: Make find declaration of enums work 2022-02-27 21:42:05 +01:00
Itamar 4335bd453d LanguageServers/Cpp: Make find declaration for a declaration node work
The CppComprehensionEngine can now find the declaration of a
declaration node of type class/namespace/function.
2022-02-27 21:42:05 +01:00
Itamar fa384c8171 LanguageServers/Cpp: Make go to declaration of a namespace work
The CppComprehensionEngine can now find the declaration of a reference
to a namespace.
2022-02-27 21:42:05 +01:00
Andreas Kling fe67fe3791 LibWeb: Check for valid names in Document.createElement() & friends
We now validate that the provided tag names are valid XML tag names,
and otherwise throw an "invalid character" DOM exception.

2% progression on ACID3. :^)
2022-02-26 10:03:07 +01:00
Itamar 75ee77f8a1 HackStudio: Rename HackStudio::ServerConnection=>ConnectionToServer
Also renames ServerConnectionWrapper=>ConnectionToServerWrapper
and ServerConnectionInstances=>ConnectionToServerInstances

This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar d88da82e28 Userland: Rename IPC::ServerConnection=>IPC::ConnectionToServer
This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar 3a71748e5d Userland: Rename IPC ClientConnection => ConnectionFromClient
This was done with CLion's automatic rename feature and with:
find . -name ClientConnection.h
    | rename 's/ClientConnection\.h/ConnectionFromClient.h/'

find . -name ClientConnection.cpp
    | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
2022-02-25 22:35:12 +01:00
thankyouverycool 29504ae5b6 HackStudio: Adjust heights for Locator and Find widgets
These were two pixels too small and, in Locator's case, blurring
the boundary with Statusbar.
2022-02-24 19:09:41 +01:00
thankyouverycool 77c4b20157 HackStudio: Segment the status bar and setup override text 2022-02-24 19:09:41 +01:00
Brian Gianforcaro 35b06ef1eb UserspaceEmulator: Fix syntax of generated profiles
While trying out `ue --profile` today, I received an invalid json
profile. After poking around at the file it looks like we never close
the `events: [..` array that we generate, and thus end up with an
invalid document.

The fix is straight forward, always emit the closing brace.
2022-02-24 16:12:19 +03:30
thankyouverycool 653f01616c LibGUI+Apps: Adjust Splitter spacings
Different thread highlights between widgets lead to different
visual weights between splitters, even when they have the same
width or height. This means some splitters look best at odd
sizes while others even. This sets the default spacing to the
most commonly used, depending on orientation, and adjusts
spacing for a few apps based on the new paint rect.

The most consistent look across apps requires some manual
tweaking occassionally. Knurlheads, use your discretion!
2022-02-23 18:56:22 +02:00
thankyouverycool fe864af0dc LibGUI+Apps: Prevent Splitter children from being unresizable
Splitters could be resized in such an order that all their remaining
children were fixed size, leading to unfillable gaps on resize events.

HackStudio and TextEditor already had logic to handle this edge case,
so this patch factors it into a general solution for all Splitters.
At least one widget is now guaranteed to be resizeable after a child
is removed.
2022-02-23 18:56:22 +02:00
Itamar cdfc530a99 LanguageServers/Cpp: Fix "complete_includes" language server test
Previously the target result was only a partial completion.
2022-02-23 00:48:44 +00:00
Itamar 7b42abccf2 LibCpp: Allow qualified names in AST Declaration nodes
Previously, the names of declarations where stored as a simple
StringView.

Because of that, we couldn't parse out-of-line function definitions,
which have qualified names.
For example, we couldn't parse the following snippet:

```
void MyClass::foo(){}
```

To fix this, we now store the name of a declaration with a
ASTNode::Name node, which represents a qualified named.
2022-02-23 00:48:44 +00:00
Karol Kosek c9c55d86a4 Userland: Ask first for unsaved changes after clicking an "Open" action
Previously there was some inconsistency between the apps when clicking
the "Open" action while the file wasn't saved.

Some programs (Font Editor) immediately asked you if you wanted to save
the modified file, while others (Text Editor, Hex Editor and Playground)
would show the save dialog only *after* you selected a file.

I think it's better to ask a user right away if they want to save file,
because a dialog after selecting a file should be generally related to
that selected file, like an error opening a file, an import window etc.
2022-02-21 18:30:32 +01:00
Marco Cutecchia cb041d7496 HackStudio: Open by default the last opened project if not specified 2022-02-21 16:31:56 +01:00
Marco Cutecchia 7e7bfdac50 HackStudio: Add a 'Recent Projects' submenu in 'File' 2022-02-21 16:31:56 +01:00
Karol Kosek cb332bdd2a Playground: Show last saved time when asked about unsaved changes 2022-02-20 08:40:26 -05:00
Itamar 4d2357f8f3 HackStudio: Don't store a global RefPtr to the HackStudioWidget
Previously, we stored a RefPtr to the HackStudioWidget in the
global scope.

This led to a destruction-order related use-after-free bug, where the
global HackStudioWidget instance destructed after the static-local
GUI::Clipboard instance.
When HackStudioWidget destructs it attempts to use the global Clipboard
instance, which had already been freed.

This caused the Hack Studio process to spin endlessly on exit because
it attempted to access the HashTable of the freed Clipboard object.

We now store a global WeakPtr to the HackStudioWidget instead, and
limit the lifetime of the object to the main function scope.
2022-02-19 11:38:29 +01:00
Sam Atkins 8260135d4d LibCore+Everywhere: Return ErrorOr from ConfigFile factory methods
I've attempted to handle the errors gracefully where it was clear how to
do so, and simple, but a lot of this was just adding
`release_value_but_fixme_should_propagate_errors()` in places.
2022-02-16 19:49:41 -05:00
Sam Atkins 2caaebcf41 Profiler: Add missing LibCore/File include
This was previously included via ConfigFile.h
2022-02-16 19:49:41 -05:00
Lenny Maiorani 7070713ec8 DevTools: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-02-16 07:33:15 -05:00
Karol Kosek db299e9804 Playground: Add editor actions to the window menu 2022-02-15 02:32:52 +01:00
Harrison Marshall f538545987 HackStudio: Fix crash when requesting parameter list
When requesting a parameter hint message with `Ctrl + p` in a file that
doesn't have a language server, we would crash.

Now, rather than verifying that we have a language server, we return
early if we don't have one.
2022-02-14 13:48:05 +01:00
Jakub Berkop cdfb388154 Profiler: Add ability to process read syscalls
Profiler can now process and display read events.
2022-02-14 11:38:13 +01:00
kleines Filmröllchen 704bb361bb LibCore: Allow event loops on other threads to wake up
Because the wake pipe is thread-local, it was previously not possible
to wake an event loop across a thread. Therefore, this commit
rearchitects event loop waking by making the wake function a member of
the event loop itself and having it keep a pointer to its thread's wake
pipe. The global wake() function calls wake on the current thread's
event loop.

This also fixes a bug in BackgroundAction: it should wake the event loop
it was created on, instead of the current thread's event loop.
2022-02-13 23:06:53 +01:00
Idan Horowitz c8ab45e79f Userland: Run gml-format
This brings the existing GML files up to spec with the new requirements
2022-02-13 02:36:35 +02:00
Idan Horowitz 4c451422c3 gml-format+Playground: Print GML parsing error on formatting failure 2022-02-13 02:36:35 +02:00
Itamar 506c13d143 HackStudio: Put the Build directory inside the Serenity repository
Previously, the build directory for building serenity components was a
temporary directory in /tmp which was generated whenever a different
serenity component was built.

Instead of doing that, Hack Studio now simply uses the Build/ directory
inside the Serenity repository, similar to what is done in host builds.

This makes it so we don't re-build when switching back and forth between
different components.
It also makes it easier to inspect the build products.
2022-02-12 11:51:48 +01:00
Itamar 8bb4d46676 HackStudio: Only query token information if semantic highlighting is on 2022-02-12 11:24:32 +01:00
Idan Horowitz 871a53db76 AK: Make Bitmap construction OOM-fallible 2022-02-11 17:49:46 +02:00
Daste 542e18b367 HackStudio: Fix error handling logic in delete_action
The `result.is_error()` check was inverted, causing a crash.
2022-02-10 21:41:05 +02:00
Daste 11c53a1944 HackStudio: Don't save file when filename is empty
When saving a new file, save_as_action will return if the filename
input was empty, but save_action would still try to save the file.
Added a guard to make sure we never try to save files with empty
filenames.
2022-02-10 18:42:45 +01:00
electrikmilk 3c11dc5bd3 Base+HackStudio: Add or insert missing icons
Insert or add icons where they are missing.
2022-02-10 10:27:26 +00:00
Itamar 8ec4328fcb HackStudio: Allow toggling between simple and semantic highlighting
Until it becomes enough stable and performant, semantic highlighting is
disabled by default.

It can be toggled on via the "Project" menu in HackStudio.
2022-02-09 00:51:31 +01:00
Itamar aba2e03b71 HackStudio: Use the C++ semantic syntax highlighter
HackStudio::Editor will now send a request to get semantic token
information to the language server whenever there's a short pause in
editing.

The result is used by the semantic c++ syntax highlighter to provide
better highlighting information.
2022-02-09 00:51:31 +01:00
Itamar 33043f269d HackStudio: Add tokens_info_result() and tokens_info_result() IPC calls
These IPC calls are used in the communication with the language server
to fetch semantic information about the tokens in a code document.
2022-02-09 00:51:31 +01:00
Itamar 76000e9137 LanguageServers/Cpp: Make find_declaration_of() more flexible
Previously, find_declaration_of() only worked for AST nodes of type
Identifier. It now also works for declaration node, member variables
and function parameters.
2022-02-09 00:51:31 +01:00
Itamar a54d0cc805 LibGUI+HackStudio: Add TokenInfo struct for language-server IPC
The TokenInfo struct contains the token's position and a
"semantic type". The semantic type is a more fine-grained token type
than what's in Cpp::Token::Type.
For example, the semantic token type differentiates between a reference
to a variable and to a function parameter. In the normal Token::Type,
both would be Token::Type::Identifier.
2022-02-09 00:51:31 +01:00
Itamar 605becb28b LibCpp: Update regressions tests results
The LibCpp regression tests results have to be updated after tweaking
the token end position calculation logic of some token types.
2022-02-09 00:51:31 +01:00
electrikmilk 4263dad838 Base: Change JSON file icon to add CSS file icon
Add CSS icon and add replacement JSON icon as the colors conflict.

Update HackStudioWidget.cpp
2022-02-08 22:42:47 +00:00
davidot 1c4c251be3 LibJS+Everywhere: Remove all VM::clear_exception() calls
Since VM::exception() no longer exists this is now useless. All of these
calls to clear_exception were just to clear the VM state after some
(potentially) failed evaluation and did not use the exception itself.
2022-02-08 09:12:42 +00:00
kleines Filmröllchen 6ee597369d Meta+Userland: Run the GML formatter on CI and pre-commit
Now that the GML formatter is both perserving comments and also mostly
agrees to the existing GML style, it can be used to auto-format all the
GML files in the system. This commit does not only contain the scripts
for running the formatting on CI and the pre-commit hook, but also
initially formats all the existing GML files so that the hook is
successfull.
2022-02-07 18:39:50 +01:00
kleines Filmröllchen 32de6dde4c Playground: Remove the GML formatting warning
As we no longer remove comments when formatting GML, this gets rid of
the warning presented to the user when there are comments in the GML.
2022-02-07 18:39:50 +01:00
kleines Filmröllchen 4931c88b13 LibGUI: Remove GML prefix in favor of proper namespace
Prefixes are very much a C thing which we don't need in C++. This commit
moves all GML-related classes in LibGUI into the GUI::GML namespace, a
change somewhat overdue.
2022-02-07 18:39:50 +01:00
electrikmilk e7b8498a4a Base: Add GML file type icon
Add 16x16 and 32x32 icons for GML files.
2022-02-07 09:25:22 +00:00
Linus Groh 6f20f49b21 Everywhere: Rename JS::PropertyKey variables from property_{name => key}
PropertyKey used to be called PropertyName, but got renamed. Let's
update all the variables of this type as well.
2022-02-06 22:02:45 +00:00
Rummskartoffel 2d67d141e6 UserspaceEmulator: Implement ioctl TIOCSTI 2022-01-29 11:22:43 +01:00
Rummskartoffel e636e2abbe UserspaceEmulator: Implement ioctl TCFLSH 2022-01-29 11:22:43 +01:00
Rummskartoffel a92719fc72 UserspaceEmulator: Implement signal masking 2022-01-29 11:22:43 +01:00
Rummskartoffel 335183d0e9 UserspaceEmulator: Implement virt$sigprocmask 2022-01-29 11:22:43 +01:00
Rummskartoffel 33b4b86141 UserspaceEmulator: Implement virt$getppid 2022-01-29 11:22:43 +01:00
Rummskartoffel 273f15e8ea UserspaceEmulator: Implement ioctl TIOCGPGRP 2022-01-29 11:22:43 +01:00
Rummskartoffel ef151afac8 UserspaceEmulator: Implement ioctl TIOCSWINSZ 2022-01-29 11:22:43 +01:00
Rummskartoffel b393fe573d UserspaceEmulator: Implement ioctl FIONBIO 2022-01-29 11:22:43 +01:00
Rummskartoffel 0c88a53d4c UserspaceEmulator: Convert virt$ioctl to use switch-case 2022-01-29 11:22:43 +01:00
Ali Mohammad Pur 6d64b13a1b LibDebug+Everywhere: Avoid void* -> FlatPtr -> void* dance
And limit the `void*` to the functions that interface the system (i.e.
ptrace wrappers).
This generally makes the code less riddled with casts.
2022-01-28 22:51:27 +00:00
kleines Filmröllchen 145eeb57ab Userland: Remove a bunch of unnecessary Vector imports
How silly :^)
2022-01-28 23:40:25 +01:00
Itamar 106e414800 HackStudio: Fix path to language-server IPC socket
The path to the language server local socket was accidentally broken
in 2e1bbcb.
2022-01-28 13:17:54 +01:00
Sam Atkins 45cf40653a Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Rummskartoffel 4eb5fdcfe0 UserspaceEmulator: Support ioctls TCSETSF and TCSETSW 2022-01-24 03:02:35 +00:00
Luke Wilde 631bbcd00a LibJS: Refactor interpreter to use Script and Source Text Modules
This also refactors interpreter creation to follow
InitializeHostDefinedRealm, but I couldn't fit it in the title :^)

This allows us to follow the spec much more closely rather than being
completely ad-hoc with just the parse node instead of having all the
surrounding data such as the realm of the parse node.

The interpreter creation refactor creates the global execution context
once and doesn't take it off the stack. This allows LibWeb to take the
global execution context and manually handle it, following the HTML
spec. The HTML spec calls this the "realm execution context" of the
environment settings object.

It also allows us to specify the globalThis type, as it can be
different from the global object type. For example, on the web, Window
global objects use a WindowProxy global this value to enforce the same
origin policy on operations like [[GetOwnProperty]].

Finally, it allows us to directly call Program::execute in perform_eval
and perform_shadow_realm_eval as this moves
global_declaration_instantiation into Interpreter::run
(ScriptEvaluation) as per the spec.

Note that this doesn't evalulate Source Text Modules yet or refactor
the bytecode interpreter, that's work for future us :^)

This patch was originally build by Luke for the environment settings
object change but was also needed for modules. So I (davidot) have
modified it with the new completion changes and setup for that.

Co-authored-by: davidot <davidot@serenityos.org>
2022-01-22 01:21:18 +00:00
Rummskartoffel 5b2c973cc3 UserspaceEmulator: Correctly fail in execve when binary is inaccessible
Previously, Emulator::virt$execve would not report ENOENT and EACCES
when the binary to be executed was nonexistent or not executable. This
broke the execp family of functions, which rely on ENOENT being reported
in order to know that they should continue searching $PATH.
2022-01-21 14:45:04 +02:00
Rummskartoffel d2f99c200f UserspaceEmulator: Fix execve messing up command lines with "--"
Emulator::virt$execve would construct command lines such as
`/bin/UserspaceEmulator echo -- hello` instead of
`/bin/UserspaceEmulator -- echo hello`, which naturally caused problems.
This commit moves the "--" to the correct place.
2022-01-21 14:45:04 +02:00
Dmitry Petrov 1662213737 Userland: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00
Itamar 0367893e53 HackStudio: Change ProjectBuilder dependency declaration logic
Previously when generating the HackStudio CMake build file,
we used all dependency libraries that are specified in
target_link_libraries commands as the dependencies of a library.

The recent addition of LibCryptSHA2 broke things because that library
is not declared with serenity_lib like most other libraries
(it uses special linking properties).
This means that we don't declare it in the CMake file we generate.

To fix this, we now filter the dependencies and only include libraries
that we define in the build CMake file.
2022-01-19 19:57:31 +01:00
Brian Gianforcaro 89592601b6 HackStudio: Hookup git commit message detection and highlighting 2022-01-18 09:01:16 +01:00
Brian Gianforcaro 413d8ccd5f Playground: Enable line numbers in the GML editor
Most folks expect line numbers when editing code, so lets enable them in
when editing GML in the Playground app.
2022-01-18 09:00:27 +01:00
sin-ack 2e1bbcb0fa LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServer
This change unfortunately cannot be atomically made without a single
commit changing everything.

Most of the important changes are in LibIPC/Connection.cpp,
LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp.

The notable changes are:
- IPCCompiler now generates the decode and decode_message functions such
  that they take a Core::Stream::LocalSocket instead of the socket fd.
- IPC::Decoder now uses the receive_fd method of LocalSocket instead of
  doing system calls directly on the fd.
- IPC::ConnectionBase and related classes now use the Stream API
  functions.
- IPC::ServerConnection no longer constructs the socket itself; instead,
  a convenience macro, IPC_CLIENT_CONNECTION, is used in place of
  C_OBJECT and will generate a static try_create factory function for
  the ServerConnection subclass. The subclass is now responsible for
  passing the socket constructed in this function to its
  ServerConnection base; the socket is passed as the first argument to
  the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before
  any other arguments.
- The functionality regarding taking over sockets from SystemServer has
  been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket
  implementation of this functionality hasn't been deleted due to my
  intention of removing this class in the near future and to reduce
  noise on this (already quite noisy) PR.
2022-01-15 13:29:48 +03:30
Idan Horowitz cfb9f889ac LibELF: Accept Span instead of Pointer+Size in validate_program_headers 2022-01-13 22:40:25 +01:00
Idan Horowitz 3e959618c3 LibELF: Use StringBuilders instead of Strings for the interpreter path
This is required for the Kernel's usage of LibELF, since Strings do not
expose allocation failure.
2022-01-13 22:40:25 +01:00
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
Jean-Baptiste Boric 012d8d7f74 UserspaceEmulator: Add support for SC_poll syscall 2021-12-12 21:48:50 +01:00
Jean-Baptiste Boric 493c958b9e UserspaceEmulator: Sort syscalls in alphabetic order 2021-12-12 21:48:50 +01:00
bugreport0 2b47e1233b Playground: Remove redundant pledge() 2021-12-11 23:06:56 +01:00
bugreport0 595ebe215b Inspector: Update pledge() idiom 2021-12-11 23:06:56 +01:00
Daniel Bertalan 4a81b33c07 Everywhere: Fix -Winconsistent-missing-override warnings from Clang
This option is already enabled when building Lagom, so let's enable it
for the main build too. We will no longer be surprised by Lagom Clang
CI builds failing while everything compiles locally.

Furthermore, the stronger `-Wsuggest-override` warning is enabled in
this commit, which enforces the use of the `override` keyword in all
classes, not just those which already have some methods marked as
`override`. This works with both GCC and Clang.
2021-12-11 13:14:15 -08:00
scwfri 8d0143a380 HackStudio+TextEditor: Persist EditingEngineType across editors
Persist EditingEngine mode in HackStudio and TextEditor when opening new
files or editing splits. Previously, the EditingEngine defaulted to a
RegularEditingEngine for a new Editor, even if Vim Emulation had been
selected in the existing Editor.
2021-12-09 21:31:06 +01:00
Ben Wiederhake aa5f130c84 Inspector: Remove unused includes
Found while working on something else.
2021-12-08 17:18:37 -08:00
Andreas Kling 971b3645ef LibIPC: Add IPC::take_over_accepted_client_from_system_server<Client>()
This is an encapsulation of the common work done by all of our
single-client IPC servers on startup:

    1. Create a Core::LocalSocket, taking over an accepted fd.
    2. Create an application-specific ClientConnection object,
       wrapping the socket.

It's not a huge change in terms of lines saved, but I do feel that it
improves expressiveness. :^)
2021-12-06 19:22:16 +01:00
Sam Atkins d2024f04bd Userland: Cast unused BackgroundAction::construct() results to void
User code does not need to keep this alive, so casting to void is safe.
But maybe a bit weird.
2021-12-05 15:31:03 +01:00
Daniel Bertalan 21acebd372 HackStudio: Fix cursor not jumping to column 1 in the embedded terminal
Normally, it's the TTY layer's job to translate '\n' into the separate
'\r' and '\n' control characters needed by the terminal to move the
cursor to the first column of the next line.
(see 5d80debc1f).

In HackStudio, we directly inject data into the TerminalWidget to
display command status. This means that this automatic translation
doesn't happen, so we need to explicitly give it the '\r' too.
2021-12-04 14:44:00 +03:30
Itamar c3c2fe153b LibCpp: Add "ignore invalid statements" option to Preprocessor
When we run the Preprocessor from the CppComprehensionEngine of
the language server, we don't want the preprocessor to crash if it
encounters an invalid preprocessor statement (for example, an #endif
statement without an accompanying previous #if statement).

To achieve this, this commit adds an "ignore_invalid_statements" flag
to the preprocessor which is set by the CppComprehensionEngine.

Fixes #11064.
2021-12-03 15:38:21 +01:00
Itamar 408f05bbb9 HackStudio: Decrease the maximal crash frequency of the server to 10 sec
The maximal crash frequency of the language server was previously 3
seconds, but in practice it was too high.
When working with larger projects the language server can get into a
"crash and respawn" loop that takes more than 3 seconds.

10 seconds seems like a reasonable threshold beyond which we no longer
attempt to respawn the server.
2021-12-03 15:38:21 +01:00
Itamar 28ff7d49ad HackStudio: Only send the content of open files to language server
When respawning the language server, we only need to send the content
of opened files to the server.

The on-disk content of files that are not currently open is up to
date, so the server can read them on its own.
2021-12-03 15:38:21 +01:00
Itamar 3e9a96f1d8 HackStudio: Add HackStudio::for_each_open_file 2021-12-03 15:38:21 +01:00
Andreas Kling 85eb0eaad0 CrashReporter+HackStudio: Let's call it "Debug in Hack Studio"
"Inspect in Hack Studio" was a bit vague.
2021-11-30 23:34:40 +01:00
Andreas Kling d3bd9f1f0c HackStudio: Scope the "delete file from project" action to tree view
Otherwise it triggers when trying to delete characters in the editor.
2021-11-30 23:34:40 +01:00
Andreas Kling cb9cac4e40 LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void>
This allows us to use TRY() in decoding helpers, leading to a nice
reduction in line count.
2021-11-28 23:14:19 +01:00
Brian Gianforcaro cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
Brian Gianforcaro f807796380 UserspaceEmulator: Fix after add_positional_argument API change :^)
Get UE compiling again after the Vector<String> API was changed to
Vector<StringView>.
2021-11-26 16:47:39 -08:00
Federico Guerinoni 4a90729a3e HackStudio: Port to LibMain :^) 2021-11-26 11:13:59 -08:00
Ben Wiederhake 33079c8ab9 Kernel+UE+LibC: Remove unused dbgputch syscall
Everything uses the dbgputstr syscall anyway, so there is no need to
keep supporting it.
2021-11-24 22:56:39 +01:00
Andreas Kling b6f49924be LibDesktop: Make allowlist APIs return ErrorOr<void>
This makes it very smooth to use TRY() when setting up these lists,
as you can see in the rest of this commit. :^)
2021-11-24 00:25:23 +01:00
Andreas Kling 4a64bb80ea Inspector: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling 4283702fb8 Playground: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling dfca0def63 Profiler: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling 58fb3ebf66 LibCore+AK: Move MappedFile from AK to LibCore
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
2021-11-23 11:33:36 +01:00
Andreas Kling c1a3968c66 LibCore: Make LocalSocket takeover mechanism return ErrorOr<T> 2021-11-23 11:33:36 +01:00
Andreas Kling 21a5fb0fa2 LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCore
With this change, System::foo() becomes Core::System::foo().

Since LibCore builds on other systems than SerenityOS, we now have to
make sure that wrappers work with just a standard C library underneath.
2021-11-23 11:33:36 +01:00
Andreas Kling c2b90bab9f LanguageServers/Shell: Port to LibMain :^) 2021-11-23 11:33:36 +01:00
Andreas Kling 54155f8c64 LanguageServers/Cpp: Port to LibMain :^) 2021-11-23 11:33:36 +01:00
Karol Kosek 5f3e9886f7 HackStudio: Disable the Rename action on insufficient permissions
This patch will disable the Rename action in the project Tree View
if a user does not have write access to the selected file directory.
2021-11-22 09:03:19 +01:00
Karol Kosek 0264d3de45 HackStudio: Remove noop when deciding whether to disable delete action
The iterator in has_permissions will just be equal to sections.end()
when there are no selected files.
2021-11-22 09:03:19 +01:00
Itamar 8316eb7306 HackStudio: Add option to inspect Coredump
This adds a --coredump <file> option to Hack Studio.

When used, Hack Studio will open the coredump and allow the user to
inspect it in the Debug tab.
2021-11-20 21:22:24 +00:00
Itamar ce726fe027 HackStudio: Improve backtrace accuracy
We now decrement the return address of the previous frame by one to get
the address of the call instruction and use this address in the
backtrace.

This results in more accurate source position information than what we
previously had when using the return address.
2021-11-20 21:22:24 +00:00
Itamar 94d68583fb HackStudio: Use ProcessInspector instead of DebugSession where possible 2021-11-20 21:22:24 +00:00
Andreas Kling 216e21a1fa AK: Convert AK::Format formatting helpers to returning ErrorOr<void>
This isn't a complete conversion to ErrorOr<void>, but a good chunk.
The end goal here is to propagate buffer allocation failures to the
caller, and allow the use of TRY() with formatting functions.
2021-11-17 00:21:13 +01:00
Andreas Kling 587f9af960 AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)
Also add slightly richer parse errors now that we can include a string
literal with returned errors.

This will allow us to use TRY() when working with JSON data.
2021-11-17 00:21:10 +01:00
Hendiadyoin1 1533123263 Profiler: Stop disassembly on invalid instructions 2021-11-16 00:49:48 +00:00
Hendiadyoin1 134f43ba12 Profiler: Don't try to disassemble empty buffers 2021-11-16 00:49:48 +00:00
Andreas Kling 8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Tim Schumacher 80cb44afae Everywhere: Move shared library checks into a common function
While we're at it, unify the various different conditions that are
scattered accross the codebase.
2021-11-10 14:42:49 +01:00
Tim Schumacher d350d2dfce Emulator: Restrict library name check when querying symbols
Libraries in /usr/lib currently only end in .so, so no contains() is
needed for now.
2021-11-10 14:42:49 +01:00
Tim Schumacher 6c6381408f Emulator: Use existing queried library name in load check
We already asked the region about what its library name is, and we also
use that value when maybe constructing a path, so let's make the check
use that as well.
2021-11-10 14:42:49 +01:00
Tim Schumacher fc6f265155 Profiler: Use existing path split when mmapping libraries
We already extracted the `path` part of the segment name, so use that
for checking if the filename looks like a shared library.
2021-11-10 14:42:49 +01:00
Brendan Coles 1e48cd35a1 UserspaceEmulator: Add support for SC_uname and SC_sysconf syscalls 2021-11-08 16:30:32 -08:00
Andreas Kling fbe8f185b5 Profiler: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling 4a2b718ba2 LibCore: Use ErrorOr<T> for Core::File::copy_file() 2021-11-08 00:35:27 +01:00
Andreas Kling c7e62d448c LibCore: Use ErrorOr<T> for Core::File::remove()
This function returns a subclass of Error, which is now possible.
2021-11-08 00:35:27 +01:00
Andreas Kling 0de33b3d6c LibGfx: Use ErrorOr<T> for Bitmap::try_create()
Another one that was used in a fajillion places.
2021-11-08 00:35:27 +01:00
Andreas Kling 235f39e449 LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
Hendiadyoin1 2867d93115 UserspaceEmulator: Improve the MMX formatting on environment dump 2021-11-07 22:42:23 +00:00
Hendiadyoin1 83f50a1507 UserspaceEmulator: Raise an error on FPU stack underflow
Accessing an unset part of the FPU stack should not be a simple warning,
but should trigger the FPU exception mechanism.
2021-11-07 22:42:23 +00:00
Hendiadyoin1 0d6d780183 UserspaceEmulator: Remove some unnecessary casting 2021-11-07 22:42:23 +00:00
Hendiadyoin1 d759175767 UserspaceEmulator: Stop overriding flags in FCOMI
We no longer override the flags we just set. We now also unset of, af,
and sf after the comparison.
This fixes the asin function for LibM!
2021-11-07 22:42:23 +00:00
Hendiadyoin1 f2eff767a0 UserspaceEmulator: Fix typos in SoftFPU.[cpp|h] 2021-11-07 22:42:23 +00:00
Hendiadyoin1 74aba07b70 UserspaceEmulator: Align FPU-exception names with the manual 2021-11-07 22:42:23 +00:00
Hendiadyoin1 5d2a4bd18d UserspaceEmulator: Check the right flags in FCMOV
Also make FCMOVNB do an actual CMOV and not a copy of FILD_m32
2021-11-07 22:42:23 +00:00
Hendiadyoin1 8108aaca39 UserspaceEmulator: Correct FSCALES rounding
We were rounding the wrong way, FSCALE is supposed to trunc internally,
while we were flooring.
Now LibM exponentials and related tests work :^)
2021-11-07 22:42:23 +00:00
Hendiadyoin1 fa02b46295 UserspaceEmulator: Always set C1 when rounding 2021-11-07 22:42:23 +00:00
Hendiadyoin1 7214b08f81 UserspaceEmulator: Simplify the definition of the FPU register stack
Long doubles are always at least 80 bits wide in memory and it suffices
if we can address these 80 bits, to mark the long double as NAN at the
end of an MMX instruction, so the additional magic using conditional
types is unnecessary.
2021-11-07 22:42:23 +00:00
Hendiadyoin1 d06675e3e4 UserspaceEmulator: Use unsigned types for logical MMX shifting 2021-11-07 22:42:23 +00:00
Ben Wiederhake 3796d417e0 Demos+DevTools+Games: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
thislooksfun 8462234208 HackStudio: Don't close autocomplete after applying #include directories 2021-11-02 17:53:22 +01:00
thislooksfun d5baf1c1fa LibGUI: Allow autocomplete to stay open after applying
Previously the autocomplete box would always close after applying a
suggestion. This is the desired behavior in almost all cases, but there
are some situations (like autocompleting paths) where it would be nicer
to keep the autocomplete box open after applying the suggestion.
2021-11-02 17:53:22 +01:00
thislooksfun 81f00c0aa8 HackStudio: Remove unused #include
Found this while looking at who uses GUI::AutocompleteProvider.
2021-11-02 17:53:22 +01:00
thislooksfun 0be3f5b4ae HackStudio: Append a / when completing a directory 2021-11-02 17:53:22 +01:00
thislooksfun 8b3a2cdad9 HackStudio: Correctly handle nested paths
Previously the paths were concatinated incorrectly, so triggering
the autocomplete on `#include "foo/bar"` would never work. Now it
does. :^)
2021-11-02 17:53:22 +01:00
thislooksfun a6a71869d7 HackStudio: Handle autocomplete inside #include's <> and "" 2021-11-02 17:53:22 +01:00
thislooksfun f7f9d09e72 LibGUI: Remove GUI::AutocompleteProvider::Entry::kind
The only code using it was removed in the previous commit.
2021-11-02 17:53:22 +01:00
thislooksfun f699dbdc3f HackStudio+LibGUI: Handle #include quotes and brackets in the engine
Previously we had a special case in order to auto-append quotes or
angle brackets to #include statements. After the previous commit this
is no longer necessary.
2021-11-02 17:53:22 +01:00
thislooksfun a5b3c3f85f LibGUI: Allow completion suggestions to fill and display different text
There are times when it is nice to display one suggestion but fill
something different. This lays the groundwork for allowing
GMLAutocompleteProvider to automatically add ': ' to the end of
suggested properties, while keeping the ': ' suffix from cluttering up
the suggestion UI.
2021-11-02 17:53:22 +01:00
Ben Wiederhake 70c7861c33 UserspaceEmulator: Avoid special character in pseudo-identifier
In the generated HTML code, '#' gets interpreted as the beginning of a
shell comment, which throws the syntax highlighting off. Regardless,
spelling out the meaning of the '#' might make it more readable.
2021-11-01 21:12:58 +01:00
Ben Wiederhake b8f11b1bae Everywhere: Remove unused ArgsParser header
Found while trying to enumerate all programs that use ArgsParser.
2021-11-01 21:12:58 +01:00
Andreas Kling aff2b42f82 UserspaceEmulator: Fix inconsistent log formatting
Remove some extra { and } around the PID in log output that weren't used
consistently in all logging.
2021-10-31 21:07:29 +01:00
Daniel Bertalan b883652a83 Profiler: Cache parsed DWARF debug information in disassembly view
This changes browsing through disassembled functions in Profiler from a
painfully sluggish experience into quite a swift one. It's especially
true for profiling the kernel, as it has more than 10 megabytes of DWARF
data to churn through.
2021-10-31 16:54:02 +01:00
Daniel Bertalan 8e1f882ac9 Profiler: Load the actual kernel binary for disassembly
/boot/Kernel.debug only contains the symbol table and DWARF debug
information, and has its `.text` and other PT_LOAD segments stripped
out. When we try to parse its data as instructions, we get a crash from
within LibX86.

We now load the actual /boot/Kernel binary when we want to disassemble
kernel functions.
2021-10-31 16:54:02 +01:00
Daniel Bertalan 80b660132c Profiler: Share the mapped kernel between Profile and DisassemblyModel
There is no point in keeping around a separate MappedFile object for
/boot/Kernel.debug for each DisassemblyModel we create and re-parsing
the kernel image multiple times. This will significantly speed up
browsing through profile entries from the kernel in disassembly view.
2021-10-31 16:54:02 +01:00
Marco Cutecchia 3428e2a76c HackStudio: Add 'Show Dotfiles' option 2021-10-29 22:40:11 +02:00
Filiph Sandström d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Liav A 8554952690 Kernel + WindowServer: Re-define the interface to framebuffer devices
We create a base class called GenericFramebufferDevice, which defines
all the virtual functions that must be implemented by a
FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other
FramebufferDevice implementations inherit from it.
The most important consequence of rearranging the classes is that we now
have one IOCTL method, so all drivers should be committed to not
override the IOCTL method or make their own IOCTLs of FramebufferDevice.
All graphical IOCTLs are known to all FramebufferDevices, and it's up to
the specific implementation whether to support them or discard them (so
we require extensive usage of KResult and KResultOr, together with
virtual characteristic functions).
As a result, the interface is much cleaner and understandable to read.
2021-10-27 07:57:44 +03:00
Daniel Bertalan ac1cac286b Profiler: Fix disassembling objects with a non-zero .text vaddr
Previously, we assumed that the `.text` segment was loaded at vaddr 0 in
shared object, which is not the case with `-z separate-code` enabled.
Because we didn't do the right calculations to translate an address from
a performance event into its value within the ELF file, Profiler would
try to disassemble out-of-bounds memory locations, leading to a crash.

This commit also changes `LibraryMetadata` to apply to a loaded library
as a whole, not just to one of its segments (like .text or .data). This
lets us simplify the interface, as we no longer have to worry about
`text_base`.

Fixes #10628
2021-10-25 12:14:26 +02:00
Daniel Bertalan 15a14d3d21 LibX86: Take load base address into consideration during disassembly
Since our executables are position-independent, the address values
extraced from processes don't correspond to their values within the ELF
file. We have to offset the absolute addresses by the load base address
to get the relative symbol that we need for disassembly.
2021-10-25 12:14:26 +02:00
Daniel Bertalan 7c27ba1240 Profiler: Subtract the kernel's base address when searching for symbols
Now that the kernel is compiled as a PIE, all addresses are relative to
the loaded base address, so Symbolication::kernel_base has to be
subtracted off from the absolute addresses if we want to symbolicate
them.
2021-10-25 12:14:26 +02:00
Idan Horowitz 87bd98fe8e Profiler: Handle profiles with more kernel samples than user samples
Previously we assumed there were less kernel samples than user samples,
by implicitly using the kernel histogram size for indicies to the user
histogram. Such a profile can be reproduced by profiling a very short
lived program like true: `profile -c true`
2021-10-24 23:04:47 +02:00