Commit Graph

387 Commits

Author SHA1 Message Date
Andreas Kling
e59bf87374 Userland: Replace VERIFY(is<T>) with verify_cast<T>
Instead of doing a VERIFY(is<T>(x)) and *then* casting it to T, we can
just do the cast right away with verify_cast<T>. :^)
2021-06-24 21:13:09 +02:00
Gunnar Beutner
f2eb759901 Profiler: Use u32 when constructing InstructionData
When constructing values of the InstructionData type we assume that
the event_count field is a size_t while it actually is a u32. On x86_64
this fails because those are different types.
2021-06-24 09:27:13 +02:00
Gunnar Beutner
ac650d2362 Userland: Remove dummy IPC methods
They're not used anywhere and are unnecessary boilerplate code. So let's
remove them and update IPCCompiler to allow for empty endpoint
declarations.
2021-06-24 00:38:58 +02:00
Federico Guerinoni
e0f1c237d2 HackStudio: Make TODO entries clickable
Now you can click a TODO entry to set focus on that position of that
file.
2021-06-23 19:00:11 +01:00
Federico Guerinoni
935c7b2f4b HackStudio: Add TODO entries widget 2021-06-23 19:00:11 +01:00
Federico Guerinoni
26a7356e90 LanguageServers: Add function to collect TODO entries in a document 2021-06-23 19:00:11 +01:00
Hendiadyoin1
5d24b5f4be UserspaceEmulator: Add a simple debugging Console
For now this only allows us to single-step through execution and inspect
part of the execution environment for debugging
This also allows to run to function return and sending signals to the VM

This changes the behavior of SIGINT for UE to pause execution and then
terminate if already paused

A way of setting a watchpoint for a function would be a good addition in
the future, the scaffold for this is already present, we only need to
figure out a way to find the address of a function

On a side note I have changed all occurences of west-const to east const
2021-06-23 12:41:37 +04:30
Gunnar Beutner
92fdc5bd69 Playground: Prompt to save changes after the user picked a file to open
There's no point in saving the file - and potentially having to ask the
user for a file name - if the user abandons the 'Open' action by
clicking 'Cancel' in the file picker. This now also matches TextEditor's
behavior.
2021-06-22 22:56:22 +02:00
Gunnar Beutner
c2ae25967a Playground: Add a menu action to save the file
There was already 'Save As' and now we also have 'Save'.
2021-06-22 22:56:22 +02:00
Gunnar Beutner
de84b3fa1c Playground: Ask to save changes even when the document was never saved
This makes sure to ask the user whether they want to save changes to
their current document when opening a file even if the document has
never been saved before.
2021-06-22 22:56:22 +02:00
Idan Horowitz
dcb55db99b LibJS: Replace boolean without_side_effects parameters with an enum 2021-06-17 16:52:15 +02:00
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Dmitrii Ubskii
d5828dbecb HackStudio: Indicate git changes in the editor's gutter
"+" for added lines, "!" for changed, "-" for removed.
2021-06-13 12:33:15 +01:00
Dmitrii Ubskii
8501617fcb LibGUI+HackStudio: Make gutter a first class element
Gutter -- a space left of the text, before the ruler -- is not a part of
the ruler, nor should it be treated as such. This commit implements
gutter handling in LibGUI::TextEditor as part of mild cleaning up of the
gutter handling (breakpoint icons) in HackStudio's Editor.

This commit also enables separate theming of the gutter.
2021-06-13 12:33:15 +01:00
Gunnar Beutner
1fd547bf0b IPCCompiler: Avoid copies for IPC method return values
Fixes #8017.
2021-06-13 10:33:09 +02:00
NonStdModel
c93f73c617 HackStudio: Remove unnecessary unveil in ShellLanguageServer
Remove unveil on / with only browse permissions. Unveil will be sealed
later when the root path of project is known.
2021-06-12 22:49:20 +04:30
Andreas Kling
dc65f54c06 AK: Rename Vector::append(Vector) => Vector::extend(Vector)
Let's make it a bit more clear when we're appending the elements from
one vector to the end of another vector.
2021-06-12 13:24:45 +02:00
networkException
592bc1e331 HackStudio: Add "Show in File Manager" Action to project TreeView
This shows all selected inodes in their parent directory.

Currently, each selection makes a seperate call to LaunchServer
and opens a seperate FileManager window. In the future selections
with a shared parent could share windows.
2021-06-12 00:47:37 +01:00
Hendiadyoin1
5ffe23e4f3 AK+LibX86: Generalize u128/256 to AK::UFixedBigInt
Doing these as custom classes might be faster, especially when writing
them in SSE, but this would cause a lot of Code duplication and due to
the nature of constexprs and the intelligence of the compiler they might
be using SSE/MMX either way
2021-06-11 18:14:11 +04:30
Itamar
dcdb0c7035 LibCpp: Support non-field class members
Previously, we had a special ASTNode for class members,
"MemberDeclaration", which only represented fields.

This commit removes MemberDeclaration and instead uses regular
Declaration nodes for representing the members of a class.

This means that we can now also parse methods, inner-classes, and other
declarations that appear inside of a class.
2021-06-09 22:26:46 +02:00
Ali Mohammad Pur
7ac196974d Everywhere: Replace Vector<T*> with nonnull entries with Vector<T&> 2021-06-08 19:14:24 +02:00
Jelle Raaijmakers
a32fe8df33 UserspaceEmulator: Stop parsing options on first non-option 2021-06-08 11:30:58 +02:00
Ali Mohammad Pur
51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Max Wipfli
cb5a50d3f7 LibGUI: Fix off-by-one error in Lexer tokens
This changes the INI and GML lexers to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.

The other user of GMLToken::m_end, GMLAutocompleteProvider, has been
modified to take into account that end position columns have been
incremented by one.
2021-06-05 00:32:28 +04:30
Itamar
fdaec58f59 HackStudio: Add comment about lexicographical insertion to ClassView 2021-06-04 19:29:22 +02:00
Itamar
c1b2003687 HackStudio: Use Node's name when inserting to the ClassView tree
Previously, when traversing the ClassView tree to find the parent of a
new node, we used the name of the node's declaration to find the path
to the parent in the tree.

However, some nodes in the tree do not have a matching declaration,
which caused a VERIFY failure.

To fix this, we now use the node's name when walking the tree.
We can do this because the node's name should be identical to the name
of its declaration.

Closes #7702.
2021-06-04 19:29:22 +02:00
DhruvMaroo
6c3d601e87 Profiler: Show the duration of the time interval chosen 2021-06-04 09:30:22 +02:00
Gunnar Beutner
9444272ba0 Profiler: Remove m_deepest_stack_depth
This isn't used anymore so let's remove it entirely.
2021-06-03 01:16:32 +01:00
Gunnar Beutner
a607f13fc7 Profiler: Use sequential serial numbers for profiling events
Previously Profiler was using timestamps to distinguish processes.
However it is possible that separate processes with the same PID exist
at the exact same timestamp (e.g. for execve). This changes Profiler
to use unique serial numbers for each event instead.
2021-06-03 01:16:32 +01:00
Marcus Nilsson
3931b292b0 HackStudio: Make locator lose focus on close
Make locator lose focus when pressing escape or by clicking in the
editor area.
2021-06-02 23:15:52 +01:00
Marcus Nilsson
b43dad1741 HackStudio: Remove unused includes 2021-06-02 23:15:52 +01:00
Marcus Nilsson
8d3539a1c4 HackStudio: Close locator on exit 2021-06-02 23:15:52 +01:00
Matthew Jones
9720261540 TextEditor/GMLPlayground: Don't close app if user aborts save on exit 2021-06-02 18:15:19 +02:00
Matthew Jones
fe026fef47 Inspector: Check if RemoteProcess is_inspectable
The previous check of looking at `/proc/PID` was not working, it would
always fail even if the process was indeed inspectable.

Commit 70117781 introduced a new IPC for asking InspectorServer whether
or not a given `pid` is actually inspectable.

If a process is not inspectable, the `GUI::ProcessChooser` is
redisplayed if it was previously displayed, otherwise it exits.
2021-06-02 11:19:04 +02:00
Gunnar Beutner
15b69eef66 Profiler: Fix loading profiles which previously would crash the profiler
The profiler tried to be clever when handling process_exit events by
subtracting one from the timestamp. This was supposed to ensure that
events after a process' death would be attributed to the new process
in case the old process used execve(). However, if there was another
event (e.g. a CPU sample) at the exact same time the process_exit
event was recorded the profile would fail to load because we
didn't find the process anymore.

This changes introduces a new problem where samples would be attributed
to the incorrect process if a CPU sample for the old process, a
process_exit as well as a process_create event plus another CPU sample
event for the new process happened at the exact same time. I think
it's a reasonable compromise though.
2021-06-02 09:24:58 +02:00
Itamar
4f1889c2cb CppLanguageServer: Work with a HashMap of Symbols in each document
This is a pretty fundamental refactor of the way
CppComprehensionEngine works.

Previously, in order to answer queries such as "goto definition" or
"autocomplete", we would do ad-hoc logic of walking the AST,
collecting available declaration nodes, computing scopes, and so on.

This commit introduces an architectural change where each Document
builds a hashmap of symbols on creation.

With these hashmaps, it's easier to iterate over all of the available
symbols, and to answer a query such as "which symbols are defined in
this scope".
2021-06-01 22:20:13 +02:00
Ben Wiederhake
a7c265f341 Everywhere: Sort out superfluous QuickSort.h imports
They were sorta unneeded. :^)
2021-05-29 23:41:54 +01:00
Gunnar Beutner
547eb4973a Profiler: Use a more reasonable default event mask
Previously Profiler (e.g. when started via the context menu in
SystemMonitor) would request logging _all_ event types. While this
might be useful at a later point in time the lack of event type
filtering in the profile viewer makes this less useful because
showing different event types in the same timeline shows an inaccurate
picture of what was really going on.

Some event types (like kmalloc) happen more frequently than others
(e.g. CPU samples) and while they don't carry the same weight they
would still dominate the samples graph.

This changes the Profiler app to just do CPU sampling for now.
2021-05-28 08:00:14 +02:00
Gunnar Beutner
1f57cc5957 UE: Make sure signal_trampoline_dummy is not optimized away with -flto
This adds __attribute__((used)) to the function declaration so the
compiler doesn't discard it. It also makes the function NEVER_INLINE
so that we don't end up with multiple copies of the function. This
is necessary because the function uses inline assembly to define some
unique labels.
2021-05-28 07:59:05 +02:00
Andreas Kling
2952c86f38 Profiler: Don't try to create a DisassemblyModel for invalid indices
This fixes a null dereference when toggling the "top functions" mode
while a top-level process node was selected.
2021-05-27 11:45:29 +02:00
Andreas Kling
25468fdcf7 Playground: Start out with a GUI::Frame on the right hand side
This looks a lot nicer than starting with a plain GUI::Widget.
2021-05-26 22:17:47 +02:00
Jelle Raaijmakers
2c772d1848 LibGUI/AbstractView: Remove on_selection
Since the introduction of multi-select, we have had both `on_selection`
and `on_selection_change`, the latter of which was only invoked when a
change in selection came in through the model.

This removes `AbstractView::on_selection` and replaces it usage with
the more explicit `on_selection_change` everywhere.
2021-05-26 17:39:13 +04:30
Andreas Kling
e6f8a5111f Profiler: Hide timeline scrollbars if we don't need them :^) 2021-05-25 19:04:17 +02:00
Andreas Kling
de395a3df2 AK+Everywhere: Consolidate String::index_of() and String::find()
We had two functions for doing mostly the same thing. Combine both
of them into String::find() and use that everywhere.

Also add some tests to cover basic behavior.
2021-05-24 11:59:18 +02:00
Gunnar Beutner
39f0739381 LibC+UE: Keep more unused chunked blocks around
Previously each malloc size class would keep around a limited number of
unused blocks which were marked with MADV_SET_VOLATILE which could then
be reinitialized when additional blocks were needed.

This changes malloc() so that it also keeps around a number of blocks
without marking them with MADV_SET_VOLATILE. I termed these "hot"
blocks whereas blocks which were marked as MADV_SET_VOLATILE are called
"cold" blocks because they're more expensive to reinitialize.

In the worst case this could increase memory usage per process by
1MB when a program requests a bunch of memory and frees all of it.

Also, in order to make more efficient use of these unused blocks
they're now shared between size classes.
2021-05-23 19:31:39 +02:00
Andreas Kling
a1e133cc6b LibCore: Make ProcessStatisticsReader return results in a Vector
The HashMap API was overkill and made using this less ergonomic than
it should be.
2021-05-23 11:10:15 +02:00
Andreas Kling
a345a1f4a1 Userland: Mark subclasses of IPC::{Client,Server}Connection final 2021-05-23 09:53:55 +02:00
Andreas Kling
c1c252ddb2 LibIPC: Remove unnecessary IPC::ServerConnection::handshake()
This is no longer used by any of our IPC pairs.
2021-05-23 09:53:55 +02:00
Andreas Kling
0af69e8917 HackStudio: Greet language servers asynchronously
There's no need to wait for a response after we've sent the project
path to a newly connected language server.
2021-05-23 09:53:55 +02:00
Andreas Kling
03df8882df InspectorServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00